Message ID | 1290996593-32416-4-git-send-email-maximlevitsky@gmail.com |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
On Mon, 2010-11-29 at 04:09 +0200, Maxim Levitsky wrote: > IPv4 over firewire needs to be able to remove ARP entries > from the ARP cache that belong to nodes that are removed, because > IPv4 over firewire uses ARP packets for private information > about nodes. > > This information becomes invalid as soon as node drops > off the bus and when it reconnects, its only possible > to start takling to is after it responded to an ARP packet. > But ARP cache prevents such packets from being sent. > > CC: netdev@vger.kernel.org > CC: "David S. Miller" <davem@davemloft.net> > CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> > CC: James Morris <jmorris@namei.org> > CC: Patrick McHardy <kaber@trash.net> Anybody? Best regards, Maxim Levitsky > > > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> > --- > include/net/arp.h | 1 + > net/ipv4/arp.c | 29 ++++++++++++++++++----------- > 2 files changed, 19 insertions(+), 11 deletions(-) > > diff --git a/include/net/arp.h b/include/net/arp.h > index f4cf6ce..91f0568 100644 > --- a/include/net/arp.h > +++ b/include/net/arp.h > @@ -25,5 +25,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, > const unsigned char *src_hw, > const unsigned char *target_hw); > extern void arp_xmit(struct sk_buff *skb); > +int arp_invalidate(struct net_device *dev, __be32 ip); > > #endif /* _ARP_H */ > diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c > index d8e540c..35b1272 100644 > --- a/net/ipv4/arp.c > +++ b/net/ipv4/arp.c > @@ -1142,6 +1142,23 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev) > return err; > } > > +int arp_invalidate(struct net_device *dev, __be32 ip) > +{ > + int err = -ENXIO; > + struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev); > + > + if (neigh) { > + if (neigh->nud_state & ~NUD_NOARP) > + err = neigh_update(neigh, NULL, NUD_FAILED, > + NEIGH_UPDATE_F_OVERRIDE| > + NEIGH_UPDATE_F_ADMIN); > + neigh_release(neigh); > + } > + > + return err; > +} > +EXPORT_SYMBOL(arp_invalidate); > + > static int arp_req_delete_public(struct net *net, struct arpreq *r, > struct net_device *dev) > { > @@ -1162,7 +1179,6 @@ static int arp_req_delete(struct net *net, struct arpreq *r, > { > int err; > __be32 ip; > - struct neighbour *neigh; > > if (r->arp_flags & ATF_PUBL) > return arp_req_delete_public(net, r, dev); > @@ -1180,16 +1196,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r, > if (!dev) > return -EINVAL; > } > - err = -ENXIO; > - neigh = neigh_lookup(&arp_tbl, &ip, dev); > - if (neigh) { > - if (neigh->nud_state & ~NUD_NOARP) > - err = neigh_update(neigh, NULL, NUD_FAILED, > - NEIGH_UPDATE_F_OVERRIDE| > - NEIGH_UPDATE_F_ADMIN); > - neigh_release(neigh); > - } > - return err; > + return arp_invalidate(dev, ip); > } > > /* -- 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
Le dimanche 05 décembre 2010 à 01:15 +0200, Maxim Levitsky a écrit : > On Mon, 2010-11-29 at 04:09 +0200, Maxim Levitsky wrote: > > IPv4 over firewire needs to be able to remove ARP entries > > from the ARP cache that belong to nodes that are removed, because > > IPv4 over firewire uses ARP packets for private information > > about nodes. > > > > This information becomes invalid as soon as node drops > > off the bus and when it reconnects, its only possible > > to start takling to is after it responded to an ARP packet. > > But ARP cache prevents such packets from being sent. > > > > CC: netdev@vger.kernel.org > > CC: "David S. Miller" <davem@davemloft.net> > > CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> > > CC: James Morris <jmorris@namei.org> > > CC: Patrick McHardy <kaber@trash.net> > > Anybody? > > Best regards, > Maxim Levitsky > > > > > > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> > > --- > > include/net/arp.h | 1 + > > net/ipv4/arp.c | 29 ++++++++++++++++++----------- > > 2 files changed, 19 insertions(+), 11 deletions(-) > > > > diff --git a/include/net/arp.h b/include/net/arp.h > > index f4cf6ce..91f0568 100644 > > --- a/include/net/arp.h > > +++ b/include/net/arp.h > > @@ -25,5 +25,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, > > const unsigned char *src_hw, > > const unsigned char *target_hw); > > extern void arp_xmit(struct sk_buff *skb); > > +int arp_invalidate(struct net_device *dev, __be32 ip); > > > > #endif /* _ARP_H */ > > diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c > > index d8e540c..35b1272 100644 > > --- a/net/ipv4/arp.c > > +++ b/net/ipv4/arp.c > > @@ -1142,6 +1142,23 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev) > > return err; > > } > > > > +int arp_invalidate(struct net_device *dev, __be32 ip) > > +{ > > + int err = -ENXIO; > > + struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev); > > + > > + if (neigh) { > > + if (neigh->nud_state & ~NUD_NOARP) > > + err = neigh_update(neigh, NULL, NUD_FAILED, > > + NEIGH_UPDATE_F_OVERRIDE| > > + NEIGH_UPDATE_F_ADMIN); > > + neigh_release(neigh); > > + } > > + > > + return err; > > +} > > +EXPORT_SYMBOL(arp_invalidate); > > + > > static int arp_req_delete_public(struct net *net, struct arpreq *r, > > struct net_device *dev) > > { > > @@ -1162,7 +1179,6 @@ static int arp_req_delete(struct net *net, struct arpreq *r, > > { > > int err; > > __be32 ip; > > - struct neighbour *neigh; > > > > if (r->arp_flags & ATF_PUBL) > > return arp_req_delete_public(net, r, dev); > > @@ -1180,16 +1196,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r, > > if (!dev) > > return -EINVAL; > > } > > - err = -ENXIO; > > - neigh = neigh_lookup(&arp_tbl, &ip, dev); > > - if (neigh) { > > - if (neigh->nud_state & ~NUD_NOARP) > > - err = neigh_update(neigh, NULL, NUD_FAILED, > > - NEIGH_UPDATE_F_OVERRIDE| > > - NEIGH_UPDATE_F_ADMIN); > > - neigh_release(neigh); > > - } > > - return err; > > + return arp_invalidate(dev, ip); > > } > > > > /* > Hmm.. If somebody can explain why RTNL is held in arp_ioctl() (and therefore in arp_req_delete()), we might first remove RTNL use in arp_ioctl() so that your patch can be applied. Right now it is not good, because RTNL wont be necessarly held when you are going to call arp_invalidate() ? -- 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
On Mon, 2010-11-29 at 04:09 +0200, Maxim Levitsky wrote: > IPv4 over firewire needs to be able to remove ARP entries > from the ARP cache that belong to nodes that are removed, because > IPv4 over firewire uses ARP packets for private information > about nodes. > > This information becomes invalid as soon as node drops > off the bus and when it reconnects, its only possible > to start takling to is after it responded to an ARP packet. > But ARP cache prevents such packets from being sent. > > CC: netdev@vger.kernel.org > CC: "David S. Miller" <davem@davemloft.net> > CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> > CC: James Morris <jmorris@namei.org> > CC: Patrick McHardy <kaber@trash.net> Anybody? Best regards, Maxim Levitsky > > > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> > --- > include/net/arp.h | 1 + > net/ipv4/arp.c | 29 ++++++++++++++++++----------- > 2 files changed, 19 insertions(+), 11 deletions(-) > > diff --git a/include/net/arp.h b/include/net/arp.h > index f4cf6ce..91f0568 100644 > --- a/include/net/arp.h > +++ b/include/net/arp.h > @@ -25,5 +25,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, > const unsigned char *src_hw, > const unsigned char *target_hw); > extern void arp_xmit(struct sk_buff *skb); > +int arp_invalidate(struct net_device *dev, __be32 ip); > > #endif /* _ARP_H */ > diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c > index d8e540c..35b1272 100644 > --- a/net/ipv4/arp.c > +++ b/net/ipv4/arp.c > @@ -1142,6 +1142,23 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev) > return err; > } > > +int arp_invalidate(struct net_device *dev, __be32 ip) > +{ > + int err = -ENXIO; > + struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev); > + > + if (neigh) { > + if (neigh->nud_state & ~NUD_NOARP) > + err = neigh_update(neigh, NULL, NUD_FAILED, > + NEIGH_UPDATE_F_OVERRIDE| > + NEIGH_UPDATE_F_ADMIN); > + neigh_release(neigh); > + } > + > + return err; > +} > +EXPORT_SYMBOL(arp_invalidate); > + > static int arp_req_delete_public(struct net *net, struct arpreq *r, > struct net_device *dev) > { > @@ -1162,7 +1179,6 @@ static int arp_req_delete(struct net *net, struct arpreq *r, > { > int err; > __be32 ip; > - struct neighbour *neigh; > > if (r->arp_flags & ATF_PUBL) > return arp_req_delete_public(net, r, dev); > @@ -1180,16 +1196,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r, > if (!dev) > return -EINVAL; > } > - err = -ENXIO; > - neigh = neigh_lookup(&arp_tbl, &ip, dev); > - if (neigh) { > - if (neigh->nud_state & ~NUD_NOARP) > - err = neigh_update(neigh, NULL, NUD_FAILED, > - NEIGH_UPDATE_F_OVERRIDE| > - NEIGH_UPDATE_F_ADMIN); > - neigh_release(neigh); > - } > - return err; > + return arp_invalidate(dev, ip); > } > > /* -- 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
Le vendredi 07 janvier 2011 à 14:47 +0200, Maxim Levitsky a écrit : > On Mon, 2010-11-29 at 04:09 +0200, Maxim Levitsky wrote: > > IPv4 over firewire needs to be able to remove ARP entries > > from the ARP cache that belong to nodes that are removed, because > > IPv4 over firewire uses ARP packets for private information > > about nodes. > > > > This information becomes invalid as soon as node drops > > off the bus and when it reconnects, its only possible > > to start takling to is after it responded to an ARP packet. > > But ARP cache prevents such packets from being sent. > > > > CC: netdev@vger.kernel.org > > CC: "David S. Miller" <davem@davemloft.net> > > CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> > > CC: James Morris <jmorris@namei.org> > > CC: Patrick McHardy <kaber@trash.net> > > Anybody? > > Best regards, > Maxim Levitsky > > > > > > > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> > > --- > > include/net/arp.h | 1 + > > net/ipv4/arp.c | 29 ++++++++++++++++++----------- > > 2 files changed, 19 insertions(+), 11 deletions(-) > > > > diff --git a/include/net/arp.h b/include/net/arp.h > > index f4cf6ce..91f0568 100644 > > --- a/include/net/arp.h > > +++ b/include/net/arp.h > > @@ -25,5 +25,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, > > const unsigned char *src_hw, > > const unsigned char *target_hw); > > extern void arp_xmit(struct sk_buff *skb); > > +int arp_invalidate(struct net_device *dev, __be32 ip); > > > > #endif /* _ARP_H */ > > diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c > > index d8e540c..35b1272 100644 > > --- a/net/ipv4/arp.c > > +++ b/net/ipv4/arp.c > > @@ -1142,6 +1142,23 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev) > > return err; > > } > > > > +int arp_invalidate(struct net_device *dev, __be32 ip) > > +{ > > + int err = -ENXIO; > > + struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev); > > + > > + if (neigh) { > > + if (neigh->nud_state & ~NUD_NOARP) > > + err = neigh_update(neigh, NULL, NUD_FAILED, > > + NEIGH_UPDATE_F_OVERRIDE| > > + NEIGH_UPDATE_F_ADMIN); > > + neigh_release(neigh); > > + } > > + > > + return err; > > +} > > +EXPORT_SYMBOL(arp_invalidate); > > + > > static int arp_req_delete_public(struct net *net, struct arpreq *r, > > struct net_device *dev) > > { > > @@ -1162,7 +1179,6 @@ static int arp_req_delete(struct net *net, struct arpreq *r, > > { > > int err; > > __be32 ip; > > - struct neighbour *neigh; > > > > if (r->arp_flags & ATF_PUBL) > > return arp_req_delete_public(net, r, dev); > > @@ -1180,16 +1196,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r, > > if (!dev) > > return -EINVAL; > > } > > - err = -ENXIO; > > - neigh = neigh_lookup(&arp_tbl, &ip, dev); > > - if (neigh) { > > - if (neigh->nud_state & ~NUD_NOARP) > > - err = neigh_update(neigh, NULL, NUD_FAILED, > > - NEIGH_UPDATE_F_OVERRIDE| > > - NEIGH_UPDATE_F_ADMIN); > > - neigh_release(neigh); > > - } > > - return err; > > + return arp_invalidate(dev, ip); > > } > > > > /* > Hi Maxim You were supposed to respin your patch after my commit : (941666c2e3e0f9f6a1 net: RCU conversion of dev_getbyhwaddr() and arp_ioctl()) Thanks -- 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
On Fri, 2011-01-07 at 13:57 +0100, Eric Dumazet wrote: > Le vendredi 07 janvier 2011 à 14:47 +0200, Maxim Levitsky a écrit : > > On Mon, 2010-11-29 at 04:09 +0200, Maxim Levitsky wrote: > > > IPv4 over firewire needs to be able to remove ARP entries > > > from the ARP cache that belong to nodes that are removed, because > > > IPv4 over firewire uses ARP packets for private information > > > about nodes. > > > > > > This information becomes invalid as soon as node drops > > > off the bus and when it reconnects, its only possible > > > to start takling to is after it responded to an ARP packet. > > > But ARP cache prevents such packets from being sent. > > > > > > CC: netdev@vger.kernel.org > > > CC: "David S. Miller" <davem@davemloft.net> > > > CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> > > > CC: James Morris <jmorris@namei.org> > > > CC: Patrick McHardy <kaber@trash.net> > > > > Anybody? > > > > Best regards, > > Maxim Levitsky > > > > > > > > > > > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> > > > --- > > > include/net/arp.h | 1 + > > > net/ipv4/arp.c | 29 ++++++++++++++++++----------- > > > 2 files changed, 19 insertions(+), 11 deletions(-) > > > > > > diff --git a/include/net/arp.h b/include/net/arp.h > > > index f4cf6ce..91f0568 100644 > > > --- a/include/net/arp.h > > > +++ b/include/net/arp.h > > > @@ -25,5 +25,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, > > > const unsigned char *src_hw, > > > const unsigned char *target_hw); > > > extern void arp_xmit(struct sk_buff *skb); > > > +int arp_invalidate(struct net_device *dev, __be32 ip); > > > > > > #endif /* _ARP_H */ > > > diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c > > > index d8e540c..35b1272 100644 > > > --- a/net/ipv4/arp.c > > > +++ b/net/ipv4/arp.c > > > @@ -1142,6 +1142,23 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev) > > > return err; > > > } > > > > > > +int arp_invalidate(struct net_device *dev, __be32 ip) > > > +{ > > > + int err = -ENXIO; > > > + struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev); > > > + > > > + if (neigh) { > > > + if (neigh->nud_state & ~NUD_NOARP) > > > + err = neigh_update(neigh, NULL, NUD_FAILED, > > > + NEIGH_UPDATE_F_OVERRIDE| > > > + NEIGH_UPDATE_F_ADMIN); > > > + neigh_release(neigh); > > > + } > > > + > > > + return err; > > > +} > > > +EXPORT_SYMBOL(arp_invalidate); > > > + > > > static int arp_req_delete_public(struct net *net, struct arpreq *r, > > > struct net_device *dev) > > > { > > > @@ -1162,7 +1179,6 @@ static int arp_req_delete(struct net *net, struct arpreq *r, > > > { > > > int err; > > > __be32 ip; > > > - struct neighbour *neigh; > > > > > > if (r->arp_flags & ATF_PUBL) > > > return arp_req_delete_public(net, r, dev); > > > @@ -1180,16 +1196,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r, > > > if (!dev) > > > return -EINVAL; > > > } > > > - err = -ENXIO; > > > - neigh = neigh_lookup(&arp_tbl, &ip, dev); > > > - if (neigh) { > > > - if (neigh->nud_state & ~NUD_NOARP) > > > - err = neigh_update(neigh, NULL, NUD_FAILED, > > > - NEIGH_UPDATE_F_OVERRIDE| > > > - NEIGH_UPDATE_F_ADMIN); > > > - neigh_release(neigh); > > > - } > > > - return err; > > > + return arp_invalidate(dev, ip); > > > } > > > > > > /* > > > > Hi Maxim > > You were supposed to respin your patch after my commit : > > (941666c2e3e0f9f6a1 net: RCU conversion of dev_getbyhwaddr() and > arp_ioctl()) > > Thanks Will do very soon. Best regards, Maxim Levitsky -- 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
diff --git a/include/net/arp.h b/include/net/arp.h index f4cf6ce..91f0568 100644 --- a/include/net/arp.h +++ b/include/net/arp.h @@ -25,5 +25,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, const unsigned char *src_hw, const unsigned char *target_hw); extern void arp_xmit(struct sk_buff *skb); +int arp_invalidate(struct net_device *dev, __be32 ip); #endif /* _ARP_H */ diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index d8e540c..35b1272 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -1142,6 +1142,23 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev) return err; } +int arp_invalidate(struct net_device *dev, __be32 ip) +{ + int err = -ENXIO; + struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev); + + if (neigh) { + if (neigh->nud_state & ~NUD_NOARP) + err = neigh_update(neigh, NULL, NUD_FAILED, + NEIGH_UPDATE_F_OVERRIDE| + NEIGH_UPDATE_F_ADMIN); + neigh_release(neigh); + } + + return err; +} +EXPORT_SYMBOL(arp_invalidate); + static int arp_req_delete_public(struct net *net, struct arpreq *r, struct net_device *dev) { @@ -1162,7 +1179,6 @@ static int arp_req_delete(struct net *net, struct arpreq *r, { int err; __be32 ip; - struct neighbour *neigh; if (r->arp_flags & ATF_PUBL) return arp_req_delete_public(net, r, dev); @@ -1180,16 +1196,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r, if (!dev) return -EINVAL; } - err = -ENXIO; - neigh = neigh_lookup(&arp_tbl, &ip, dev); - if (neigh) { - if (neigh->nud_state & ~NUD_NOARP) - err = neigh_update(neigh, NULL, NUD_FAILED, - NEIGH_UPDATE_F_OVERRIDE| - NEIGH_UPDATE_F_ADMIN); - neigh_release(neigh); - } - return err; + return arp_invalidate(dev, ip); } /*
IPv4 over firewire needs to be able to remove ARP entries from the ARP cache that belong to nodes that are removed, because IPv4 over firewire uses ARP packets for private information about nodes. This information becomes invalid as soon as node drops off the bus and when it reconnects, its only possible to start takling to is after it responded to an ARP packet. But ARP cache prevents such packets from being sent. CC: netdev@vger.kernel.org CC: "David S. Miller" <davem@davemloft.net> CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> CC: James Morris <jmorris@namei.org> CC: Patrick McHardy <kaber@trash.net> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> --- include/net/arp.h | 1 + net/ipv4/arp.c | 29 ++++++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-)