Chaigneau, Nicolas wrote:
Additionally, I've noticed that : - if the client host has multiple interfaces, - and at least one of them already has an IP address, Then the source IP address cannot be 0.0.0.0 (even with "Packet-Src-IP-Address=0.0.0.0"). An actual IP address is automatically used as source. From what I understand, this is modified by the device driver.
Yes.
I've first tried to force the interface with setsockopt and option "SO_BINDTODEVICE", but this apparently doesn't do anything useful...
It works only if you're root. And it should mean that packets sent from the device use the devices IP address.
So I've done the following:
Add an option to dhcpclient allowing to specify which network interface to use.
That's good.
Open a raw socket on the low level packet interface. This allows packet data to be left unchanged by the device driver.
Yes.
Encode Ethernet (send to ff:ff:ff:ff:ff:ff), IP and UDP layers manually. And let FreeRADIUS do the DHCP stuff, as before.
That's how most DHCP clients work. :)
(This required new specific socket / send / recv functions.)
Yes.
Maybe there's a better way to do this... I couldn't find one, though.
Not really. It would have been nice to have a socket API to create packets. Oh well. Alan DeKok.