@@ -193,7 +193,7 @@ static struct socket *rxe_setup_udp_tunnel(struct net *net, __be16 port,
if (err < 0)
return ERR_PTR(err);
- tnl_cfg.encap_type = 1;
+ tnl_cfg.encap_type = UDP_ENCAP_RXE;
tnl_cfg.encap_rcv = rxe_udp_encap_recv;
/* Setup UDP tunnel */
@@ -2970,7 +2970,7 @@ static int amt_socket_create(struct amt_dev *amt)
/* Mark socket as an encapsulation socket */
memset(&tunnel_cfg, 0, sizeof(tunnel_cfg));
tunnel_cfg.sk_user_data = amt;
- tunnel_cfg.encap_type = 1;
+ tunnel_cfg.encap_type = UDP_ENCAP_AMT;
tunnel_cfg.encap_rcv = amt_rcv;
tunnel_cfg.encap_err_lookup = amt_err_lookup;
tunnel_cfg.encap_destroy = NULL;
@@ -248,7 +248,7 @@ static int bareudp_socket_create(struct bareudp_dev *bareudp, __be16 port)
/* Mark socket as an encapsulation socket */
memset(&tunnel_cfg, 0, sizeof(tunnel_cfg));
tunnel_cfg.sk_user_data = bareudp;
- tunnel_cfg.encap_type = 1;
+ tunnel_cfg.encap_type = UDP_ENCAP_BAREUDP;
tunnel_cfg.encap_rcv = bareudp_udp_encap_recv;
tunnel_cfg.encap_err_lookup = bareudp_err_lookup;
tunnel_cfg.encap_destroy = NULL;
@@ -611,7 +611,7 @@ static struct geneve_sock *geneve_socket_create(struct net *net, __be16 port,
/* Mark socket as an encapsulation socket */
memset(&tunnel_cfg, 0, sizeof(tunnel_cfg));
tunnel_cfg.sk_user_data = gs;
- tunnel_cfg.encap_type = 1;
+ tunnel_cfg.encap_type = UDP_ENCAP_GENEVE;
tunnel_cfg.gro_receive = geneve_gro_receive;
tunnel_cfg.gro_complete = geneve_gro_complete;
tunnel_cfg.encap_rcv = geneve_udp_encap_recv;
@@ -170,7 +170,7 @@ static struct socket *pfcp_create_sock(struct pfcp_dev *pfcp)
tuncfg.sk_user_data = pfcp;
tuncfg.encap_rcv = pfcp_encap_recv;
- tuncfg.encap_type = 1;
+ tuncfg.encap_type = UDP_ENCAP_PFCP;
setup_udp_tunnel_sock(net, sock, &tuncfg);
@@ -3572,7 +3572,8 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6,
/* Mark socket as an encapsulation socket. */
memset(&tunnel_cfg, 0, sizeof(tunnel_cfg));
tunnel_cfg.sk_user_data = vs;
- tunnel_cfg.encap_type = 1;
+ tunnel_cfg.encap_type = vs->flags & VXLAN_F_GPE ?
+ UDP_ENCAP_VXLAN_GPE : UDP_ENCAP_VXLAN;
tunnel_cfg.encap_rcv = vxlan_rcv;
tunnel_cfg.encap_err_lookup = vxlan_err_lookup;
tunnel_cfg.encap_destroy = NULL;
@@ -352,7 +352,7 @@ int wg_socket_init(struct wg_device *wg, u16 port)
int ret;
struct udp_tunnel_sock_cfg cfg = {
.sk_user_data = wg,
- .encap_type = 1,
+ .encap_type = UDP_ENCAP_WIREGUARD,
.encap_rcv = wg_receive
};
struct socket *new4 = NULL, *new6 = NULL;
@@ -578,19 +578,20 @@ static int fou_create(struct net *net, struct fou_cfg *cfg,
fou->sock = sock;
memset(&tunnel_cfg, 0, sizeof(tunnel_cfg));
- tunnel_cfg.encap_type = 1;
tunnel_cfg.sk_user_data = fou;
tunnel_cfg.encap_destroy = NULL;
/* Initial for fou type */
switch (cfg->type) {
case FOU_ENCAP_DIRECT:
+ tunnel_cfg.encap_type = UDP_ENCAP_FOU;
tunnel_cfg.encap_rcv = fou_udp_recv;
tunnel_cfg.gro_receive = fou_gro_receive;
tunnel_cfg.gro_complete = fou_gro_complete;
fou->protocol = cfg->protocol;
break;
case FOU_ENCAP_GUE:
+ tunnel_cfg.encap_type = UDP_ENCAP_GUE;
tunnel_cfg.encap_rcv = gue_udp_recv;
tunnel_cfg.gro_receive = gue_gro_receive;
tunnel_cfg.gro_complete = gue_gro_complete;
@@ -876,7 +876,7 @@ int sctp_udp_sock_start(struct net *net)
return err;
}
- tuncfg.encap_type = 1;
+ tuncfg.encap_type = UDP_ENCAP_SCTP;
tuncfg.encap_rcv = sctp_udp_rcv;
tuncfg.encap_err_lookup = sctp_udp_v4_err;
setup_udp_tunnel_sock(net, sock, &tuncfg);
@@ -771,7 +771,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
if (err)
goto err;
tuncfg.sk_user_data = ub;
- tuncfg.encap_type = 1;
+ tuncfg.encap_type = UDP_ENCAP_TIPC;
tuncfg.encap_rcv = tipc_udp_recv;
tuncfg.encap_destroy = NULL;
setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg);
Instead of just setting UDP tunnel config encap_type to 1, use the appropriate constat for the tunnel type. This value can be used to determine the encapsulated protocol in UDP by looking at the socket Signed-off-by: Tom Herbert <tom@herbertland.com> --- drivers/infiniband/sw/rxe/rxe_net.c | 2 +- drivers/net/amt.c | 2 +- drivers/net/bareudp.c | 2 +- drivers/net/geneve.c | 2 +- drivers/net/pfcp.c | 2 +- drivers/net/vxlan/vxlan_core.c | 3 ++- drivers/net/wireguard/socket.c | 2 +- net/ipv4/fou_core.c | 3 ++- net/sctp/protocol.c | 2 +- net/tipc/udp_media.c | 2 +- 10 files changed, 12 insertions(+), 10 deletions(-)