Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2936b6ab authored by Sridhar Samudrala's avatar Sridhar Samudrala Committed by David S. Miller
Browse files

vxlan: Avoid creating fdb entry with NULL destination



Commit afbd8bae
   vxlan: add implicit fdb entry for default destination
creates an implicit fdb entry for default destination. This results
in an invalid fdb entry if default destination is not specified.
For ex:
  ip link add vxlan1 type vxlan id 100
creates the following fdb entry
  00:00:00:00:00:00 dev vxlan1 dst 0.0.0.0 self permanent

This patch fixes this issue by creating an fdb entry only if a
valid default destination is specified.

Signed-off-by: default avatarSridhar Samudrala <sri@us.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 269aa759
Loading
Loading
Loading
Loading
+13 −9
Original line number Original line Diff line number Diff line
@@ -2490,15 +2490,19 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,


	SET_ETHTOOL_OPS(dev, &vxlan_ethtool_ops);
	SET_ETHTOOL_OPS(dev, &vxlan_ethtool_ops);


	/* create an fdb entry for default destination */
	/* create an fdb entry for a valid default destination */
	if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) {
		err = vxlan_fdb_create(vxlan, all_zeros_mac,
		err = vxlan_fdb_create(vxlan, all_zeros_mac,
				       &vxlan->default_dst.remote_ip,
				       &vxlan->default_dst.remote_ip,
				       NUD_REACHABLE|NUD_PERMANENT,
				       NUD_REACHABLE|NUD_PERMANENT,
				       NLM_F_EXCL|NLM_F_CREATE,
				       NLM_F_EXCL|NLM_F_CREATE,
			       vxlan->dst_port, vxlan->default_dst.remote_vni,
				       vxlan->dst_port,
			       vxlan->default_dst.remote_ifindex, NTF_SELF);
				       vxlan->default_dst.remote_vni,
				       vxlan->default_dst.remote_ifindex,
				       NTF_SELF);
		if (err)
		if (err)
			return err;
			return err;
	}


	err = register_netdevice(dev);
	err = register_netdevice(dev);
	if (err) {
	if (err) {