BIND 10 #1238: IfaceMgr support for IPv4 (incl. Socket binding for v4)

BIND 10 Development do-not-reply at isc.org
Wed Dec 7 12:17:45 UTC 2011


#1238: IfaceMgr support for IPv4 (incl. Socket binding for v4)
-------------------------------------+-------------------------------------
                   Reporter:         |                 Owner:  stephen
  stephen                            |                Status:  reviewing
                       Type:  task   |             Milestone:  Sprint-
                   Priority:  major  |  DHCP-20111207
                  Component:  dhcp4  |            Resolution:
                   Keywords:         |             Sensitive:  0
            Defect Severity:  N/A    |           Sub-Project:  DHCP
Feature Depending on Ticket:         |  Estimated Difficulty:  0
        Add Hours to Ticket:  0      |           Total Hours:  0
                  Internal?:  0      |
-------------------------------------+-------------------------------------
Changes (by tomek):

 * owner:  tomek => stephen


Comment:

 Replying to [comment:10 stephen]:
 > Reviewed commit 660cf410c0fb41587b977df992879f5dff934c19.
 >
 > A couple of minor points and one more major.
 >
 > '''src/bin/dhcp6/tests/dhcp6_srv_unittest.cc'''[[BR]]
 > "basic" test: "Dhcp6Srv * srv" should be "Dhcp6* srv".
 Done.
 > "basic" test: There is no need to check for src being non-null before
 calling delete; if it is null, the delete call will be a no-op.
 For some reason I thought that behavior after deleting NULL is undefined.
 It turns out that it is valid. I really need to get a copy of C++ standard
 and read it through.

 > "Solicit_basic" test: "100+i" should be "100 + i".
 >
 > '''src/bin/dhcp6/iface_mgr.cc'''[[BR]]
 > delAddress(): The "return" statement could be simplified to "return
 (addrs_.size() < size);"
 >
 > >> openSocket4/6(): This is declared to return uint16_t, but it returns
 the "sock" variable which is (correctly) declared "int" (the return type
 of socket()).
 > > It was pointed out in #1282 that uint16_t should be used. Signed int
 is used to indicate errors, but we handle this with exceptions. My
 understanding is that the we can use uint16_t or uint32_t here. Jelte
 pointed out that uint16_t should be used, so I'm doing that.
 > #1282 says that IfaceMgr::openSocket '''takes''' int, should be
 uint16_t.  That is true because an imput parameter is a port number, which
 is an unsigned 16-bit integer.  However, it returns a Unix file
 descriptor, which is an "int". (From
 [http://en.wikipedia.org/wiki/File_descriptor Wikipedia]: "In POSIX, a
 file descriptor is an integer, specifically of the C type int.") socket(),
 open(), creat() - all functions that return a file descriptor - return an
 int.  Even if we signal errors by throwing exceptions, we should use "int"
 for file descriptors.
 I stand corrected. For some reason I assumed that file descriptor is only
 16 bits. Fixed code is checked in.

 Also checked in changes for Pkt4. It now stores a copy of input data.

 Please review.

-- 
Ticket URL: <http://bind10.isc.org/ticket/1238#comment:11>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list