Can a netdev driver configure the ip address of the device?
I am writing a netdev driver for proprietary HW used in industrial automation. The HW has no ethernet interface, so the driver actually communicates via a bus to another proprietary piece of HW (the master) that has an ethernet interface. The design is fixed, so there is nothing I can do about it.
The IP address, that the first machine should use, is configured on the master, and is sent via the bus to the first machine during initialisation.
So the driver on the first machine eventually receives its IP address, but how do I tell the kernel about it? I would not like to use DHCP - there must be a simpler way.
I can configure the MAC address using eth_mac_addr().
There is very little I can do on the master (it is safety related), so it is not an option to let it change the IP address in every packet on the bus. It needs to copy every packet unchanged.
My current solution (DHCP like) is to let the driver create files in /sys/class/net containing the information, and to let some userspace script monitor these files and execute an apropriate ifconfig command. I don't find that elegant.
Is there a way to do this? All the "good" functions seem to be static in net/ipv4/netdev.c, except devinet_ioctl() which requires a userspace buffer.
Kernel 3.9, going for 3.10.