aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/vport-geneve.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/openvswitch/vport-geneve.c')
-rw-r--r--net/openvswitch/vport-geneve.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/net/openvswitch/vport-geneve.c b/net/openvswitch/vport-geneve.c
index 70c9765011f4..e31f19c922e2 100644
--- a/net/openvswitch/vport-geneve.c
+++ b/net/openvswitch/vport-geneve.c
@@ -97,7 +97,9 @@ static void geneve_rcv(struct geneve_sock *gs, struct sk_buff *skb)
97 97
98 key = vni_to_tunnel_id(geneveh->vni); 98 key = vni_to_tunnel_id(geneveh->vni);
99 99
100 ovs_flow_tun_info_init(&tun_info, ip_hdr(skb), key, flags, 100 ovs_flow_tun_info_init(&tun_info, ip_hdr(skb),
101 udp_hdr(skb)->source, udp_hdr(skb)->dest,
102 key, flags,
101 geneveh->options, opts_len); 103 geneveh->options, opts_len);
102 104
103 ovs_vport_receive(vport, skb, &tun_info); 105 ovs_vport_receive(vport, skb, &tun_info);
@@ -228,6 +230,22 @@ static const char *geneve_get_name(const struct vport *vport)
228 return geneve_port->name; 230 return geneve_port->name;
229} 231}
230 232
233static int geneve_get_egress_tun_info(struct vport *vport, struct sk_buff *skb,
234 struct ovs_tunnel_info *egress_tun_info)
235{
236 struct geneve_port *geneve_port = geneve_vport(vport);
237 struct net *net = ovs_dp_get_net(vport->dp);
238 __be16 dport = inet_sk(geneve_port->gs->sock->sk)->inet_sport;
239 __be16 sport = udp_flow_src_port(net, skb, 1, USHRT_MAX, true);
240
241 /* Get tp_src and tp_dst, refert to geneve_build_header().
242 */
243 return ovs_tunnel_get_egress_info(egress_tun_info,
244 ovs_dp_get_net(vport->dp),
245 OVS_CB(skb)->egress_tun_info,
246 IPPROTO_UDP, skb->mark, sport, dport);
247}
248
231static struct vport_ops ovs_geneve_vport_ops = { 249static struct vport_ops ovs_geneve_vport_ops = {
232 .type = OVS_VPORT_TYPE_GENEVE, 250 .type = OVS_VPORT_TYPE_GENEVE,
233 .create = geneve_tnl_create, 251 .create = geneve_tnl_create,
@@ -236,6 +254,7 @@ static struct vport_ops ovs_geneve_vport_ops = {
236 .get_options = geneve_get_options, 254 .get_options = geneve_get_options,
237 .send = geneve_tnl_send, 255 .send = geneve_tnl_send,
238 .owner = THIS_MODULE, 256 .owner = THIS_MODULE,
257 .get_egress_tun_info = geneve_get_egress_tun_info,
239}; 258};
240 259
241static int __init ovs_geneve_tnl_init(void) 260static int __init ovs_geneve_tnl_init(void)