* [IPSEC] RFC 4301 PFP Support
From: Tyler Hicks @ 2007-12-11 21:34 UTC (permalink / raw)
To: netdev; +Cc: latten, herbert, davem
I'm working on adding populate from packet (PFP) support to the kernel,
as specified in RFC 4301. While testing with openswan (2.4.9), I
noticed that the state selector values in the SAD were empty. It seems
that when openswan sends a ALLOCSPI message, the kernel finds the larval
xfrm_state with selector fields filled in and passes it to openswan.
Openswan will then respond with an UPDSA message that includes an
xfrm_usersa_info that has empty selector values. The kernel assumes
that these selector values are valid and deletes the larval SA and
inserts the new SA containing empty selectors. We need SAs with valid
selectors in the SAD in order to implement PFP support.
Should we just use the larval selectors or should we assume that
openswan will begin to send valid selectors? I asked for the openswan
dev's opinions and they referred me to Herbert Xu. It seems as though
the correct solution would be for openswan to pass valid selectors in
UPDSA messages, even if it is the larval selectors we gave them.
On a side note, Joy Latten has reported to see the same behavior while
using ipsec-tools.
Thanks!
Tyler Hicks
^ permalink raw reply
* Re: net-2.6.25 being rebased...
From: Kok, Auke @ 2007-12-11 21:31 UTC (permalink / raw)
To: joe; +Cc: David Miller, netdev
In-Reply-To: <20071211.130858.134618588.davem@davemloft.net>
David Miller wrote:
> From: Joe Perches <joe@perches.com>
> Date: Tue, 11 Dec 2007 13:04:59 -0800
>
>> On Tue, 2007-12-11 at 11:56 -0800, David Miller wrote:
>>> The rebase of net-2.6.25 is complete
>> I have an earlier unmodified git repository of net-2.6.25.
>> Does anyone know the appropriate git commands to resync
>> to the rebased content?
>>
>> $ git branch
>> * master
>> $ git-pull
>> [...]
>> Automatic merge failed; fix conflicts and then commit the result.
>
> Easiest thing to do is do a quick local clone of Linus's current tree
> (you do have one of these around right? :-) and then pull in from the
> rebased tree.
>
> bash$ git clone linux-2.6/.git net-2.6.25
> bash$ git pull git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25.git
I often have success without recloning by doing:
$ git-reset --hard v2.6.23
$ git pull git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25.git
saves you the time to reclone. As long as you reset below the rebase point, this
should be OK.
Auke
^ permalink raw reply
* Re: [Bugme-new] [Bug 9545] New: Cannot bring up a bridge interface without a MAC address set
From: Andrew Morton @ 2007-12-11 21:26 UTC (permalink / raw)
To: netdev
Cc: bugme-daemon, Stephen Hemminger, berrange, Jeff Garzik,
Herbert Xu, Rafael J. Wysocki
In-Reply-To: <bug-9545-10286@http.bugzilla.kernel.org/>
(please respond via emailed reply-to-all, not via the bugzilla web
interface).
On Tue, 11 Dec 2007 11:04:55 -0800 (PST)
bugme-daemon@bugzilla.kernel.org wrote:
> http://bugzilla.kernel.org/show_bug.cgi?id=9545
>
> Summary: Cannot bring up a bridge interface without a MAC address
> set
> Product: Networking
> Version: 2.5
> KernelVersion: 2.6.24-0.81.rc4.git7.fc9
> Platform: All
> OS/Version: Linux
> Tree: Fedora
> Status: NEW
> Severity: normal
> Priority: P1
> Component: Other
> AssignedTo: acme@ghostprotocols.net
> ReportedBy: berrange@redhat.com
>
>
> Most recent kernel where this bug did not occur: Any 2.6.23 or earlier
> Distribution: Fedora 9 rawhide
> Hardware Environment: Intel(R) Core(TM)2 Duo CPU E6850, x86_64
> Software Environment: 2.6.24-0.81.rc4.git7.fc9 #1 SMP x86_64 GNU/Linux
> Problem Description:
> It is not possible to bring up a bridge interface unless one first assigns a
> MAC address to it. This is a regression from earlier kernels where one could
> always bring up a bridge device immediately after creating it. The bridge
> should not require a MAC address because it is not going to be configured with
> any IP addr - in my scenario I merely wish to use it to connect a number of
> 'tap' devices associated with KVM guests.
>
> Steps to reproduce:
> # brctl addbr demobr
> # ifconfig demobr up
> SIOCSIFFLAGS: Invalid argument
>
> It is failing on the ioctl to bring up the interface
>
> ioctl(4, SIOCGIFFLAGS, {ifr_name="demobr",
> ifr_flags=IFF_BROADCAST|IFF_MULTICAST}) = 0
> ioctl(4, SIOCSIFFLAGS, 0x7fff38a6f180) = -1 EINVAL (Invalid argument)
>
>
> The following Fedora kernel BZ has the original problem report:
>
> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=390991
>
> The problem appears to have been introduced by this patch:
>
> Commit bada339ba24dee9e143bfb42e1dc61f146619846
> Author: Jeff Garzik <jgarzik@redhat.com>
> Date: Tue Oct 23 20:19:37 2007 -0700
>
> [NET]: Validate device addr prior to interface-up
>
> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 8726589..f861555 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1007,17 +1007,20 @@ int dev_open(struct net_device *dev)
> * Call device private open method
> */
> set_bit(__LINK_STATE_START, &dev->state);
> - if (dev->open) {
> +
> + if (dev->validate_addr)
> + ret = dev->validate_addr(dev);
>
>
>
> Which rejects MAC addresses with all 0s
>
> Herbert Xu tells me...
>
> "This is clearly a bug in the upstream bridge device. It should override the
> default address validator so that when there are no devices attached that a
> zero MAC address is allowed."
>
Rafael, another for the regression list please.
^ permalink raw reply
* Re: 2.6.24-rc4-mm1
From: Kok, Auke @ 2007-12-11 21:26 UTC (permalink / raw)
To: Andrew Morton
Cc: Martin Bligh, linux-kernel, Andy Whitcroft, netdev,
Thomas Gleixner, Ingo Molnar
In-Reply-To: <20071211123705.844aac24.akpm@linux-foundation.org>
Andrew Morton wrote:
> On Tue, 11 Dec 2007 08:13:52 -0800 "Martin Bligh" <mbligh@google.com> wrote:
>
>>>
>>> - Lots of device IDs have been removed from the e1000 driver and moved
>>> over
>>> to e1000e. So if your e1000 stops working, you forgot to set
>>> CONFIG_E1000E.
>>>
>>>
>> Wouldn't it make sense to just default this to on if E1000 was on, rather
>> than screwing
>> everybody for no good reason (plus breaking all the automated testing, etc
>> etc)?
>> Much though I love random refactoring, it is fairly painful to just keep
>> changing the
>> names of things.
>
> (cc netdev and Auke)
>
> Yes, that would be very sensible. CONFIG_E1000E should default to whatever
> CONFIG_E1000 was set to.
which is "y" for x86 and friends, ppc, arm and ia64 through 'defconfig'. the
Kconfig files do not have defaults in them.
I can send a patch to adjust the defconfig files, would that be OK? I certainly
think that would be reasonable, I dislike setting defaults through defconfig for
network drivers myself and rather would not do that.
Auke
^ permalink raw reply
* Re: net-2.6.25 being rebased...
From: Joe Perches @ 2007-12-11 21:23 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: David Miller, netdev
In-Reply-To: <20071211210911.GJ24046@ghostprotocols.net>
On Tue, 2007-12-11 at 19:09 -0200, Arnaldo Carvalho de Melo wrote:
> git-clone --reference linux-2.6 git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25
That works well. Just ~3MB in objects downloaded. Thanks.
^ permalink raw reply
* Re: 2.6.24-rc4-mm1
From: Ingo Molnar @ 2007-12-11 21:20 UTC (permalink / raw)
To: Andrew Morton
Cc: Martin Bligh, linux-kernel, Andy Whitcroft, netdev, Auke Kok,
Thomas Gleixner, Roland McGrath
In-Reply-To: <20071211123705.844aac24.akpm@linux-foundation.org>
* Andrew Morton <akpm@linux-foundation.org> wrote:
> > I can't see this compile failure posted anywhere:
> > http://test.kernel.org/results/IBM/126049/build/debug/stderr
> >
> > arch/x86/vdso/vdso32/sigreturn.S: Assembler messages:
> > arch/x86/vdso/vdso32/sigreturn.S:23: Error: suffix or operands invalid for `pop'
> > arch/x86/vdso/vdso32/syscall.S:25: Error: suffix or operands invalid for `pop'
> > make[1]: *** [arch/x86/vdso/vdso32/syscall.o] Error 1
> > make: *** [arch/x86/vdso] Error 2
>
> (cc Ingo and Thomas)
Roland says:
| That seems like it must be a tool problem. The V=1 output would show
| if those compiles missed -m32 or something. But even in the wrong
| mode, this error does not make sense. The assembly code it's citing
| is identical to the old arch/x86/ia32/vsyscall-syscall.S code.
Ingo
^ permalink raw reply
* Re: net-2.6.25 being rebased...
From: Arnaldo Carvalho de Melo @ 2007-12-11 21:09 UTC (permalink / raw)
To: Joe Perches; +Cc: David Miller, netdev
In-Reply-To: <1197407100.4911.150.camel@localhost>
Em Tue, Dec 11, 2007 at 01:04:59PM -0800, Joe Perches escreveu:
> On Tue, 2007-12-11 at 11:56 -0800, David Miller wrote:
> > The rebase of net-2.6.25 is complete
>
> I have an earlier unmodified git repository of net-2.6.25.
> Does anyone know the appropriate git commands to resync
> to the rebased content?
>
> $ git branch
> * master
> $ git-pull
> [...]
> Automatic merge failed; fix conflicts and then commit the result.
rm -rf net-2.6.25
git-clone --reference linux-2.6 git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25
Assuming you have linux-2.6 cloned from Linus.
Dave may have removed patches, combined some, whatever, so I just do the
above procedure when I don't have any pending csets on my local
net-2.6.25 tree.
- Arnaldo
^ permalink raw reply
* Re: net-2.6.25 being rebased...
From: David Miller @ 2007-12-11 21:08 UTC (permalink / raw)
To: joe; +Cc: netdev
In-Reply-To: <1197407100.4911.150.camel@localhost>
From: Joe Perches <joe@perches.com>
Date: Tue, 11 Dec 2007 13:04:59 -0800
> On Tue, 2007-12-11 at 11:56 -0800, David Miller wrote:
> > The rebase of net-2.6.25 is complete
>
> I have an earlier unmodified git repository of net-2.6.25.
> Does anyone know the appropriate git commands to resync
> to the rebased content?
>
> $ git branch
> * master
> $ git-pull
> [...]
> Automatic merge failed; fix conflicts and then commit the result.
Easiest thing to do is do a quick local clone of Linus's current tree
(you do have one of these around right? :-) and then pull in from the
rebased tree.
bash$ git clone linux-2.6/.git net-2.6.25
bash$ git pull git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25.git
^ permalink raw reply
* Re: net-2.6.25 being rebased...
From: Joe Perches @ 2007-12-11 21:04 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20071211.115619.199600421.davem@davemloft.net>
On Tue, 2007-12-11 at 11:56 -0800, David Miller wrote:
> The rebase of net-2.6.25 is complete
I have an earlier unmodified git repository of net-2.6.25.
Does anyone know the appropriate git commands to resync
to the rebased content?
$ git branch
* master
$ git-pull
[...]
Automatic merge failed; fix conflicts and then commit the result.
^ permalink raw reply
* Re: 2.6.24-rc4-mm1
From: Andrew Morton @ 2007-12-11 20:37 UTC (permalink / raw)
To: Martin Bligh
Cc: linux-kernel, Andy Whitcroft, netdev, Auke Kok, Thomas Gleixner,
Ingo Molnar
In-Reply-To: <33307c790712110813h23def95dvd068b7226e9fcd36@mail.gmail.com>
On Tue, 11 Dec 2007 08:13:52 -0800 "Martin Bligh" <mbligh@google.com> wrote:
> >
> >
> > - Lots of device IDs have been removed from the e1000 driver and moved
> > over
> > to e1000e. So if your e1000 stops working, you forgot to set
> > CONFIG_E1000E.
> >
> >
> Wouldn't it make sense to just default this to on if E1000 was on, rather
> than screwing
> everybody for no good reason (plus breaking all the automated testing, etc
> etc)?
> Much though I love random refactoring, it is fairly painful to just keep
> changing the
> names of things.
(cc netdev and Auke)
Yes, that would be very sensible. CONFIG_E1000E should default to whatever
CONFIG_E1000 was set to.
>
> I can't see this compile failure posted anywhere:
> http://test.kernel.org/results/IBM/126049/build/debug/stderr
>
> arch/x86/vdso/vdso32/sigreturn.S: Assembler messages:
> arch/x86/vdso/vdso32/sigreturn.S:23: Error: suffix or operands invalid for `pop'
> arch/x86/vdso/vdso32/syscall.S:25: Error: suffix or operands invalid for `pop'
> make[1]: *** [arch/x86/vdso/vdso32/syscall.o] Error 1
> make: *** [arch/x86/vdso] Error 2
(cc Ingo and Thomas)
>
> Nor this one:
> http://test.kernel.org/results/IBM/126096/build/debug/stderr
>
> drivers/char/hvcs.c: In function ‘hvcs_open’:
> drivers/char/hvcs.c:1180: error: wrong type argument to unary exclamation mark
>
(cc Greg)
Caused by gregkh-driver-kobject-convert-hvcs-to-use-kref-not-kobject.patch.
^ permalink raw reply
* Re: DM9000_IRQ_FLAGS
From: Remy Bohmer @ 2007-12-11 20:31 UTC (permalink / raw)
To: Daniel Mack; +Cc: netdev
In-Reply-To: <20071211191823.GD15295@buzzloop.caiaq.de>
Hello Daniel,
This controller is also used on many other boards, like the e.g. Atmel
AT91sam9261-ek board. On that board on both the rising _and_ falling
edge an interrupt is generated.
I can test tomorrow if this patch leaves this board in tact, but
should the board-specific code not add this flag if it is required ?
By modifying this driver you will interfere the behavior of other
boards, and I do not know if there any level triggered types used.
Kind Regards,
Remy Bohmer
2007/12/11, Daniel Mack <daniel@caiaq.de>:
> Hi,
>
> on Toradex' Colibri, a PXA270 based board with a DM9000 ethernet
> controller, this driver won't work due to unsuitable DM9000_IRQ_FLAGS.
> If I understood the code behind request_irq() correctly, it's not
> recommended to register an IRQ without any of the IRQT_* flags set.
>
> Is there any concerns about applying the patch below?
>
> Best regards,
> Daniel
>
> diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
> index 3286d2a..6a20a54 100644
> --- a/drivers/net/dm9000.c
> +++ b/drivers/net/dm9000.c
> @@ -66,6 +66,7 @@
> #include <linux/dm9000.h>
> #include <linux/delay.h>
> #include <linux/platform_device.h>
> +#include <linux/irq.h>
>
> #include <asm/delay.h>
> #include <asm/irq.h>
> @@ -113,7 +114,7 @@
> #define writesl outsl
> #define DM9000_IRQ_FLAGS (IRQF_SHARED | IRQF_TRIGGER_HIGH)
> #else
> -#define DM9000_IRQ_FLAGS IRQF_SHARED
> +#define DM9000_IRQ_FLAGS (IRQF_SHARED | IRQT_RISING)
> #endif
>
> /*
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [Bugme-new] [Bug 9543] New: RTNL: assertion failed at net/ipv6/addrconf.c (2164)/RTNL: assertion failed at net/ipv4/devinet.c (1055)
From: Andrew Morton @ 2007-12-11 20:30 UTC (permalink / raw)
To: Krzysztof Oledzki
Cc: bugme-daemon, Stephen Hemminger, David S. Miller, netdev,
Rafael J. Wysocki
In-Reply-To: <Pine.LNX.4.64.0712111603250.21312@bizon.gios.gov.pl>
On Tue, 11 Dec 2007 16:04:27 +0100 (CET) Krzysztof Oledzki <olel@ans.pl> wrote:
> >> [<783bfa72>] rt_run_flush+0x43/0x8b
> >> [<783bfa93>] rt_run_flush+0x64/0x8b
> >> [<7813ac54>] notifier_call_chain+0x2a/0x52
> >> [<7813ac9e>] raw_notifier_call_chain+0x17/0x1a
> >> [<783a3471>] netdev_state_change+0x18/0x29
> >> [<783ac6a9>] __linkwatch_run_queue+0x150/0x17e
> >> [<783ac6f4>] linkwatch_event+0x1d/0x22
> >> [<78133cdf>] run_workqueue+0xdb/0x1b6
> >> [<78133c8b>] run_workqueue+0x87/0x1b6
> >> [<783ac6d7>] linkwatch_event+0x0/0x22
> >> [<781346ff>] worker_thread+0x0/0x85
> >> [<78134778>] worker_thread+0x79/0x85
> >> [<781371ad>] autoremove_wake_function+0x0/0x35
> >> [<781370f6>] kthread+0x38/0x5e
> >> [<781370be>] kthread+0x0/0x5e
> >> [<78104baf>] kernel_thread_helper+0x7/0x10
> >> =======================
> >> RTNL: assertion failed at net/ipv6/addrconf.c (1610)
> >
> >
> > Hopefully this is due to the bug you reported in bug #9542.
> >
> > Does this patch fix both issues?
>
> Unfortunately not. I just updated bugzilla.
argh. Please conduct these discussions via emailed reply-to-all, not via
the bugzilla web interface.
I think my patch _did_ fix http://bugzilla.kernel.org/show_bug.cgi?id=9542
But then you hit a new bonding locking bug.
Rafael, please track 9542 and 9543 as post-2.6.23 regressions, thanks.
^ permalink raw reply
* Re: net-2.6.25 being rebased...
From: David Miller @ 2007-12-11 19:56 UTC (permalink / raw)
To: netdev
In-Reply-To: <20071211.092638.148402625.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Tue, 11 Dec 2007 09:26:38 -0800 (PST)
> I want to work out all the conflicts now that Linus has pulled
> in my most recent batch of fixes.
>
> I hope to have it done in the next hour or so.
The rebase of net-2.6.25 is complete, sorry for taking
so long.
^ permalink raw reply
* [PATCH] enable SMC911X for ARCH_MX3
From: Daniel Mack @ 2007-12-11 19:12 UTC (permalink / raw)
To: netdev
[-- Attachment #1: Type: text/plain, Size: 119 bytes --]
Hi,
this patch enables SMX911X support for Freescale's MX3 platforms.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
[-- Attachment #2: smc911x-mx3.diff --]
[-- Type: text/x-diff, Size: 1002 bytes --]
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6cde4ed..1011735 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -926,7 +926,7 @@ config SMC911X
tristate "SMSC LAN911[5678] support"
select CRC32
select MII
- depends on ARCH_PXA || SH_MAGIC_PANEL_R2
+ depends on ARCH_PXA || ARCH_MX3 || SH_MAGIC_PANEL_R2
help
This is a driver for SMSC's LAN911x series of Ethernet chipsets
including the new LAN9115, LAN9116, LAN9117, and LAN9118.
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index d04e4fa..2278408 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -37,6 +37,11 @@
#define SMC_USE_16BIT 0
#define SMC_USE_32BIT 1
#define SMC_IRQ_SENSE IRQF_TRIGGER_FALLING
+#elif defined(CONFIG_ARCH_MX3)
+ #define SMC_USE_PXA_DMA 0
+ #define SMC_USE_16BIT 0
+ #define SMC_USE_32BIT 1
+ #define SMC_IRQ_SENSE IRQF_TRIGGER_FALLING
#elif defined(CONFIG_SH_MAGIC_PANEL_R2)
#define SMC_USE_SH_DMA 0
#define SMC_USE_16BIT 0
^ permalink raw reply related
* DM9000_IRQ_FLAGS
From: Daniel Mack @ 2007-12-11 19:18 UTC (permalink / raw)
To: netdev
Hi,
on Toradex' Colibri, a PXA270 based board with a DM9000 ethernet
controller, this driver won't work due to unsuitable DM9000_IRQ_FLAGS.
If I understood the code behind request_irq() correctly, it's not
recommended to register an IRQ without any of the IRQT_* flags set.
Is there any concerns about applying the patch below?
Best regards,
Daniel
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 3286d2a..6a20a54 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -66,6 +66,7 @@
#include <linux/dm9000.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
+#include <linux/irq.h>
#include <asm/delay.h>
#include <asm/irq.h>
@@ -113,7 +114,7 @@
#define writesl outsl
#define DM9000_IRQ_FLAGS (IRQF_SHARED | IRQF_TRIGGER_HIGH)
#else
-#define DM9000_IRQ_FLAGS IRQF_SHARED
+#define DM9000_IRQ_FLAGS (IRQF_SHARED | IRQT_RISING)
#endif
/*
^ permalink raw reply related
* Problem with cxgb, mac-vlans, and UDP checksum offloading.
From: Ben Greear @ 2007-12-11 18:25 UTC (permalink / raw)
To: Divy Le Ray, NetDev
Hello!
This is with kernel 2.6.23, plus our hacks, but the mac-vlan logic
is part of the official kernel now. OS is Fedora 8. I have applied
patch 1 and 3 of those sent a few weeks ago for the cxgb as well.
While testing NFS on mac-vlans on cxgb, we noticed that
UDP packets have incorrect checksums when sent from
the mac-vlan device on a cxgb interface to another system. When sending
from a regular ethernet device (cxgb), it works fine.
When we disable rx and tx UDP checksums on the mac-vlan
device, it works fine. When we use e1000 interfaces (which
also do rx/tx UDP checksumming), mac-vlans & NFS works fine
with mac-vlan rx/tx checksumming on (the default value).
So, there seems something weird about the cxgb NIC when
used with mac-vlans. Perhaps it is somehow paying attention
to MAC addresses when it determines if it should csum a packet
or not?
If you want to test it yourself, grab the latest iputils package
and create MAC-VLANs like this:
ip link add link eth0 name eth0#0 address 00:11:22:33:44:55 type macvlan
If you would like a packet trace or any other debugging, please
let me know.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [PATCH] IPv6 support for NFS server
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-12-11 18:19 UTC (permalink / raw)
To: aurelien.charbon; +Cc: brian.haley, neilb, bfields, netdev, nfsv4, yoshfuji
In-Reply-To: <475ED028.2010109@ext.bull.net>
In article <475ED028.2010109@ext.bull.net> (at Tue, 11 Dec 2007 19:00:08 +0100), Aurélien Charbon <aurelien.charbon@ext.bull.net> says:
> --- linux-2.6.24-rc4/include/net/ipv6.h 2007-12-10 16:11:38.000000000 +0100
> +++ linux-2.6.24-rc4-IPv6-cache-based/include/net/ipv6.h 2007-12-11 17:52:39.000000000 +0100
> @@ -400,6 +400,15 @@ static inline int ipv6_addr_v4mapped(con
> a->s6_addr32[2] == htonl(0x0000ffff));
> }
>
> +static inline void ipv6_addr_set_v4mapped(const __be32 addr,
> + struct in6_addr *v4mapped)
> +{
> + ipv6_addr_set(v4mapped,
> + 0, 0,
> + __constant_htonl(0x0000FFFF),
> + addr);
> +}
> +
> /*
> * find the first different bit between two addresses
> * length of address must be a multiple of 32bits
Use htonl() here, not __constant_htonl().
--yoshfuji
^ permalink raw reply
* [PATCH net-2.6.25 7/7] Switch users of ipv4_devconf(_all) to use the pernet one
From: Pavel Emelyanov @ 2007-12-11 18:02 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, Linux Containers, devel
In-Reply-To: <475ECC69.1040809@openvz.org>
These are scattered over the code, but almost all the
"critical" places already have the proper struct net
at hand except for snmp proc showing function and routing
rtnl handler.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 962a062..b3c5081 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -44,7 +44,8 @@ struct in_device
};
#define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1])
-#define IPV4_DEVCONF_ALL(attr) IPV4_DEVCONF(ipv4_devconf, attr)
+#define IPV4_DEVCONF_ALL(net, attr) \
+ IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr)
static inline int ipv4_devconf_get(struct in_device *in_dev, int index)
{
@@ -71,11 +72,14 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))
#define IN_DEV_ANDCONF(in_dev, attr) \
- (IPV4_DEVCONF_ALL(attr) && IN_DEV_CONF_GET((in_dev), attr))
+ (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \
+ IN_DEV_CONF_GET((in_dev), attr))
#define IN_DEV_ORCONF(in_dev, attr) \
- (IPV4_DEVCONF_ALL(attr) || IN_DEV_CONF_GET((in_dev), attr))
+ (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \
+ IN_DEV_CONF_GET((in_dev), attr))
#define IN_DEV_MAXCONF(in_dev, attr) \
- (max(IPV4_DEVCONF_ALL(attr), IN_DEV_CONF_GET((in_dev), attr)))
+ (max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \
+ IN_DEV_CONF_GET((in_dev), attr)))
#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
#define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 41a4d73..cd4c95a 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -861,7 +861,7 @@ static int arp_process(struct sk_buff *skb)
n = __neigh_lookup(&arp_tbl, &sip, dev, 0);
- if (IPV4_DEVCONF_ALL(ARP_ACCEPT)) {
+ if (IPV4_DEVCONF_ALL(dev->nd_net, ARP_ACCEPT)) {
/* Unsolicited ARP is not accepted by default.
It is possible, that this option should be enabled for some
devices (strip is candidate)
@@ -956,7 +956,7 @@ out_of_mem:
static int arp_req_set_proxy(struct net *net, struct net_device *dev, int on)
{
if (dev == NULL) {
- IPV4_DEVCONF_ALL(PROXY_ARP) = on;
+ IPV4_DEVCONF_ALL(net, PROXY_ARP) = on;
return 0;
}
if (__in_dev_get_rtnl(dev)) {
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cd957f4..e94de54 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1259,9 +1259,9 @@ static void devinet_copy_dflt_conf(struct net *net, int i)
static void inet_forward_change(struct net *net)
{
struct net_device *dev;
- int on = IPV4_DEVCONF_ALL(FORWARDING);
+ int on = IPV4_DEVCONF_ALL(net, FORWARDING);
- IPV4_DEVCONF_ALL(ACCEPT_REDIRECTS) = !on;
+ IPV4_DEVCONF_ALL(net, ACCEPT_REDIRECTS) = !on;
IPV4_DEVCONF_DFLT(net, FORWARDING) = on;
read_lock(&dev_base_lock);
@@ -1361,7 +1361,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
if (write && *valp != val) {
struct net *net = ctl->extra2;
- if (valp == &IPV4_DEVCONF_ALL(FORWARDING))
+ if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING))
inet_forward_change(net);
else if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING))
rt_cache_flush(0);
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index c560a93..d3d5906 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -130,12 +130,12 @@
*/
#define IGMP_V1_SEEN(in_dev) \
- (IPV4_DEVCONF_ALL(FORCE_IGMP_VERSION) == 1 || \
+ (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 1 || \
IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 1 || \
((in_dev)->mr_v1_seen && \
time_before(jiffies, (in_dev)->mr_v1_seen)))
#define IGMP_V2_SEEN(in_dev) \
- (IPV4_DEVCONF_ALL(FORCE_IGMP_VERSION) == 2 || \
+ (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 2 || \
IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 2 || \
((in_dev)->mr_v2_seen && \
time_before(jiffies, (in_dev)->mr_v2_seen)))
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 1187928..9947f52 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -849,7 +849,7 @@ static void mrtsock_destruct(struct sock *sk)
{
rtnl_lock();
if (sk == mroute_socket) {
- IPV4_DEVCONF_ALL(MC_FORWARDING)--;
+ IPV4_DEVCONF_ALL(sk->sk_net, MC_FORWARDING)--;
write_lock_bh(&mrt_lock);
mroute_socket=NULL;
@@ -898,7 +898,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt
mroute_socket=sk;
write_unlock_bh(&mrt_lock);
- IPV4_DEVCONF_ALL(MC_FORWARDING)++;
+ IPV4_DEVCONF_ALL(sk->sk_net, MC_FORWARDING)++;
}
rtnl_unlock();
return ret;
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index ce34b28..41734db 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -309,7 +309,8 @@ static int snmp_seq_show(struct seq_file *seq, void *v)
seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
seq_printf(seq, "\nIp: %d %d",
- IPV4_DEVCONF_ALL(FORWARDING) ? 1 : 2, sysctl_ip_default_ttl);
+ IPV4_DEVCONF_ALL(&init_net, FORWARDING) ? 1 : 2,
+ sysctl_ip_default_ttl);
for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
seq_printf(seq, " %lu",
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index cc064e6..499e1e3 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2615,7 +2615,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
__be32 dst = rt->rt_dst;
if (MULTICAST(dst) && !LOCAL_MCAST(dst) &&
- IPV4_DEVCONF_ALL(MC_FORWARDING)) {
+ IPV4_DEVCONF_ALL(&init_net, MC_FORWARDING)) {
int err = ipmr_get_route(skb, r, nowait);
if (err <= 0) {
if (!nowait) {
--
1.5.3.4
^ permalink raw reply related
* [PATCH net-2.6.25 6/7] Switch users of ipv4_devconf_dflt to use the pernet one
From: Pavel Emelyanov @ 2007-12-11 17:59 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, Linux Containers, devel
In-Reply-To: <475ECC69.1040809@openvz.org>
They are all collected in the net/ipv4/devinet.c file and
mostly use the IPV4_DEVCONF_DFLT macro.
So I add the net parameter to it and patch users accordingly.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 996f07e..cd957f4 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -83,7 +83,8 @@ static struct ipv4_devconf ipv4_devconf_dflt = {
},
};
-#define IPV4_DEVCONF_DFLT(attr) IPV4_DEVCONF(ipv4_devconf_dflt, attr)
+#define IPV4_DEVCONF_DFLT(net, attr) \
+ IPV4_DEVCONF((*net->ipv4.devconf_dflt), attr)
static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = {
[IFA_LOCAL] = { .type = NLA_U32 },
@@ -164,7 +165,8 @@ static struct in_device *inetdev_init(struct net_device *dev)
if (!in_dev)
goto out;
INIT_RCU_HEAD(&in_dev->rcu_head);
- memcpy(&in_dev->cnf, &ipv4_devconf_dflt, sizeof(in_dev->cnf));
+ memcpy(&in_dev->cnf, dev->nd_net->ipv4.devconf_dflt,
+ sizeof(in_dev->cnf));
in_dev->cnf.sysctl = NULL;
in_dev->dev = dev;
if ((in_dev->arp_parms = neigh_parms_alloc(dev, &arp_tbl)) == NULL)
@@ -1248,7 +1250,7 @@ static void devinet_copy_dflt_conf(struct net *net, int i)
rcu_read_lock();
in_dev = __in_dev_get_rcu(dev);
if (in_dev && !test_bit(i, in_dev->cnf.state))
- in_dev->cnf.data[i] = ipv4_devconf_dflt.data[i];
+ in_dev->cnf.data[i] = net->ipv4.devconf_dflt->data[i];
rcu_read_unlock();
}
read_unlock(&dev_base_lock);
@@ -1260,7 +1262,7 @@ static void inet_forward_change(struct net *net)
int on = IPV4_DEVCONF_ALL(FORWARDING);
IPV4_DEVCONF_ALL(ACCEPT_REDIRECTS) = !on;
- IPV4_DEVCONF_DFLT(FORWARDING) = on;
+ IPV4_DEVCONF_DFLT(net, FORWARDING) = on;
read_lock(&dev_base_lock);
for_each_netdev(net, dev) {
@@ -1289,7 +1291,7 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
set_bit(i, cnf->state);
- if (cnf == &ipv4_devconf_dflt)
+ if (cnf == net->ipv4.devconf_dflt)
devinet_copy_dflt_conf(net, i);
}
@@ -1342,7 +1344,7 @@ static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen,
set_bit(i, cnf->state);
- if (cnf == &ipv4_devconf_dflt)
+ if (cnf == net->ipv4.devconf_dflt)
devinet_copy_dflt_conf(net, i);
return 1;
@@ -1361,7 +1363,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
if (valp == &IPV4_DEVCONF_ALL(FORWARDING))
inet_forward_change(net);
- else if (valp != &IPV4_DEVCONF_DFLT(FORWARDING))
+ else if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING))
rt_cache_flush(0);
}
--
1.5.3.4
^ permalink raw reply related
* [PATCH net-2.6.25 5/7] Move the devinet pointers on the struct net
From: Pavel Emelyanov @ 2007-12-11 17:57 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, Linux Containers, devel
In-Reply-To: <475ECC69.1040809@openvz.org>
This is the core.
Add all and default pointers on the netns_ipv4 and register
a new pernet subsys to initialize them.
Also add the ctl_table_header to register the
net.ipv4.ip_forward ctl.
I don't allocate additional memory for init_net, but use
global devinets.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index ce830d5..e06d7cf 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -4,6 +4,12 @@
#ifndef __NETNS_IPV4_H__
#define __NETNS_IPV4_H__
+struct ctl_table_header;
+struct ipv4_devconf;
+
struct netns_ipv4 {
+ struct ctl_table_header *forw_hdr;
+ struct ipv4_devconf *devconf_all;
+ struct ipv4_devconf *devconf_dflt;
};
#endif
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index bfb0fb0..996f07e 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -62,6 +62,7 @@
#include <net/route.h>
#include <net/ip_fib.h>
#include <net/rtnetlink.h>
+#include <net/net_namespace.h>
struct ipv4_devconf ipv4_devconf = {
.data = {
@@ -1498,7 +1499,7 @@ static int __devinet_sysctl_register(struct net *net, char *dev_name,
devinet_ctl_path[DEVINET_CTL_PATH_DEV].procname = t->dev_name;
devinet_ctl_path[DEVINET_CTL_PATH_DEV].ctl_name = ctl_name;
- t->sysctl_header = register_sysctl_paths(devinet_ctl_path,
+ t->sysctl_header = register_net_sysctl_table(net, devinet_ctl_path,
t->devinet_vars);
if (!t->sysctl_header)
goto free_procname;
@@ -1558,27 +1559,113 @@ static struct ctl_table ctl_forward_entry[] = {
{ },
};
-static __initdata struct ctl_path net_ipv4_path[] = {
+static __net_initdata struct ctl_path net_ipv4_path[] = {
{ .procname = "net", .ctl_name = CTL_NET, },
{ .procname = "ipv4", .ctl_name = NET_IPV4, },
{ },
};
+static __net_init int devinet_init_net(struct net *net)
+{
+ int err;
+ struct ctl_table *tbl;
+ struct ipv4_devconf *all, *dflt;
+ struct ctl_table_header *forw_hdr;
+
+ err = -ENOMEM;
+ all = &ipv4_devconf;
+ dflt = &ipv4_devconf_dflt;
+ tbl = ctl_forward_entry;
+
+ if (net != &init_net) {
+ all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
+ if (all == NULL)
+ goto err_alloc_all;
+
+ dflt = kmemdup(dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL);
+ if (dflt == NULL)
+ goto err_alloc_dflt;
+
+ tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL);
+ if (tbl == NULL)
+ goto err_alloc_ctl;
+
+ tbl[0].data = &all->data[NET_IPV4_CONF_FORWARDING - 1];
+ tbl[0].extra1 = all;
+ tbl[0].extra2 = net;
+ }
+
+#ifdef CONFIG_SYSCTL
+ err = __devinet_sysctl_register(net, "all",
+ NET_PROTO_CONF_ALL, all);
+ if (err < 0)
+ goto err_reg_all;
+
+ err = __devinet_sysctl_register(net, "default",
+ NET_PROTO_CONF_DEFAULT, dflt);
+ if (err < 0)
+ goto err_reg_dflt;
+
+ err = -ENOMEM;
+ forw_hdr = register_net_sysctl_table(net, net_ipv4_path, tbl);
+ if (forw_hdr == NULL)
+ goto err_reg_ctl;
+#endif
+
+ net->ipv4.forw_hdr = forw_hdr;
+ net->ipv4.devconf_all = all;
+ net->ipv4.devconf_dflt = dflt;
+ return 0;
+
+#ifdef CONFIG_SYSCTL
+err_reg_ctl:
+ __devinet_sysctl_unregister(dflt);
+err_reg_dflt:
+ __devinet_sysctl_unregister(all);
+err_reg_all:
+ if (tbl != ctl_forward_entry)
+ kfree(tbl);
+#endif
+err_alloc_ctl:
+ if (dflt != &ipv4_devconf_dflt)
+ kfree(dflt);
+err_alloc_dflt:
+ if (all != &ipv4_devconf)
+ kfree(all);
+err_alloc_all:
+ return err;
+}
+
+static __net_exit void devinet_exit_net(struct net *net)
+{
+ struct ctl_table *tbl;
+
+ tbl = net->ipv4.forw_hdr->ctl_table_arg;
+#ifdef CONFIG_SYSCTL
+ unregister_net_sysctl_table(net->ipv4.forw_hdr);
+ __devinet_sysctl_unregister(net->ipv4.devconf_dflt);
+ __devinet_sysctl_unregister(net->ipv4.devconf_all);
+#endif
+ kfree(tbl);
+ kfree(net->ipv4.devconf_dflt);
+ kfree(net->ipv4.devconf_all);
+}
+
+static __net_initdata struct pernet_operations devinet_ops = {
+ .init = devinet_init_net,
+ .exit = devinet_exit_net,
+};
+
void __init devinet_init(void)
{
+ register_pernet_subsys(&devinet_ops);
+
register_gifconf(PF_INET, inet_gifconf);
register_netdevice_notifier(&ip_netdev_notifier);
rtnl_register(PF_INET, RTM_NEWADDR, inet_rtm_newaddr, NULL);
rtnl_register(PF_INET, RTM_DELADDR, inet_rtm_deladdr, NULL);
rtnl_register(PF_INET, RTM_GETADDR, NULL, inet_dump_ifaddr);
-#ifdef CONFIG_SYSCTL
- __devinet_sysctl_register(&init_net, "all", NET_PROTO_CONF_ALL,
- &ipv4_devconf);
- __devinet_sysctl_register(&init_net, "default", NET_PROTO_CONF_DEFAULT,
- &ipv4_devconf_dflt);
- register_sysctl_paths(net_ipv4_path, ctl_forward_entry);
-#endif
}
EXPORT_SYMBOL(in_dev_finish_destroy);
--
1.5.3.4
^ permalink raw reply related
* Re: [PATCH] IPv6 support for NFS server
From: Aurélien Charbon @ 2007-12-11 18:00 UTC (permalink / raw)
To: Brian Haley; +Cc: Neil Brown, J. Bruce Fields, netdev ML, Mailing list NFSv4
In-Reply-To: <475EBDB4.5020108@hp.com>
[-- Attachment #1: Type: text/plain, Size: 638 bytes --]
Brian Haley wrote:
> In an email back on October 29th I sent-out a similar patch with a new
> ipv6_addr_set_v4mapped() inline - it might be useful to pull that
> piece into your patch since it cleans it up a bit to get rid of the
> ipv6_addr_set() calls. I can re-send you that patch off-line if you
> can't find it.
>
> -Brian
>
>
Thanks Brian. I forgot to include your changes in my tree.
OK Bruce you can take this one.
Aurélien
--
********************************
Aurelien Charbon
Linux NFSv4 team
Bull SAS
Echirolles - France
http://nfsv4.bullopensource.org/
********************************
[-- Attachment #2: linux-2.6.24-rc4-IPv6-cache-based.diff --]
[-- Type: text/x-patch, Size: 12348 bytes --]
diff -p -u -r -N linux-2.6.24-rc4/fs/nfsd/export.c linux-2.6.24-rc4-IPv6-cache-based/fs/nfsd/export.c
--- linux-2.6.24-rc4/fs/nfsd/export.c 2007-12-10 16:11:37.000000000 +0100
+++ linux-2.6.24-rc4-IPv6-cache-based/fs/nfsd/export.c 2007-12-11 17:49:51.000000000 +0100
@@ -35,6 +35,7 @@
#include <linux/lockd/bind.h>
#include <linux/sunrpc/msg_prot.h>
#include <linux/sunrpc/gss_api.h>
+#include <net/ipv6.h>
#define NFSDDBG_FACILITY NFSDDBG_EXPORT
@@ -1556,6 +1557,7 @@ exp_addclient(struct nfsctl_client *ncp)
{
struct auth_domain *dom;
int i, err;
+ struct in6_addr addr6;
/* First, consistency check. */
err = -EINVAL;
@@ -1574,9 +1576,11 @@ exp_addclient(struct nfsctl_client *ncp)
goto out_unlock;
/* Insert client into hashtable. */
- for (i = 0; i < ncp->cl_naddr; i++)
- auth_unix_add_addr(ncp->cl_addrlist[i], dom);
-
+ for (i = 0; i < ncp->cl_naddr; i++) {
+ /* Mapping address */
+ ipv6_addr_set_v4mapped(ncp->cl_addrlist[i].s_addr, &addr6);
+ auth_unix_add_addr(&addr6, dom);
+ }
auth_unix_forget_old(dom);
auth_domain_put(dom);
diff -p -u -r -N linux-2.6.24-rc4/fs/nfsd/nfsctl.c linux-2.6.24-rc4-IPv6-cache-based/fs/nfsd/nfsctl.c
--- linux-2.6.24-rc4/fs/nfsd/nfsctl.c 2007-12-10 16:11:37.000000000 +0100
+++ linux-2.6.24-rc4-IPv6-cache-based/fs/nfsd/nfsctl.c 2007-12-11 18:27:24.000000000 +0100
@@ -37,6 +37,7 @@
#include <linux/nfsd/syscall.h>
#include <asm/uaccess.h>
+#include <net/ipv6.h>
/*
* We have a single directory with 9 nodes in it.
@@ -222,6 +223,7 @@ static ssize_t write_getfs(struct file *
struct auth_domain *clp;
int err = 0;
struct knfsd_fh *res;
+ struct in6_addr in6;
if (size < sizeof(*data))
return -EINVAL;
@@ -236,7 +238,14 @@ static ssize_t write_getfs(struct file *
res = (struct knfsd_fh*)buf;
exp_readlock();
- if (!(clp = auth_unix_lookup(sin->sin_addr)))
+
+ /* IPv6 address mapping */
+ ipv6_addr_set_v4mapped(
+ (((struct sockaddr_in *)&data->gd_addr)->sin_addr.s_addr),
+ &in6
+ );
+
+ if (!(clp = auth_unix_lookup(&in6)))
err = -EPERM;
else {
err = exp_rootfh(clp, data->gd_path, res, data->gd_maxlen);
@@ -257,6 +266,7 @@ static ssize_t write_getfd(struct file *
int err = 0;
struct knfsd_fh fh;
char *res;
+ struct in6_addr in6;
if (size < sizeof(*data))
return -EINVAL;
@@ -271,7 +281,13 @@ static ssize_t write_getfd(struct file *
res = buf;
sin = (struct sockaddr_in *)&data->gd_addr;
exp_readlock();
- if (!(clp = auth_unix_lookup(sin->sin_addr)))
+ /* IPv6 address mapping */
+ ipv6_addr_set_v4mapped(
+ (((struct sockaddr_in *)&data->gd_addr)->sin_addr.s_addr),
+ &in6
+ );
+
+ if (!(clp = auth_unix_lookup(&in6)))
err = -EPERM;
else {
err = exp_rootfh(clp, data->gd_path, &fh, NFS_FHSIZE);
diff -p -u -r -N linux-2.6.24-rc4/include/linux/sunrpc/svcauth.h linux-2.6.24-rc4-IPv6-cache-based/include/linux/sunrpc/svcauth.h
--- linux-2.6.24-rc4/include/linux/sunrpc/svcauth.h 2007-12-10 16:01:43.000000000 +0100
+++ linux-2.6.24-rc4-IPv6-cache-based/include/linux/sunrpc/svcauth.h 2007-12-10 17:09:34.000000000 +0100
@@ -120,10 +120,10 @@ extern void svc_auth_unregister(rpc_auth
extern struct auth_domain *unix_domain_find(char *name);
extern void auth_domain_put(struct auth_domain *item);
-extern int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom);
+extern int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom);
extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new);
extern struct auth_domain *auth_domain_find(char *name);
-extern struct auth_domain *auth_unix_lookup(struct in_addr addr);
+extern struct auth_domain *auth_unix_lookup(struct in6_addr *addr);
extern int auth_unix_forget_old(struct auth_domain *dom);
extern void svcauth_unix_purge(void);
extern void svcauth_unix_info_release(void *);
diff -p -u -r -N linux-2.6.24-rc4/include/net/ipv6.h linux-2.6.24-rc4-IPv6-cache-based/include/net/ipv6.h
--- linux-2.6.24-rc4/include/net/ipv6.h 2007-12-10 16:11:38.000000000 +0100
+++ linux-2.6.24-rc4-IPv6-cache-based/include/net/ipv6.h 2007-12-11 17:52:39.000000000 +0100
@@ -400,6 +400,15 @@ static inline int ipv6_addr_v4mapped(con
a->s6_addr32[2] == htonl(0x0000ffff));
}
+static inline void ipv6_addr_set_v4mapped(const __be32 addr,
+ struct in6_addr *v4mapped)
+{
+ ipv6_addr_set(v4mapped,
+ 0, 0,
+ __constant_htonl(0x0000FFFF),
+ addr);
+}
+
/*
* find the first different bit between two addresses
* length of address must be a multiple of 32bits
diff -p -u -r -N linux-2.6.24-rc4/net/sunrpc/svcauth_unix.c linux-2.6.24-rc4-IPv6-cache-based/net/sunrpc/svcauth_unix.c
--- linux-2.6.24-rc4/net/sunrpc/svcauth_unix.c 2007-12-10 16:01:46.000000000 +0100
+++ linux-2.6.24-rc4-IPv6-cache-based/net/sunrpc/svcauth_unix.c 2007-12-10 17:38:50.000000000 +0100
@@ -11,7 +11,8 @@
#include <linux/hash.h>
#include <linux/string.h>
#include <net/sock.h>
-
+#include <net/ipv6.h>
+#include <linux/kernel.h>
#define RPCDBG_FACILITY RPCDBG_AUTH
@@ -84,7 +85,7 @@ static void svcauth_unix_domain_release(
struct ip_map {
struct cache_head h;
char m_class[8]; /* e.g. "nfsd" */
- struct in_addr m_addr;
+ struct in6_addr m_addr;
struct unix_domain *m_client;
int m_add_change;
};
@@ -112,12 +113,19 @@ static inline int hash_ip(__be32 ip)
return (hash ^ (hash>>8)) & 0xff;
}
#endif
+static inline int hash_ip6(struct in6_addr ip)
+{
+ return (hash_ip(ip.s6_addr32[0]) ^
+ hash_ip(ip.s6_addr32[1]) ^
+ hash_ip(ip.s6_addr32[2]) ^
+ hash_ip(ip.s6_addr32[3]));
+}
static int ip_map_match(struct cache_head *corig, struct cache_head *cnew)
{
struct ip_map *orig = container_of(corig, struct ip_map, h);
struct ip_map *new = container_of(cnew, struct ip_map, h);
return strcmp(orig->m_class, new->m_class) == 0
- && orig->m_addr.s_addr == new->m_addr.s_addr;
+ && ipv6_addr_equal(&orig->m_addr, &new->m_addr);
}
static void ip_map_init(struct cache_head *cnew, struct cache_head *citem)
{
@@ -125,7 +133,7 @@ static void ip_map_init(struct cache_hea
struct ip_map *item = container_of(citem, struct ip_map, h);
strcpy(new->m_class, item->m_class);
- new->m_addr.s_addr = item->m_addr.s_addr;
+ ipv6_addr_copy(&new->m_addr, &item->m_addr);
}
static void update(struct cache_head *cnew, struct cache_head *citem)
{
@@ -149,22 +157,24 @@ static void ip_map_request(struct cache_
struct cache_head *h,
char **bpp, int *blen)
{
- char text_addr[20];
+ char text_addr[40];
struct ip_map *im = container_of(h, struct ip_map, h);
- __be32 addr = im->m_addr.s_addr;
-
- snprintf(text_addr, 20, "%u.%u.%u.%u",
- ntohl(addr) >> 24 & 0xff,
- ntohl(addr) >> 16 & 0xff,
- ntohl(addr) >> 8 & 0xff,
- ntohl(addr) >> 0 & 0xff);
+ if (ipv6_addr_v4mapped(&(im->m_addr))) {
+ snprintf(text_addr, 20, NIPQUAD_FMT,
+ ntohl(im->m_addr.s6_addr32[3]) >> 24 & 0xff,
+ ntohl(im->m_addr.s6_addr32[3]) >> 16 & 0xff,
+ ntohl(im->m_addr.s6_addr32[3]) >> 8 & 0xff,
+ ntohl(im->m_addr.s6_addr32[3]) >> 0 & 0xff);
+ } else {
+ snprintf(text_addr, 40, NIP6_FMT, NIP6(im->m_addr));
+ }
qword_add(bpp, blen, im->m_class);
qword_add(bpp, blen, text_addr);
(*bpp)[-1] = '\n';
}
-static struct ip_map *ip_map_lookup(char *class, struct in_addr addr);
+static struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr);
static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry);
static int ip_map_parse(struct cache_detail *cd,
@@ -175,10 +185,10 @@ static int ip_map_parse(struct cache_det
* for scratch: */
char *buf = mesg;
int len;
- int b1,b2,b3,b4;
+ int b1, b2, b3, b4, b5, b6, b7, b8;
char c;
char class[8];
- struct in_addr addr;
+ struct in6_addr addr;
int err;
struct ip_map *ipmp;
@@ -197,9 +207,26 @@ static int ip_map_parse(struct cache_det
len = qword_get(&mesg, buf, mlen);
if (len <= 0) return -EINVAL;
- if (sscanf(buf, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) != 4)
+ if (sscanf(buf, NIPQUAD_FMT "%c", &b1, &b2, &b3, &b4, &c) == 4) {
+ addr.s6_addr32[0] = 0;
+ addr.s6_addr32[1] = 0;
+ addr.s6_addr32[2] = htonl(0xffff);
+ addr.s6_addr32[3] =
+ htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4);
+ } else if (sscanf(buf, NIP6_FMT "%c",
+ &b1, &b2, &b3, &b4, &b5, &b6, &b7, &b8, &c) == 8) {
+ addr.s6_addr16[0] = htons(b1);
+ addr.s6_addr16[1] = htons(b2);
+ addr.s6_addr16[2] = htons(b3);
+ addr.s6_addr16[3] = htons(b4);
+ addr.s6_addr16[4] = htons(b5);
+ addr.s6_addr16[5] = htons(b6);
+ addr.s6_addr16[6] = htons(b7);
+ addr.s6_addr16[7] = htons(b8);
+ } else
return -EINVAL;
+
expiry = get_expiry(&mesg);
if (expiry ==0)
return -EINVAL;
@@ -215,10 +242,7 @@ static int ip_map_parse(struct cache_det
} else
dom = NULL;
- addr.s_addr =
- htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4);
-
- ipmp = ip_map_lookup(class,addr);
+ ipmp = ip_map_lookup(class, &addr);
if (ipmp) {
err = ip_map_update(ipmp,
container_of(dom, struct unix_domain, h),
@@ -238,7 +262,7 @@ static int ip_map_show(struct seq_file *
struct cache_head *h)
{
struct ip_map *im;
- struct in_addr addr;
+ struct in6_addr addr;
char *dom = "-no-domain-";
if (h == NULL) {
@@ -247,20 +271,24 @@ static int ip_map_show(struct seq_file *
}
im = container_of(h, struct ip_map, h);
/* class addr domain */
- addr = im->m_addr;
+ ipv6_addr_copy(&addr, &im->m_addr);
if (test_bit(CACHE_VALID, &h->flags) &&
!test_bit(CACHE_NEGATIVE, &h->flags))
dom = im->m_client->h.name;
- seq_printf(m, "%s %d.%d.%d.%d %s\n",
- im->m_class,
- ntohl(addr.s_addr) >> 24 & 0xff,
- ntohl(addr.s_addr) >> 16 & 0xff,
- ntohl(addr.s_addr) >> 8 & 0xff,
- ntohl(addr.s_addr) >> 0 & 0xff,
- dom
- );
+ if (ipv6_addr_v4mapped(&addr)) {
+ seq_printf(m, "%s" NIPQUAD_FMT "%s\n",
+ im->m_class,
+ ntohl(addr.s6_addr32[3]) >> 24 & 0xff,
+ ntohl(addr.s6_addr32[3]) >> 16 & 0xff,
+ ntohl(addr.s6_addr32[3]) >> 8 & 0xff,
+ ntohl(addr.s6_addr32[3]) >> 0 & 0xff,
+ dom);
+ } else {
+ seq_printf(m, "%s" NIP6_FMT "%s\n",
+ im->m_class, NIP6(addr), dom);
+ }
return 0;
}
@@ -280,16 +308,16 @@ struct cache_detail ip_map_cache = {
.alloc = ip_map_alloc,
};
-static struct ip_map *ip_map_lookup(char *class, struct in_addr addr)
+static struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr)
{
struct ip_map ip;
struct cache_head *ch;
strcpy(ip.m_class, class);
- ip.m_addr = addr;
+ ipv6_addr_copy(&ip.m_addr, addr);
ch = sunrpc_cache_lookup(&ip_map_cache, &ip.h,
hash_str(class, IP_HASHBITS) ^
- hash_ip(addr.s_addr));
+ hash_ip6(*addr));
if (ch)
return container_of(ch, struct ip_map, h);
@@ -318,14 +346,14 @@ static int ip_map_update(struct ip_map *
ch = sunrpc_cache_update(&ip_map_cache,
&ip.h, &ipm->h,
hash_str(ipm->m_class, IP_HASHBITS) ^
- hash_ip(ipm->m_addr.s_addr));
+ hash_ip6(ipm->m_addr));
if (!ch)
return -ENOMEM;
cache_put(ch, &ip_map_cache);
return 0;
}
-int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom)
+int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom)
{
struct unix_domain *udom;
struct ip_map *ipmp;
@@ -352,7 +380,7 @@ int auth_unix_forget_old(struct auth_dom
return 0;
}
-struct auth_domain *auth_unix_lookup(struct in_addr addr)
+struct auth_domain *auth_unix_lookup(struct in6_addr *addr)
{
struct ip_map *ipm;
struct auth_domain *rv;
@@ -641,9 +669,24 @@ static int unix_gid_find(uid_t uid, stru
int
svcauth_unix_set_client(struct svc_rqst *rqstp)
{
- struct sockaddr_in *sin = svc_addr_in(rqstp);
+ struct sockaddr_in *sin;
+ struct sockaddr_in6 *sin6, sin6_storage;
struct ip_map *ipm;
+ switch (rqstp->rq_addr.ss_family) {
+ case AF_INET:
+ sin = svc_addr_in(rqstp);
+ sin6 = &sin6_storage;
+ ipv6_addr_set(&sin6->sin6_addr, 0, 0,
+ htonl(0x0000FFFF), sin->sin_addr.s_addr);
+ break;
+ case AF_INET6:
+ sin6 = svc_addr_in6(rqstp);
+ break;
+ default:
+ BUG();
+ }
+
rqstp->rq_client = NULL;
if (rqstp->rq_proc == 0)
return SVC_OK;
@@ -651,7 +694,7 @@ svcauth_unix_set_client(struct svc_rqst
ipm = ip_map_cached_get(rqstp);
if (ipm == NULL)
ipm = ip_map_lookup(rqstp->rq_server->sv_program->pg_class,
- sin->sin_addr);
+ &sin6->sin6_addr);
if (ipm == NULL)
return SVC_DENIED;
^ permalink raw reply
* [PATCH net-2.6.25 4/7] Store the net pointer on devinet's ctl tables
From: Pavel Emelyanov @ 2007-12-11 17:53 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, Linux Containers, devel
In-Reply-To: <475ECC69.1040809@openvz.org>
Some handers and strategies of devinet sysctl tables need
to know the net to propagate the ctl change to all the
net devices.
I use the (currently unused) extra2 pointer on the tables
to get it.
Holding the reference on the struct net is not possible,
because otherwise we'll get a net->ctl_table->net circular
dependency. But since the ctl tables are unregistered during
the net destruction, this is safe to get it w/o additional
protection.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 872883e..bfb0fb0 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1237,12 +1237,12 @@ errout:
#ifdef CONFIG_SYSCTL
-static void devinet_copy_dflt_conf(int i)
+static void devinet_copy_dflt_conf(struct net *net, int i)
{
struct net_device *dev;
read_lock(&dev_base_lock);
- for_each_netdev(&init_net, dev) {
+ for_each_netdev(net, dev) {
struct in_device *in_dev;
rcu_read_lock();
in_dev = __in_dev_get_rcu(dev);
@@ -1253,7 +1253,7 @@ static void devinet_copy_dflt_conf(int i)
read_unlock(&dev_base_lock);
}
-static void inet_forward_change(void)
+static void inet_forward_change(struct net *net)
{
struct net_device *dev;
int on = IPV4_DEVCONF_ALL(FORWARDING);
@@ -1262,7 +1262,7 @@ static void inet_forward_change(void)
IPV4_DEVCONF_DFLT(FORWARDING) = on;
read_lock(&dev_base_lock);
- for_each_netdev(&init_net, dev) {
+ for_each_netdev(net, dev) {
struct in_device *in_dev;
rcu_read_lock();
in_dev = __in_dev_get_rcu(dev);
@@ -1283,12 +1283,13 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
if (write) {
struct ipv4_devconf *cnf = ctl->extra1;
+ struct net *net = ctl->extra2;
int i = (int *)ctl->data - cnf->data;
set_bit(i, cnf->state);
if (cnf == &ipv4_devconf_dflt)
- devinet_copy_dflt_conf(i);
+ devinet_copy_dflt_conf(net, i);
}
return ret;
@@ -1299,6 +1300,7 @@ static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen,
void __user *newval, size_t newlen)
{
struct ipv4_devconf *cnf;
+ struct net *net;
int *valp = table->data;
int new;
int i;
@@ -1334,12 +1336,13 @@ static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen,
*valp = new;
cnf = table->extra1;
+ net = table->extra2;
i = (int *)table->data - cnf->data;
set_bit(i, cnf->state);
if (cnf == &ipv4_devconf_dflt)
- devinet_copy_dflt_conf(i);
+ devinet_copy_dflt_conf(net, i);
return 1;
}
@@ -1353,8 +1356,10 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
if (write && *valp != val) {
+ struct net *net = ctl->extra2;
+
if (valp == &IPV4_DEVCONF_ALL(FORWARDING))
- inet_forward_change();
+ inet_forward_change(net);
else if (valp != &IPV4_DEVCONF_DFLT(FORWARDING))
rt_cache_flush(0);
}
@@ -1478,6 +1483,7 @@ static void __devinet_sysctl_register(char *dev_name, int ctl_name,
for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) {
t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf;
t->devinet_vars[i].extra1 = p;
+ t->devinet_vars[i].extra2 = net;
}
/*
@@ -1525,8 +1531,8 @@ static void devinet_sysctl_register(struct in_device *idev)
{
neigh_sysctl_register(idev->dev, idev->arp_parms, NET_IPV4,
NET_IPV4_NEIGH, "ipv4", NULL, NULL);
- __devinet_sysctl_register(idev->dev->name, idev->dev->ifindex,
- &idev->cnf);
+ __devinet_sysctl_register(idev->dev->nd_net, idev->dev->name,
+ idev->dev->ifindex, &idev->cnf);
}
static void devinet_sysctl_unregister(struct in_device *idev)
@@ -1547,6 +1553,7 @@ static struct ctl_table ctl_forward_entry[] = {
.proc_handler = devinet_sysctl_forward,
.strategy = devinet_conf_sysctl,
.extra1 = &ipv4_devconf,
+ .extra2 = &init_net,
},
{ },
};
@@ -1566,9 +1573,9 @@ void __init devinet_init(void)
rtnl_register(PF_INET, RTM_DELADDR, inet_rtm_deladdr, NULL);
rtnl_register(PF_INET, RTM_GETADDR, NULL, inet_dump_ifaddr);
#ifdef CONFIG_SYSCTL
- __devinet_sysctl_register("all", NET_PROTO_CONF_ALL,
+ __devinet_sysctl_register(&init_net, "all", NET_PROTO_CONF_ALL,
&ipv4_devconf);
- __devinet_sysctl_register("default", NET_PROTO_CONF_DEFAULT,
+ __devinet_sysctl_register(&init_net, "default", NET_PROTO_CONF_DEFAULT,
&ipv4_devconf_dflt);
register_sysctl_paths(net_ipv4_path, ctl_forward_entry);
#endif
--
1.5.3.4
^ permalink raw reply related
* [PATCH net-2.6.25 3/7] Pass the net pointer to the arp_req_set_proxy()
From: Pavel Emelyanov @ 2007-12-11 17:50 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, Linux Containers, devel
In-Reply-To: <475ECC69.1040809@openvz.org>
This one will need to set the IPV4_DEVCONF_ALL(PROXY_ARP), but
there's no ways to get the net right in place, so we have to
pull one from the inet_ioctl's struct sock.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/include/net/arp.h b/include/net/arp.h
index f026645..36482bf 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -11,7 +11,7 @@ extern struct neigh_table arp_tbl;
extern void arp_init(void);
extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
-extern int arp_ioctl(unsigned int cmd, void __user *arg);
+extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg);
extern void arp_send(int type, int ptype, __be32 dest_ip,
struct net_device *dev, __be32 src_ip,
unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 7f8b27f..a69b0c6 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -798,7 +798,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCDARP:
case SIOCGARP:
case SIOCSARP:
- err = arp_ioctl(cmd, (void __user *)arg);
+ err = arp_ioctl(sk->sk_net, cmd, (void __user *)arg);
break;
case SIOCGIFADDR:
case SIOCSIFADDR:
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 48e7bf6..41a4d73 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -953,7 +953,7 @@ out_of_mem:
* Set (create) an ARP cache entry.
*/
-static int arp_req_set_proxy(struct net_device *dev, int on)
+static int arp_req_set_proxy(struct net *net, struct net_device *dev, int on)
{
if (dev == NULL) {
IPV4_DEVCONF_ALL(PROXY_ARP) = on;
@@ -966,7 +966,8 @@ static int arp_req_set_proxy(struct net_device *dev, int on)
return -ENXIO;
}
-static int arp_req_set_public(struct arpreq *r, struct net_device *dev)
+static int arp_req_set_public(struct net *net, struct arpreq *r,
+ struct net_device *dev)
{
__be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
__be32 mask = ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr;
@@ -985,17 +986,18 @@ static int arp_req_set_public(struct arpreq *r, struct net_device *dev)
return 0;
}
- return arp_req_set_proxy(dev, 1);
+ return arp_req_set_proxy(net, dev, 1);
}
-static int arp_req_set(struct arpreq *r, struct net_device * dev)
+static int arp_req_set(struct net *net, struct arpreq *r,
+ struct net_device * dev)
{
__be32 ip;
struct neighbour *neigh;
int err;
if (r->arp_flags & ATF_PUBL)
- return arp_req_set_public(r, dev);
+ return arp_req_set_public(net, r, dev);
ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
if (r->arp_flags & ATF_PERM)
@@ -1081,7 +1083,8 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev)
return err;
}
-static int arp_req_delete_public(struct arpreq *r, struct net_device *dev)
+static int arp_req_delete_public(struct net *net, struct arpreq *r,
+ struct net_device *dev)
{
__be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr;
__be32 mask = ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr;
@@ -1092,17 +1095,18 @@ static int arp_req_delete_public(struct arpreq *r, struct net_device *dev)
if (mask)
return -EINVAL;
- return arp_req_set_proxy(dev, 0);
+ return arp_req_set_proxy(net, dev, 0);
}
-static int arp_req_delete(struct arpreq *r, struct net_device * dev)
+static int arp_req_delete(struct net *net, struct arpreq *r,
+ struct net_device * dev)
{
int err;
__be32 ip;
struct neighbour *neigh;
if (r->arp_flags & ATF_PUBL)
- return arp_req_delete_public(r, dev);
+ return arp_req_delete_public(net, r, dev);
ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
if (dev == NULL) {
@@ -1132,7 +1136,7 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev)
* Handle an ARP layer I/O control request.
*/
-int arp_ioctl(unsigned int cmd, void __user *arg)
+int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg)
{
int err;
struct arpreq r;
@@ -1180,10 +1184,10 @@ int arp_ioctl(unsigned int cmd, void __user *arg)
switch (cmd) {
case SIOCDARP:
- err = arp_req_delete(&r, dev);
+ err = arp_req_delete(net, &r, dev);
break;
case SIOCSARP:
- err = arp_req_set(&r, dev);
+ err = arp_req_set(net, &r, dev);
break;
case SIOCGARP:
err = arp_req_get(&r, dev);
--
1.5.3.4
^ permalink raw reply related
* [PATCH net-2.6.25 2/7] Make __devinet_sysctl_register return an error
From: Pavel Emelyanov @ 2007-12-11 17:48 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, Linux Containers, devel
In-Reply-To: <475ECC69.1040809@openvz.org>
Currently, this function is void, so failures in creating
sysctls for new/renamed devices are not reported to anywhere.
Fixing this is another complex (needed?) task, but this
return value is needed during the namespaces creation to
handle the case, when we failed to create "all" and "default"
entries.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 872883e..bfb0fb0 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1455,8 +1460,8 @@ static struct devinet_sysctl_table {
},
};
-static void __devinet_sysctl_register(char *dev_name, int ctl_name,
- struct ipv4_devconf *p)
+static int __devinet_sysctl_register(struct net *net, char *dev_name,
+ int ctl_name, struct ipv4_devconf *p)
{
int i;
struct devinet_sysctl_table *t;
@@ -1498,14 +1504,14 @@ static void __devinet_sysctl_register(char *dev_name, int ctl_name,
goto free_procname;
p->sysctl = t;
- return;
+ return 0;
free_procname:
kfree(t->dev_name);
free:
kfree(t);
out:
- return;
+ return -ENOBUFS;
}
static void __devinet_sysctl_unregister(struct ipv4_devconf *cnf)
--
1.5.3.4
^ permalink raw reply related
* [PATCH net-2.6.25 1/7] Add the netns_ipv4 struct
From: Pavel Emelyanov @ 2007-12-11 17:45 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, Linux Containers, devel
In-Reply-To: <475ECC69.1040809@openvz.org>
The ipv4 will store its parameters inside this structure.
This one is empty now, but it will be eventually filled.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 18da0af..d04ddf2 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -10,6 +10,7 @@
#include <net/netns/unix.h>
#include <net/netns/packet.h>
+#include <net/netns/ipv4.h>
struct proc_dir_entry;
struct net_device;
@@ -46,6 +47,7 @@ struct net {
struct netns_packet packet;
struct netns_unix unx;
+ struct netns_ipv4 ipv4;
};
#ifdef CONFIG_NET
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
new file mode 100644
index 0000000..ce830d5
--- /dev/null
+++ b/include/net/netns/ipv4.h
@@ -0,0 +1,9 @@
+/*
+ * ipv4 in net namespaces
+ */
+
+#ifndef __NETNS_IPV4_H__
+#define __NETNS_IPV4_H__
+struct netns_ipv4 {
+};
+#endif
--
1.5.3.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox