* netlink sockets and rtm_newlink messages
@ 2002-09-26 22:38 Patrick R. McManus
2002-09-27 13:48 ` Patrick R. McManus
0 siblings, 1 reply; 6+ messages in thread
From: Patrick R. McManus @ 2002-09-26 22:38 UTC (permalink / raw)
To: netdev
hello -
I've got a little userspace app that listens to a netlink socket and
filters for messages of type RTM_NEWLINK to check for interfaces going
up or down (checking ifi_flags to make that determination)..
the only stumbling point is that I each time I do something like
"ifconfig eth4 down" my app reads 2 identical RTM_NEWLINK messages
instead of one (same behavior on up case too.)
any thoughts on why? I didn't really know how to interpret sockaddr
nl.nl_groups.. 1 seems to give me the same duplicates as ~0.. 0 gives me nothing.
-Pat
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: netlink sockets and rtm_newlink messages
2002-09-26 22:38 netlink sockets and rtm_newlink messages Patrick R. McManus
@ 2002-09-27 13:48 ` Patrick R. McManus
2002-09-27 14:36 ` jamal
2002-09-27 15:55 ` kuznet
0 siblings, 2 replies; 6+ messages in thread
From: Patrick R. McManus @ 2002-09-27 13:48 UTC (permalink / raw)
To: netdev
for the sake of google, I'll followup to my own query. Sanity checks
are appreciated too.
the messages weren't identical - ifi_change had IFF_RUNNING set in one
message and not the other. the man page says "ifi_change is reserved
for future use" so I didn't know what to make of it before digging
into the kernel src (2.4.19).
-Pat
[pat atducksong: Sep 26 18:38]
> hello -
>
> I've got a little userspace app that listens to a netlink socket and
> filters for messages of type RTM_NEWLINK to check for interfaces going
> up or down (checking ifi_flags to make that determination)..
>
> the only stumbling point is that I each time I do something like
> "ifconfig eth4 down" my app reads 2 identical RTM_NEWLINK messages
> instead of one (same behavior on up case too.)
>
> any thoughts on why? I didn't really know how to interpret sockaddr
> nl.nl_groups.. 1 seems to give me the same duplicates as ~0.. 0 gives me nothing.
>
>
> -Pat
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: netlink sockets and rtm_newlink messages
2002-09-27 13:48 ` Patrick R. McManus
@ 2002-09-27 14:36 ` jamal
2002-09-27 15:55 ` kuznet
1 sibling, 0 replies; 6+ messages in thread
From: jamal @ 2002-09-27 14:36 UTC (permalink / raw)
To: Patrick R. McManus; +Cc: netdev
ifi_change is valid in RTM_NEWLINK messages;
You need to check IFF_RUNNING and IFF_UP to see if the
device went admin up or down.
Another reference point for you at: section 3.3.3.1 of
http://www.ietf.org/internet-drafts/draft-ietf-forces-netlink-03.txt
print out all the flags in the message headers that you receive.
[I just realized the draft also doesnt mention your issue, probably too
late o change it now that it is going into RFC status]
cheers,
jamal
On Fri, 27 Sep 2002, Patrick R. McManus wrote:
> for the sake of google, I'll followup to my own query. Sanity checks
> are appreciated too.
>
> the messages weren't identical - ifi_change had IFF_RUNNING set in one
> message and not the other. the man page says "ifi_change is reserved
> for future use" so I didn't know what to make of it before digging
> into the kernel src (2.4.19).
>
> -Pat
>
> [pat atducksong: Sep 26 18:38]
> > hello -
> >
> > I've got a little userspace app that listens to a netlink socket and
> > filters for messages of type RTM_NEWLINK to check for interfaces going
> > up or down (checking ifi_flags to make that determination)..
> >
> > the only stumbling point is that I each time I do something like
> > "ifconfig eth4 down" my app reads 2 identical RTM_NEWLINK messages
> > instead of one (same behavior on up case too.)
> >
> > any thoughts on why? I didn't really know how to interpret sockaddr
> > nl.nl_groups.. 1 seems to give me the same duplicates as ~0.. 0 gives me nothing.
> >
> >
> > -Pat
> >
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: netlink sockets and rtm_newlink messages
2002-09-27 13:48 ` Patrick R. McManus
2002-09-27 14:36 ` jamal
@ 2002-09-27 15:55 ` kuznet
2002-09-29 15:09 ` jamal
1 sibling, 1 reply; 6+ messages in thread
From: kuznet @ 2002-09-27 15:55 UTC (permalink / raw)
To: Patrick R. McManus; +Cc: netdev
Hello!
> the messages weren't identical
One of them is a mud. Apparently, I forgot to delete the line
rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING)
in rtnetlink_event().
Alexey
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: netlink sockets and rtm_newlink messages
2002-09-27 15:55 ` kuznet
@ 2002-09-29 15:09 ` jamal
2002-09-30 15:43 ` kuznet
0 siblings, 1 reply; 6+ messages in thread
From: jamal @ 2002-09-29 15:09 UTC (permalink / raw)
To: kuznet; +Cc: Patrick R. McManus, netdev
Alexey,
So that you dont forget, heres the patch:
---------------------------------------------------
--- net/core/rtnetlink.c 2002/09/29 10:41:08 1.1
+++ net/core/rtnetlink.c 2002/09/29 10:41:58
@@ -496,7 +496,6 @@
break;
case NETDEV_UP:
case NETDEV_DOWN:
- rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING);
break;
case NETDEV_CHANGE:
case NETDEV_GOING_DOWN:
------------------
Wouldnt that spot be the best for NETDEV_UP/DOWN since thats the notifier
callback?
Also, can you remind me what if_change was for? netcarrier events?
cheers,
jamal
On Fri, 27 Sep 2002 kuznet@ms2.inr.ac.ru wrote:
> Hello!
>
> > the messages weren't identical
>
> One of them is a mud. Apparently, I forgot to delete the line
> rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING)
> in rtnetlink_event().
>
> Alexey
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: netlink sockets and rtm_newlink messages
2002-09-29 15:09 ` jamal
@ 2002-09-30 15:43 ` kuznet
0 siblings, 0 replies; 6+ messages in thread
From: kuznet @ 2002-09-30 15:43 UTC (permalink / raw)
To: jamal; +Cc: mcmanus, netdev
Hello!
> So that you dont forget, heres the patch:
Thanks. Indeed, you ar right, I have already forgotten this. :-)
> Wouldnt that spot be the best for NETDEV_UP/DOWN since thats the notifier
> callback?
It was moved out of there to support ifa_change bits. But apparently
I have made copy instead of move.
> Also, can you remind me what if_change was for? netcarrier events?
ifa_change was for unimplemented control part to allow atomic changes
of state not affecting another flags.
Someone spotted that it would be convenient to have this flag set
valid in all the kinds of RTM_NEWLINK messages.
Alexey
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-09-30 15:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-26 22:38 netlink sockets and rtm_newlink messages Patrick R. McManus
2002-09-27 13:48 ` Patrick R. McManus
2002-09-27 14:36 ` jamal
2002-09-27 15:55 ` kuznet
2002-09-29 15:09 ` jamal
2002-09-30 15:43 ` kuznet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).