LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] ipvlan: flush arp table when mac address changed
@ 2018-05-12 11:00 liuqifa
  2018-05-14  7:39 ` Paolo Abeni
  0 siblings, 1 reply; 3+ messages in thread
From: liuqifa @ 2018-05-12 11:00 UTC (permalink / raw)
  To: davem, dsahern, maheshb, weiyongjun1, maowenan, dingtianhong, liuqifa
  Cc: netdev, linux-kernel

From: Keefe Liu <liuqifa@huawei.com>

When master device's mac has been changed, the
commit <32c10bbfe914> "ipvlan: always use the current L2
addr of the master" makes the IPVlan devices's mac changed
also, but it doesn't flush the IPVlan's arp table.

Signed-off-by: Keefe Liu <liuqifa@huawei.com>
---
 drivers/net/ipvlan/ipvlan_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 450eec2..a1edfe1 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -7,6 +7,8 @@
  *
  */
 
+#include <net/neighbour.h>
+#include <net/arp.h>
 #include "ipvlan.h"
 
 static unsigned int ipvlan_netid __read_mostly;
@@ -792,8 +794,10 @@ static int ipvlan_device_event(struct notifier_block *unused,
 		break;
 
 	case NETDEV_CHANGEADDR:
-		list_for_each_entry(ipvlan, &port->ipvlans, pnode)
+		list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
 			ether_addr_copy(ipvlan->dev->dev_addr, dev->dev_addr);
+			neigh_changeaddr(&arp_tbl, ipvlan->dev);
+		}
 		break;
 
 	case NETDEV_PRE_TYPE_CHANGE:
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipvlan: flush arp table when mac address changed
  2018-05-12 11:00 [PATCH] ipvlan: flush arp table when mac address changed liuqifa
@ 2018-05-14  7:39 ` Paolo Abeni
  2018-05-14  8:49   ` 答复: " liuqifa
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Abeni @ 2018-05-14  7:39 UTC (permalink / raw)
  To: liuqifa, davem, dsahern, maheshb, weiyongjun1, maowenan, dingtianhong
  Cc: netdev, linux-kernel

Hi,

On Sat, 2018-05-12 at 19:00 +0800, liuqifa@huawei.com wrote:
> From: Keefe Liu <liuqifa@huawei.com>
> 
> When master device's mac has been changed, the
> commit <32c10bbfe914> "ipvlan: always use the current L2
> addr of the master" makes the IPVlan devices's mac changed
> also, but it doesn't flush the IPVlan's arp table.
> 
> Signed-off-by: Keefe Liu <liuqifa@huawei.com>
> ---
>  drivers/net/ipvlan/ipvlan_main.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
> index 450eec2..a1edfe1 100644
> --- a/drivers/net/ipvlan/ipvlan_main.c
> +++ b/drivers/net/ipvlan/ipvlan_main.c
> @@ -7,6 +7,8 @@
>   *
>   */
>  
> +#include <net/neighbour.h>
> +#include <net/arp.h>
>  #include "ipvlan.h"
>  
>  static unsigned int ipvlan_netid __read_mostly;
> @@ -792,8 +794,10 @@ static int ipvlan_device_event(struct notifier_block *unused,
>  		break;
>  
>  	case NETDEV_CHANGEADDR:
> -		list_for_each_entry(ipvlan, &port->ipvlans, pnode)
> +		list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
>  			ether_addr_copy(ipvlan->dev->dev_addr, dev->dev_addr);
> +			neigh_changeaddr(&arp_tbl, ipvlan->dev);
> +		}

Why don't using:

 call_netdevice_notifiers(NETDEV_CHANGEADDR, ipvlan->dev);

instead?

that is what other stacked device - bridge and vlans - are currently
doing in the same scenario.

Thanks,

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 答复: [PATCH] ipvlan: flush arp table when mac address changed
  2018-05-14  7:39 ` Paolo Abeni
@ 2018-05-14  8:49   ` liuqifa
  0 siblings, 0 replies; 3+ messages in thread
From: liuqifa @ 2018-05-14  8:49 UTC (permalink / raw)
  To: Paolo Abeni, davem, dsahern, maheshb, weiyongjun (A),
	maowenan, Dingtianhong
  Cc: netdev, linux-kernel

Hi,
> 
> Hi,
> 
> On Sat, 2018-05-12 at 19:00 +0800, liuqifa@huawei.com wrote:
> > From: Keefe Liu <liuqifa@huawei.com>
> >
> > When master device's mac has been changed, the commit <32c10bbfe914>
> > "ipvlan: always use the current L2 addr of the master" makes the
> > IPVlan devices's mac changed also, but it doesn't flush the IPVlan's
> > arp table.
> >
> > Signed-off-by: Keefe Liu <liuqifa@huawei.com>
> > ---
> >  drivers/net/ipvlan/ipvlan_main.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ipvlan/ipvlan_main.c
> > b/drivers/net/ipvlan/ipvlan_main.c
> > index 450eec2..a1edfe1 100644
> > --- a/drivers/net/ipvlan/ipvlan_main.c
> > +++ b/drivers/net/ipvlan/ipvlan_main.c
> > @@ -7,6 +7,8 @@
> >   *
> >   */
> >
> > +#include <net/neighbour.h>
> > +#include <net/arp.h>
> >  #include "ipvlan.h"
> >
> >  static unsigned int ipvlan_netid __read_mostly; @@ -792,8 +794,10 @@
> > static int ipvlan_device_event(struct notifier_block *unused,
> >  		break;
> >
> >  	case NETDEV_CHANGEADDR:
> > -		list_for_each_entry(ipvlan, &port->ipvlans, pnode)
> > +		list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
> >  			ether_addr_copy(ipvlan->dev->dev_addr, dev-
> >dev_addr);
> > +			neigh_changeaddr(&arp_tbl, ipvlan->dev);
> > +		}
> 
> Why don't using:
> 
>  call_netdevice_notifiers(NETDEV_CHANGEADDR, ipvlan->dev);
> 
> instead?
> 
> that is what other stacked device - bridge and vlans - are currently doing in
> the same scenario.
> 
> Thanks,
> 
> Paolo
>
Yes, I agre with you, this is a better solution.

Thanks

Keefe

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-14  8:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-12 11:00 [PATCH] ipvlan: flush arp table when mac address changed liuqifa
2018-05-14  7:39 ` Paolo Abeni
2018-05-14  8:49   ` 答复: " liuqifa

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).