Hi Ben, Thanks for the mail.
Is there any means by which I can identify if the notification is for IP address (or) netmask address for RTM_NEWADDR? Thanks and regards, Sathya On Sat, Oct 3, 2009 at 3:59 AM, Ben Hutchings <b...@decadent.org.uk> wrote: > On Fri, 2009-10-02 at 23:40 +0530, sathya sai wrote: > [...] > > But, when I reconfigure my network interface with the below ifconfig > > command, I am shocked that the above netlink program is giving me two > > notifications with RTM_NEWADDR (new address being added to an > > interface) > > > > I am not sure why the second ifconfig command gives me the two > > RTM_NEWADDR netlink notifications? > > > > ifconfig eth0 inet 0 > > ifconfig eth0 inet 10.208.34.114 netmask 255.255.255.0 > > > > To analyse further on this, I then changed the second ifconfig to as > > in below(removed the netmask part), > > > > ifconfig eth0 inet 10.208.34.114 > > > > Now I am getting only one RTM_NEWADDR netlink notification from the > > kernel.(although the netmask and broadcast address as been assigned to > > the default address by the kernel). > > > > Could you please help me out by answering why with my prior netlink > > command the debian kernel was triggering two RTM_NEWADDR > > notifications. > > If I run: > strace ifconfig eth0 inet 10.208.34.114 netmask 255.255.255.0 > it shows me: > ioctl(4, SIOCSIFADDR, 0xff97ca88) = 0 > ioctl(4, SIOCGIFFLAGS, {ifr_name="eth0", > ifr_flags=IFF_UP|IFF_BROADCAST|IFF_MULTICAST}) = 0 > ioctl(4, SIOCSIFFLAGS, 0xff97c98c) = 0 > ioctl(4, SIOCSIFNETMASK, 0xff97ca88) = 0 > > So the address and netmask configuration are two separation operations > that are notified separately. > > Ben. > > -- > Ben Hutchings > Who are all these weirdos? - David Bowie, about L-Space IRC channel #afp >