* [PATCH 1/2 net-2.6.25] [IPV4] Remove extra argument from arp_ignore.
@ 2008-01-14 14:04 Denis V. Lunev
2008-01-14 14:04 ` [PATCH 2/2 net-2.6.25] [NETNS] Process inet_confirm_addr in the correct namespace Denis V. Lunev
2008-01-14 14:37 ` [PATCH 1/2 net-2.6.25] [IPV4] Remove extra argument from arp_ignore David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Denis V. Lunev @ 2008-01-14 14:04 UTC (permalink / raw)
To: davem; +Cc: netdev, devel, Denis V. Lunev
arp_ignore has two arguments: dev & in_dev. dev is used for inet_confirm_addr
calling only.
inet_confirm_addr, in turn, either gets in_dev from the device passed or
iterates over all network devices if the device passed is NULL. It seems
logical to directly pass in_dev into inet_confirm_addr.
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
include/linux/inetdevice.h | 2 +-
net/ipv4/arp.c | 11 +++++------
net/ipv4/devinet.c | 17 ++++++-----------
3 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index b3c5081..45f3731 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -135,7 +135,7 @@ extern int devinet_ioctl(unsigned int cmd, void __user *);
extern void devinet_init(void);
extern struct in_device *inetdev_by_index(int);
extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
-extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope);
+extern __be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope);
extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask);
static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index e944d98..f38e1a9 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -382,8 +382,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
read_unlock_bh(&neigh->lock);
}
-static int arp_ignore(struct in_device *in_dev, struct net_device *dev,
- __be32 sip, __be32 tip)
+static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
{
int scope;
@@ -403,7 +402,7 @@ static int arp_ignore(struct in_device *in_dev, struct net_device *dev,
case 3: /* Do not reply for scope host addresses */
sip = 0;
scope = RT_SCOPE_LINK;
- dev = NULL;
+ in_dev = NULL;
break;
case 4: /* Reserved */
case 5:
@@ -415,7 +414,7 @@ static int arp_ignore(struct in_device *in_dev, struct net_device *dev,
default:
return 0;
}
- return !inet_confirm_addr(dev, sip, tip, scope);
+ return !inet_confirm_addr(in_dev, sip, tip, scope);
}
static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
@@ -807,7 +806,7 @@ static int arp_process(struct sk_buff *skb)
if (sip == 0) {
if (arp->ar_op == htons(ARPOP_REQUEST) &&
inet_addr_type(&init_net, tip) == RTN_LOCAL &&
- !arp_ignore(in_dev,dev,sip,tip))
+ !arp_ignore(in_dev, sip, tip))
arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha,
dev->dev_addr, sha);
goto out;
@@ -825,7 +824,7 @@ static int arp_process(struct sk_buff *skb)
int dont_send = 0;
if (!dont_send)
- dont_send |= arp_ignore(in_dev,dev,sip,tip);
+ dont_send |= arp_ignore(in_dev,sip,tip);
if (!dont_send && IN_DEV_ARPFILTER(in_dev))
dont_send |= arp_filter(sip,tip,dev);
if (!dont_send)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 03db15b..dc1665a 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -968,24 +968,19 @@ static __be32 confirm_addr_indev(struct in_device *in_dev, __be32 dst,
/*
* Confirm that local IP address exists using wildcards:
- * - dev: only on this interface, 0=any interface
+ * - in_dev: only on this interface, 0=any interface
* - dst: only in the same subnet as dst, 0=any dst
* - local: address, 0=autoselect the local address
* - scope: maximum allowed scope value for the local address
*/
-__be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope)
+__be32 inet_confirm_addr(struct in_device *in_dev,
+ __be32 dst, __be32 local, int scope)
{
__be32 addr = 0;
- struct in_device *in_dev;
-
- if (dev) {
- rcu_read_lock();
- if ((in_dev = __in_dev_get_rcu(dev)))
- addr = confirm_addr_indev(in_dev, dst, local, scope);
- rcu_read_unlock();
+ struct net_device *dev;
- return addr;
- }
+ if (in_dev != NULL)
+ return confirm_addr_indev(in_dev, dst, local, scope);
read_lock(&dev_base_lock);
rcu_read_lock();
--
1.5.3.rc5
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2 net-2.6.25] [NETNS] Process inet_confirm_addr in the correct namespace.
2008-01-14 14:04 [PATCH 1/2 net-2.6.25] [IPV4] Remove extra argument from arp_ignore Denis V. Lunev
@ 2008-01-14 14:04 ` Denis V. Lunev
2008-01-14 14:37 ` [PATCH 1/2 net-2.6.25] [IPV4] Remove extra argument from arp_ignore David Miller
1 sibling, 0 replies; 5+ messages in thread
From: Denis V. Lunev @ 2008-01-14 14:04 UTC (permalink / raw)
To: davem; +Cc: netdev, devel, Denis V. Lunev
inet_confirm_addr can be called with NULL in_dev from arp_ignore iff
scope is RT_SCOPE_LINK.
Lets always pass the device and check for RT_SCOPE_LINK scope inside
inet_confirm_addr. This let us take network namespace from in_device a
need for an additional argument.
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/ipv4/arp.c | 1 -
net/ipv4/devinet.c | 6 ++++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index f38e1a9..b715ec0 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -402,7 +400,6 @@ static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
case 3: /* Do not reply for scope host addresses */
sip = 0;
scope = RT_SCOPE_LINK;
- in_dev = NULL;
break;
case 4: /* Reserved */
case 5:
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index dc1665a..4569c69 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -978,13 +978,15 @@ __be32 inet_confirm_addr(struct in_device *in_dev,
{
__be32 addr = 0;
struct net_device *dev;
+ struct net *net;
- if (in_dev != NULL)
+ if (scope != RT_SCOPE_LINK)
return confirm_addr_indev(in_dev, dst, local, scope);
+ net = in_dev->dev->nd_net;
read_lock(&dev_base_lock);
rcu_read_lock();
- for_each_netdev(&init_net, dev) {
+ for_each_netdev(net, dev) {
if ((in_dev = __in_dev_get_rcu(dev))) {
addr = confirm_addr_indev(in_dev, dst, local, scope);
if (addr)
--
1.5.3.rc5
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2 net-2.6.25] [IPV4] Remove extra argument from arp_ignore.
2008-01-14 14:04 [PATCH 1/2 net-2.6.25] [IPV4] Remove extra argument from arp_ignore Denis V. Lunev
2008-01-14 14:04 ` [PATCH 2/2 net-2.6.25] [NETNS] Process inet_confirm_addr in the correct namespace Denis V. Lunev
@ 2008-01-14 14:37 ` David Miller
2008-01-14 14:43 ` Denis V. Lunev
1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2008-01-14 14:37 UTC (permalink / raw)
To: den; +Cc: netdev, devel
This patch series is numbered, but your other patch series sent a few
moments ago had no sequence numbers in the subject lines or changelog.
How can I know what order to apply those in and do they need to go in
before or after this set?
I shouldn't have to ask questions like this, so please help avoid
confusion of this nature in the future.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2 net-2.6.25] [IPV4] Remove extra argument from arp_ignore.
2008-01-14 14:37 ` [PATCH 1/2 net-2.6.25] [IPV4] Remove extra argument from arp_ignore David Miller
@ 2008-01-14 14:43 ` Denis V. Lunev
2008-01-14 14:49 ` Denis V. Lunev
0 siblings, 1 reply; 5+ messages in thread
From: Denis V. Lunev @ 2008-01-14 14:43 UTC (permalink / raw)
To: David Miller; +Cc: den, netdev, devel
David Miller wrote:
> This patch series is numbered, but your other patch series sent a few
> moments ago had no sequence numbers in the subject lines or changelog.
>
> How can I know what order to apply those in and do they need to go in
> before or after this set?
>
> I shouldn't have to ask questions like this, so please help avoid
> confusion of this nature in the future.
>
> Thanks.
>
non-numbered patches do not intersect with each other.
numbered ones depends on each other but not from the rest.
Sorry for inconvenience :(
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2 net-2.6.25] [IPV4] Remove extra argument from arp_ignore.
2008-01-14 14:43 ` Denis V. Lunev
@ 2008-01-14 14:49 ` Denis V. Lunev
0 siblings, 0 replies; 5+ messages in thread
From: Denis V. Lunev @ 2008-01-14 14:49 UTC (permalink / raw)
To: David Miller; +Cc: netdev, devel
Denis V. Lunev wrote:
> David Miller wrote:
>> This patch series is numbered, but your other patch series sent a few
>> moments ago had no sequence numbers in the subject lines or changelog.
>>
>> How can I know what order to apply those in and do they need to go in
>> before or after this set?
>>
>> I shouldn't have to ask questions like this, so please help avoid
>> confusion of this nature in the future.
>>
>> Thanks.
>>
>
> non-numbered patches do not intersect with each other.
>
> numbered ones depends on each other but not from the rest.
>
> Sorry for inconvenience :(
I'll resend them for you convenience. Sorry again, I forget that git
checks indexes and this can be a problem.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-14 14:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-14 14:04 [PATCH 1/2 net-2.6.25] [IPV4] Remove extra argument from arp_ignore Denis V. Lunev
2008-01-14 14:04 ` [PATCH 2/2 net-2.6.25] [NETNS] Process inet_confirm_addr in the correct namespace Denis V. Lunev
2008-01-14 14:37 ` [PATCH 1/2 net-2.6.25] [IPV4] Remove extra argument from arp_ignore David Miller
2008-01-14 14:43 ` Denis V. Lunev
2008-01-14 14:49 ` Denis V. Lunev
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).