dhcpclient - allow to specify interface and send/recv at raw packet level
authorNicolas C <nchaigne@capgemini.fr>
Tue, 5 Aug 2014 09:06:40 +0000 (11:06 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 25 Jan 2015 22:39:46 +0000 (17:39 -0500)
commit7deeac78b8fc50cdcd4eb7db7d9a4bee83fa2db6
tree5c43c65249ab2d3271fc65a12c48dc715b039d18
parent1007fd2b68e540d38539c499116a7554dece9b2a
dhcpclient - allow to specify interface and send/recv at raw packet level

As discussed earlier on the list:
- 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.
This is modified by the device driver.

This patch does the following:
- Add an option to dhcpclient allowing to specify which network
interface to use.
- Open a raw socket on the low level packet interface. This allows
packet data to be left unchanged by the device driver.
- Encode Ethernet (send to ff:ff:ff:ff:ff:ff), IP and UDP layers
manually. And let FreeRADIUS do the DHCP stuff, as before.

(This required new specific socket / send / recv functions.)

The existing behaviour of dhcpclient is unchanged, it is used if the new
option -i is not set (or if destination is not broadcast).

Conflicts:
src/modules/proto_dhcp/dhcpclient.c
src/include/dhcp.h
src/include/net.h
src/lib/net.c
src/modules/proto_dhcp/dhcp.c
src/modules/proto_dhcp/dhcpclient.c