Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: hsr: sync hw addr of slave2 according to slave1 hw addr on PRP

In order to work properly PRP requires slave1 and slave2 to share the
same MAC address. To ease the configuration process on userspace tools,
sync the slave2 MAC address with slave1. In addition, when deleting the
port from the list, restore the original MAC address.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Fernando Fernandez Mancera and committed by
David S. Miller
b65999e7 6a325aed

+17
+5
net/hsr/hsr_device.c
··· 761 761 if (res) 762 762 goto err_unregister; 763 763 764 + if (protocol_version == PRP_V1) { 765 + eth_hw_addr_set(slave[1], slave[0]->dev_addr); 766 + call_netdevice_notifiers(NETDEV_CHANGEADDR, slave[1]); 767 + } 768 + 764 769 if (interlink) { 765 770 res = hsr_add_port(hsr, interlink, HSR_PT_INTERLINK, extack); 766 771 if (res)
+9
net/hsr/hsr_main.c
··· 78 78 eth_hw_addr_set(master->dev, dev->dev_addr); 79 79 call_netdevice_notifiers(NETDEV_CHANGEADDR, 80 80 master->dev); 81 + 82 + if (hsr->prot_version == PRP_V1) { 83 + port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_B); 84 + if (port) { 85 + eth_hw_addr_set(port->dev, dev->dev_addr); 86 + call_netdevice_notifiers(NETDEV_CHANGEADDR, 87 + port->dev); 88 + } 89 + } 81 90 } 82 91 83 92 /* Make sure we recognize frames from ourselves in hsr_rcv() */
+1
net/hsr/hsr_main.h
··· 155 155 struct hsr_priv *hsr; 156 156 enum hsr_port_type type; 157 157 struct rcu_head rcu; 158 + unsigned char original_macaddress[ETH_ALEN]; 158 159 }; 159 160 160 161 struct hsr_frame_info;
+2
net/hsr/hsr_slave.c
··· 196 196 port->hsr = hsr; 197 197 port->dev = dev; 198 198 port->type = type; 199 + ether_addr_copy(port->original_macaddress, dev->dev_addr); 199 200 200 201 if (type != HSR_PT_MASTER) { 201 202 res = hsr_portdev_setup(hsr, dev, port, extack); ··· 233 232 if (!port->hsr->fwd_offloaded) 234 233 dev_set_promiscuity(port->dev, -1); 235 234 netdev_upper_dev_unlink(port->dev, master->dev); 235 + eth_hw_addr_set(port->dev, port->original_macaddress); 236 236 } 237 237 238 238 kfree_rcu(port, rcu);