BIND 10 #878: Code to bind to address/port
BIND 10 Development
do-not-reply at isc.org
Thu Aug 18 17:54:06 UTC 2011
#878: Code to bind to address/port
-------------------------------------+-------------------------------------
Reporter: shane | Owner: tomek
Type: | Status: reviewing
enhancement | Milestone: Sprint-
Priority: major | DHCP-20110712
Component: dhcp | Resolution:
Keywords: | Sensitive: 0
Defect Severity: N/A | Sub-Project: DHCP
Feature Depending on Ticket: dhcp- | Estimated Difficulty: 3.0
echo | Total Hours: 0
Add Hours to Ticket: 0 |
Internal?: 0 |
-------------------------------------+-------------------------------------
Comment (by tomek):
Thanks for thorough review. I did fix most of what was pointed out. In
cases where I chose to keep the code as it is, explanation is provided
below.
Addr6:
- Class replaced completely with asiolink::IOAddress. Class and tests
removed. This class was memory optimal (sizeof(Addr6) == 16), similar
design for Addr4 would be 4 bytes long. That is not the case with
IOAddress (sizeof(IOAddress)==32). It is good that Addr6 is kept in GIT
history. We may decide to use it someday.
Pkt6:
- now uses boost::shared_array to manage its buffer.
IfaceMgr:
- check_once was NOT used. It includes phtreads and is expected to be used
for thread synchronization. That would add extra dependencies with
potential problems, and benefit would be minimal. Made
IfaceMgr::createInstance() private instead.
- openSockets() and isMulticast() is now protected (it is used in tests,
has to be accesible from derived class, so it can't be private).
- printIface() now takes ostream as parameter (with cout being default
value)
- getIface() keeps returning non const pointers. There's a good reason to
do that. There may be some modifications done to returned interface. For
example statistics may be changed.
Simple statistics can be updated within IfaceMgr itself, but in time we
will get also the fancy ones, e.g. how many clients on this interface
failed authentication checks. If you insist on having that const, I won't
object and will add it, but it will be worse from design perspective
(methods belonging to Iface will be implemented in IfaceMgr).
- NULLs are now used instead of 0
- Iface() constructor is removed
- openSockets() now closes open socket when error is detected.
- Many functions are now described. Doxygen format is used.
- Buffer size increased to 64k (not necessary, as there are no client
messages that big; RFC3315 mentions only server packet fragmentation; also
size was already checked during reception, we are safe in case of strange
things client may happen to throw at us)
- packets received over unknown interface are no longer processed
- Binding multiple addresses on the same port would only be useful in
unicast communication (see unicast option in DHCPv6). This will be
implemented after interface detection is implemented.
- Changed XXX to TODO
Addr6Test:
- Addr6 class removed and so is its test.
IfaceMgrTest:
- fixed problem with getIface("eth0") != NULL (IfaceMgr is a singleton, so
instance from previous test was used)
- added test for trying to bind the same address/port twice
- added comment that getPlainMac() has to be tested as soon as interface
dectection is implemented. Currently MAC is not detected and it doesn't
make much sense to implement fake MAC detection, just to write test that
reports back fake MAC.
- added test for multicast. It will be expanded once we get interface
detection routines and will be able to to find non-multicast interface.
All changes pushed to trac878.
--
Ticket URL: <http://bind10.isc.org/ticket/878#comment:22>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list