proposed patch for supporting alias interfaces on linux systems

Miguel Telleria de Esteban miguel at mtelleria.com
Fri Sep 25 08:44:34 UTC 2009


Dear all,

THE PROBLEM

For my personal needs I would like to set a DHCP server (3.3.2p1) to
answer from a virtual interface (eth0:1). 

Trying to do this I stumbled with the same problem that has been
previously reported here:

https://lists.isc.org/mailman/htdig/dhcp-users/2006-July/001270.html

  i.e. when launching the server with:

	/usr/sbin/dhcp3d eth0:1

  I obtain the message:

      No subnet declaration for eth0:1


RESEARCH


1.  First approach

Digging inside the source code with gdb shows that the function

	discover_interfaces()

    within discover.c, trunks every aliased interface name

    "eth0:1" --> becomes "eth0"

    at the discovering stage.

More precisely, this happens when the ALIAS_NAMES_PERMUTTED is defined
(which happens on my linux system since includes/cf/linux has it
activated).


2.  Second approach  (ROOT OF THE PROBLEM)

To find the rationale of the defined I disabled it and forced the
complete name "eth0:1" to be passed to the socket functions bind() and
sendto() inside lpf.c. 

This produces an error because the linux kernel does not seem to accept
binding a socket of type SOCKET_PACKET (PF_PACKET family) to a virtual
interface.

PROPOSED SOLUTION

I propose to maintain the name truncation but only at the lowest layer
of ISC DHCP libs, that is the lpf.c socket calls.

What my attached patch does is perform the "eth0:1"-->"eth0" truncation
directly on the sockaddr_t sa.sa_data field.

Therefore the SOCKET_PACKET will be opened for the real interface
("eth0") but the IP header data (origin IP address, etc) will be taken
from the "eth0:1" information structure.

I have tested it for my simple needs and it seems to work.


MY QUESTIONS

*  Does my solution create a security flaw somehow?  what would be the
   implications for other features of ISC DHCP?

*  Would you accept the patch for future releases (also the dhcp-4
   branch if applicable)?

*  Is there a bug tracking system where this error could be posted.

Kind regards,

	Miguel Telleria



-- 

      (O-O)
---oOO-(_)-OOo-----------------------------------------------------
 Miguel TELLERIA DE ESTEBAN               http://www.mtelleria.com
 Email: miguel at mtelleria.com           Tel GSM:  +34 650 801098
                                          Tel Fix:  +34 942 280174

 Miembro de http://www.linuca.org    Membre du http://www.bxlug.be
 ¿Usuario captivo o libre?    http://www.obtengalinux.org/windows/
 Free or  captive user?        http://www.getgnulinux.org/windows/
-------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: alias_interfaces_from_discover_to_lpf.patch
Type: text/x-patch
Size: 2161 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20090925/3e2d76fb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20090925/3e2d76fb/attachment-0001.bin>


More information about the dhcp-users mailing list