[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Query on Netlink sockets on debian etch

Hi Ben,
Thanks for your mail.
As there were two RTM_DELADDR, I am not sure on how the parsing of this msg would result in identifying the notification type.
Even I could get the following ioctl command with strace when tried with netmask,
ioctl(4, SIOCSIFADDR, 0xbfb3f740)       = 0
ioctl(4, SIOCSIFFLAGS, 0xbfb3f660)      = 0
ioctl(4, SIOCSIFNETMASK, 0xbfb3f740)    = 0  <- Results in additional RTM_NEWADDR
I even wrote a snippet as in below to identify the type of RTM_NEWADDR, but couldn't succeed in it.
                        if (pNLMsg->nlmsg_type  == RTM_NEWADDR)
                                printf("New address being added to the interface: Flags:0x%x\n",pNLMsg->nlmsg_flags);
                                struct ifaddrmsg *pIfAddr = (struct ifaddrmsg*) NLMSG_DATA(pNLMsg);
                                struct rtattr *rtatp = (struct rtattr *)IFA_RTA(pIfAddr);
                                int rtattrlen = IFA_PAYLOAD(pNLMsg);
                                printf("ifaddrmsg family=%d, index=%d, flags=0x%x\n", pIfAddr->ifa_family, pIfAddr->ifa_index, pIfAddr->ifa_flags);
                                 for (; RTA_OK(rtatp, rtattrlen); rtatp = RTA_NEXT(rtatp, rtattrlen)) ;;
As this is related to routing socket notifications and ifconfig command (ioctl), I hope this is query is still related to debian kernel forum. As I have tried my level best on this, otherwise could you please let me know the appropriate forum you want me to post this query.
Could you please help me out with your thoughts on this.
Thanks and regards,
On Sat, Oct 3, 2009 at 6:29 PM, Ben Hutchings <ben@decadent.org.uk> wrote:
On Sat, 2009-10-03 at 09:02 +0530, sathya sai wrote:
> 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?

Changing netmask results in a deletion of the existing address and
addition of a new one.  So you need to handle RTM_DELADDR too.

This is really off-topic for debian-kernel now.


Ben Hutchings
Always try to do things in chronological order;
it's less confusing that way.

Reply to: