netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Oliver Neukum <oliver@neukum.org>
Cc: linux-kernel@vger.kernel.org,
	Linux Netdev List <netdev@vger.kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: cannot set IP for ethernet
Date: Tue, 12 Jun 2007 16:06:25 +0200	[thread overview]
Message-ID: <466EA861.2070509@trash.net> (raw)
In-Reply-To: <200706121441.13561.oliver@neukum.org>

[-- Attachment #1: Type: text/plain, Size: 726 bytes --]

Oliver Neukum wrote:
> with 2.6.22-rc4-git2 I am getting errors when setting IP for ethernet
> interfaces:
> 
> ioctl(4, SIOCSIFADDR, 0x7fff94931600)   = -1 ENOBUFS (No buffer space available)
> 
> The error is independant of the interface. It happens to all interfaces.
> There's nothing in the syslog.
> 
> valisk:/home/oliver # uname -a
> Linux valisk 2.6.22-rc4-git2-default #3 SMP Tue Jun 12 13:27:54 CEST 2007 x86_64 x86_64 x86_64 GNU/Linux


This can happen if the initial inetdev allocation when the netdevice is
registered fails. I think it would make sense to try to allocate again
when adding addresses in that case, otherwise there is no way of
recovery other than unregistering and registering the device again.


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 776 bytes --]

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index abf6352..dc77e91 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -401,8 +401,11 @@ static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa)
 	ASSERT_RTNL();
 
 	if (!in_dev) {
-		inet_free_ifa(ifa);
-		return -ENOBUFS;
+		in_dev = inetdev_init(dev);
+		if (!in_dev) {
+			inet_free_ifa(ifa);
+			return -ENOBUFS;
+		}
 	}
 	ipv4_devconf_setall(in_dev);
 	if (ifa->ifa_dev != in_dev) {
@@ -514,8 +517,11 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
 
 	in_dev = __in_dev_get_rtnl(dev);
 	if (in_dev == NULL) {
-		err = -ENOBUFS;
-		goto errout;
+		in_dev = inetdev_init(dev);
+		if (!in_dev) {
+			err = -ENOBUFS;
+			goto errout;
+		}
 	}
 
 	ipv4_devconf_setall(in_dev);

       reply	other threads:[~2007-06-12 14:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200706121441.13561.oliver@neukum.org>
2007-06-12 14:06 ` Patrick McHardy [this message]
2007-06-13  8:39   ` cannot set IP for ethernet Oliver Neukum
2007-06-13 11:14     ` Patrick McHardy
2007-06-13 11:21       ` Oliver Neukum
2007-06-13 11:25         ` Patrick McHardy
2007-06-13 11:55           ` Oliver Neukum
2007-06-14  3:53   ` Herbert Xu
2007-06-14  3:56     ` David Miller

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=466EA861.2070509@trash.net \
    --to=kaber@trash.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oliver@neukum.org \
    /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).