I develop a Linux device driver that, among other things, bridges a private and public network in a real time embedded system to provide a path from management traffic.
I know it's possible to ask the kernel from user space using an ioctl call for the IP address of a network device, but I need to be able to do it from within the device driver, and ideally be notified that the IP address has changed without needing to poll, or better still manage the process of changing the address directly.
Currently the device is notified of an address change by snooping DHCP and ARP, which the driver passes but doesn't manage in any meaningful way. However, this is a somewhat clunky solution.
The public side of the device is accessible to the operating system, and the IP can be changed using calls to ifconfig
, etc. If the device is assigned a static IP that isn't relevant to the network it can eventually work this out when communications fail, but that is less than ideal.
The driver already provides a number of ioctl handlers, is there a way to provide one to assign the IP address directly to the device, and if so what interfaces would it need to manage?
I've looked through the net_device
structure, but can't find anything relevant to IP addresses and can't find any documentation online regarding this aspect of device drivers..