netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: jamal <hadi@cyberus.ca>
Cc: jt@hpl.hp.com, netdev@oss.sgi.com
Subject: Re: [PATCH 2.6 NET] Device name changing via rtnetlink
Date: Sat, 11 Sep 2004 15:44:09 +0200	[thread overview]
Message-ID: <20040911134409.GA21181@postel.suug.ch> (raw)
In-Reply-To: <1094868070.1042.77.camel@jzny.localdomain>

* jamal <1094868070.1042.77.camel@jzny.localdomain> 2004-09-10 22:01
> On Fri, 2004-09-10 at 19:17, Thomas Graf wrote:
> 
> > There is one remaining problem, currently, changes via rtnetlink will
> > result in multiple notifies being sent out because NETDEV_CHANGEMTU
> > and NETDEV_CHANGENAME are invoked as well and result in a netlink
> > message. Changing them to not do anything in rtnetlink context
> > would solve it but we would lose the notify if the change was made
> > via ioctl.
> > 
> Are you changing MTU and NAME at the same time?

Possibly, I change everything the user requests me to do.

> Valid to receive the two updates i would think in that case.

That's not the problem, the problem is that you may receive
more updates than requested changes. Let's assume you're changing
the MTU using IFLA_MTU and it succeeds. dev_set_mtu will send
out the first update, at the end the do_setlink will send
out another update.

Changing MTU and ifname would result in 3 updates:

 1) RTM_NEWLINK with updated mtu (old name)
 2) RTM_NEWLINK with mtu and name updated
 3) same again as 2)

I personally have no problem with the current behaviour but maybe
we should clean this up a bit.

Suggestion:
 Send out a notify for every change we make. This can result
 in 7 updates being sent out. It would allow the application
 to see how far the kernel was successful quite easly or
 do a revision control and switch back to older configurations.

Something like this:

--- linux-2.6.9-rc1-bk15.orig/net/core/rtnetlink.c	2004-09-11 15:39:06.000000000 +0200
+++ linux-2.6.9-rc1-bk15/net/core/rtnetlink.c	2004-09-11 15:39:37.000000000 +0200
@@ -295,6 +295,7 @@
 
 		if (err)
 			goto out;
+		call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
 	}
 
 	if (ida[IFLA_ADDRESS - 1]) {
@@ -312,6 +313,7 @@
 		err = dev->set_mac_address(dev, RTA_DATA(ida[IFLA_ADDRESS - 1]));
 		if (err)
 			goto out;
+		call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
 	}
 
 	if (ida[IFLA_BROADCAST - 1]) {
@@ -319,6 +321,7 @@
 			goto out;
 		memcpy(dev->broadcast, RTA_DATA(ida[IFLA_BROADCAST - 1]),
 		       dev->addr_len);
+		call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
 	}
 
 	if (ida[IFLA_MTU - 1]) {
@@ -336,6 +339,7 @@
 			goto out;
 
 		dev->tx_queue_len = *((u32 *) RTA_DATA(ida[IFLA_TXQLEN - 1]));
+		call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
 	}
 
 	if (ida[IFLA_WEIGHT - 1]) {
@@ -343,6 +347,7 @@
 			goto out;
 
 		dev->weight = *((u32 *) RTA_DATA(ida[IFLA_WEIGHT - 1]));
+		call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
 	}
 
 	if (ida[IFLA_IFNAME - 1]) {
@@ -365,8 +370,6 @@
 	err = 0;
 
 out:
-	if (!err)
-		call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
 
 	dev_put(dev);
 	return err;

  reply	other threads:[~2004-09-11 13:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-10 19:50 [PATCH 2.6 NET] Device name changing via rtnetlink Jean Tourrilhes
2004-09-10 20:06 ` Thomas Graf
2004-09-10 20:13   ` Jean Tourrilhes
2004-09-10 20:22     ` Thomas Graf
2004-09-10 20:31       ` jamal
2004-09-10 20:32       ` Jean Tourrilhes
2004-09-10 20:43         ` Thomas Graf
2004-09-10 22:58           ` jamal
2004-09-10 23:17             ` Thomas Graf
2004-09-11  2:01               ` jamal
2004-09-11 13:44                 ` Thomas Graf [this message]
2004-09-11 19:59                   ` jamal
2004-09-11 22:06                     ` Thomas Graf
2004-09-12 17:27                       ` jamal
2004-09-13  0:20                         ` David S. Miller
2004-09-10 23:04           ` David S. Miller
  -- strict thread matches above, loose matches on Subject: below --
2004-09-10 13:36 Thomas Graf
2004-09-10 14:00 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-10 14:28   ` Thomas Graf
2004-09-10 14:31     ` YOSHIFUJI Hideaki / 吉藤英明

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040911134409.GA21181@postel.suug.ch \
    --to=tgraf@suug.ch \
    --cc=hadi@cyberus.ca \
    --cc=jt@hpl.hp.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).