diff options
-rw-r--r-- | drivers/net/vxlan.c | 18 | ||||
-rw-r--r-- | include/linux/netdevice.h | 8 |
2 files changed, 12 insertions, 14 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index bf64b4191dcc..2400b1beddd5 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -564,7 +564,7 @@ static void vxlan_notify_add_rx_port(struct sock *sk) | |||
564 | struct net_device *dev; | 564 | struct net_device *dev; |
565 | struct net *net = sock_net(sk); | 565 | struct net *net = sock_net(sk); |
566 | sa_family_t sa_family = sk->sk_family; | 566 | sa_family_t sa_family = sk->sk_family; |
567 | u16 port = htons(inet_sk(sk)->inet_sport); | 567 | __be16 port = inet_sk(sk)->inet_sport; |
568 | 568 | ||
569 | rcu_read_lock(); | 569 | rcu_read_lock(); |
570 | for_each_netdev_rcu(net, dev) { | 570 | for_each_netdev_rcu(net, dev) { |
@@ -581,7 +581,7 @@ static void vxlan_notify_del_rx_port(struct sock *sk) | |||
581 | struct net_device *dev; | 581 | struct net_device *dev; |
582 | struct net *net = sock_net(sk); | 582 | struct net *net = sock_net(sk); |
583 | sa_family_t sa_family = sk->sk_family; | 583 | sa_family_t sa_family = sk->sk_family; |
584 | u16 port = htons(inet_sk(sk)->inet_sport); | 584 | __be16 port = inet_sk(sk)->inet_sport; |
585 | 585 | ||
586 | rcu_read_lock(); | 586 | rcu_read_lock(); |
587 | for_each_netdev_rcu(net, dev) { | 587 | for_each_netdev_rcu(net, dev) { |
@@ -2021,7 +2021,8 @@ static struct device_type vxlan_type = { | |||
2021 | }; | 2021 | }; |
2022 | 2022 | ||
2023 | /* Calls the ndo_add_vxlan_port of the caller in order to | 2023 | /* Calls the ndo_add_vxlan_port of the caller in order to |
2024 | * supply the listening VXLAN udp ports. | 2024 | * supply the listening VXLAN udp ports. Callers are expected |
2025 | * to implement the ndo_add_vxlan_port. | ||
2025 | */ | 2026 | */ |
2026 | void vxlan_get_rx_port(struct net_device *dev) | 2027 | void vxlan_get_rx_port(struct net_device *dev) |
2027 | { | 2028 | { |
@@ -2029,16 +2030,13 @@ void vxlan_get_rx_port(struct net_device *dev) | |||
2029 | struct net *net = dev_net(dev); | 2030 | struct net *net = dev_net(dev); |
2030 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); | 2031 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); |
2031 | sa_family_t sa_family; | 2032 | sa_family_t sa_family; |
2032 | u16 port; | 2033 | __be16 port; |
2033 | int i; | 2034 | unsigned int i; |
2034 | |||
2035 | if (!dev || !dev->netdev_ops || !dev->netdev_ops->ndo_add_vxlan_port) | ||
2036 | return; | ||
2037 | 2035 | ||
2038 | spin_lock(&vn->sock_lock); | 2036 | spin_lock(&vn->sock_lock); |
2039 | for (i = 0; i < PORT_HASH_SIZE; ++i) { | 2037 | for (i = 0; i < PORT_HASH_SIZE; ++i) { |
2040 | hlist_for_each_entry_rcu(vs, vs_head(net, i), hlist) { | 2038 | hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist) { |
2041 | port = htons(inet_sk(vs->sock->sk)->inet_sport); | 2039 | port = inet_sk(vs->sock->sk)->inet_sport; |
2042 | sa_family = vs->sock->sk->sk_family; | 2040 | sa_family = vs->sock->sk->sk_family; |
2043 | dev->netdev_ops->ndo_add_vxlan_port(dev, sa_family, | 2041 | dev->netdev_ops->ndo_add_vxlan_port(dev, sa_family, |
2044 | port); | 2042 | port); |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 041b42a305f6..3de49aca4519 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -950,14 +950,14 @@ struct netdev_phys_port_id { | |||
950 | * multiple net devices on single physical port. | 950 | * multiple net devices on single physical port. |
951 | * | 951 | * |
952 | * void (*ndo_add_vxlan_port)(struct net_device *dev, | 952 | * void (*ndo_add_vxlan_port)(struct net_device *dev, |
953 | * sa_family_t sa_family, __u16 port); | 953 | * sa_family_t sa_family, __be16 port); |
954 | * Called by vxlan to notiy a driver about the UDP port and socket | 954 | * Called by vxlan to notiy a driver about the UDP port and socket |
955 | * address family that vxlan is listnening to. It is called only when | 955 | * address family that vxlan is listnening to. It is called only when |
956 | * a new port starts listening. The operation is protected by the | 956 | * a new port starts listening. The operation is protected by the |
957 | * vxlan_net->sock_lock. | 957 | * vxlan_net->sock_lock. |
958 | * | 958 | * |
959 | * void (*ndo_del_vxlan_port)(struct net_device *dev, | 959 | * void (*ndo_del_vxlan_port)(struct net_device *dev, |
960 | * sa_family_t sa_family, __u16 port); | 960 | * sa_family_t sa_family, __be16 port); |
961 | * Called by vxlan to notify the driver about a UDP port and socket | 961 | * Called by vxlan to notify the driver about a UDP port and socket |
962 | * address family that vxlan is not listening to anymore. The operation | 962 | * address family that vxlan is not listening to anymore. The operation |
963 | * is protected by the vxlan_net->sock_lock. | 963 | * is protected by the vxlan_net->sock_lock. |
@@ -1093,10 +1093,10 @@ struct net_device_ops { | |||
1093 | struct netdev_phys_port_id *ppid); | 1093 | struct netdev_phys_port_id *ppid); |
1094 | void (*ndo_add_vxlan_port)(struct net_device *dev, | 1094 | void (*ndo_add_vxlan_port)(struct net_device *dev, |
1095 | sa_family_t sa_family, | 1095 | sa_family_t sa_family, |
1096 | __u16 port); | 1096 | __be16 port); |
1097 | void (*ndo_del_vxlan_port)(struct net_device *dev, | 1097 | void (*ndo_del_vxlan_port)(struct net_device *dev, |
1098 | sa_family_t sa_family, | 1098 | sa_family_t sa_family, |
1099 | __u16 port); | 1099 | __be16 port); |
1100 | }; | 1100 | }; |
1101 | 1101 | ||
1102 | /* | 1102 | /* |