Moved to netdev where it belongs. Vividh in the future please post
to netdev or at least cross-post to it ... because the kernel list
FAQ says so.
In your posting you say:
Imagine a interface eth0 with address 10.10.10.10, netmask 0xffffff00
and broadcast 10.10.10.255.
For eg: if the following command is issued:
ifconfig eth0 10.10.10.50 netmask 0xffffff00 broadcast 10.10.10.255
The kernel sends the following three sets of messages on the netlink
socket:
Interface address delete: (with address 10.10.10.10)
Interface address add : (with address 10.10.10.50)
Interface address delete: (with address 10.10.10.50)
Interface address add : (with address 10.10.10.50)
Interface address delete: (with address 10.10.10.50)
Interface address add : (with address 10.10.10.50)
Ideally as only the interface address is changed only one address
delete/add should be sent.
State is not maintained in user space. You change that IP address,
it actually gets deleted then a new one added. The bcast and netmask
changeto defaults as a result; you then change the netmask and
broadcast with each requiring a call from user space. If you modify your
netlink program to print both net and broadcast address you should see
this. BTW, you MUST check for these.
Example try just:
ifconfig eth0 10.10.10.50
and after you change it try:
ifconfig eth0 10.10.10.50 netmask 0xffffff00
and then
ifconfig eth0 10.10.10.50 netmask 0xffffff00 broadcast 10.10.10.255
cheers,
jamal