* [RFC/PATCH] Add support for setting net_device flags via RTM_SETLINK
@ 2004-08-23 21:16 Thomas Graf
2004-08-23 22:04 ` Thomas Graf
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Graf @ 2004-08-23 21:16 UTC (permalink / raw)
To: davem, kuznet, hadi; +Cc: netdev
Hello
The patch below extends RTM_SETLINK to change net_device flags if
a new value is provided via ifinfomsg and modifies the way flags
are shown to userspace to maintain balance and only show flags
which can be modified (as in ioctl handlers):
The change in behaviour:
old:
r->ifi_flags = dev->flags;
if (!netif_running(dev) || !netif_carrier_ok(dev))
r->ifi_flags &= ~IFF_RUNNING;
else
r->ifi_flags |= IFF_RUNNING;
new:
flags = (dev->flags & ~(IFF_PROMISC | IFF_ALLMULTI | IFF_RUNNING)) |
(dev->gflags & (IFF_PROMISC | IFF_ALLMULTI));
if (netif_running(dev) && netif_carrier_ok(dev))
flags |= IFF_RUNNING;
I will implement the 2 hidden flags IFF_PROMISC and IFF_ALLMULTI as separate
message attributes (IFLA_PROMISC and IFLA_ALLMULTI) as soon as I get some
comments on this idea.
--- 1.20/net/core/rtnetlink.c Sun Aug 22 18:11:03 2004
+++ 1.21/net/core/rtnetlink.c Mon Aug 23 22:32:39 2004
@@ -166,14 +166,9 @@
r->ifi_family = AF_UNSPEC;
r->ifi_type = dev->type;
r->ifi_index = dev->ifindex;
- r->ifi_flags = dev->flags;
+ r->ifi_flags = dev_get_flags(dev);
r->ifi_change = change;
- if (!netif_running(dev) || !netif_carrier_ok(dev))
- r->ifi_flags &= ~IFF_RUNNING;
- else
- r->ifi_flags |= IFF_RUNNING;
-
RTA_PUT(skb, IFLA_IFNAME, strlen(dev->name)+1, dev->name);
RTA_PUT(skb, IFLA_TXQLEN, sizeof(unsigned long), &dev->tx_queue_len);
if (dev->addr_len) {
@@ -246,6 +241,9 @@
return -ENODEV;
err = -EINVAL;
+
+ if (ifm->ifi_flags)
+ dev_change_flags(dev, ifm->ifi_flags);
if (ida[IFLA_ADDRESS - 1]) {
if (!dev->set_mac_address) {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC/PATCH] Add support for setting net_device flags via RTM_SETLINK
2004-08-23 21:16 [RFC/PATCH] Add support for setting net_device flags via RTM_SETLINK Thomas Graf
@ 2004-08-23 22:04 ` Thomas Graf
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Graf @ 2004-08-23 22:04 UTC (permalink / raw)
To: davem, kuznet, hadi; +Cc: netdev
* Thomas Graf <20040823211611.GC19921@postel.suug.ch> 2004-08-23 23:16
> I will implement the 2 hidden flags IFF_PROMISC and IFF_ALLMULTI as separate
> message attributes (IFLA_PROMISC and IFLA_ALLMULTI) as soon as I get some
> comments on this idea.
Ignore the above statement, it's nonsense. Sorry.
Thomas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-08-23 22:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-23 21:16 [RFC/PATCH] Add support for setting net_device flags via RTM_SETLINK Thomas Graf
2004-08-23 22:04 ` Thomas Graf
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).