X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=datapath%2Fvport-gre.c;h=ab89c5b42df4d72ca812c9b5029fa6e2794707ae;hb=4b9f923273fb79079fcfa15350299b71a0062969;hp=4411cac93840effa31749ec61e6e0c0b51145568;hpb=850b6b3b9f8c38b42e315c2c07d232a33b82da3e;p=openvswitch diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c index 4411cac9..ab89c5b4 100644 --- a/datapath/vport-gre.c +++ b/datapath/vport-gre.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011 Nicira Networks. + * Copyright (c) 2007-2012 Nicira, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -29,6 +29,7 @@ #include #include +#include "datapath.h" #include "tunnel.h" #include "vport.h" #include "vport-generic.h" @@ -101,10 +102,11 @@ static struct sk_buff *gre_update_header(const struct vport *vport, - GRE_HEADER_SECTION); /* Work backwards over the options so the checksum is last. */ - if (mutable->flags & TNL_F_OUT_KEY_ACTION) { + if (mutable->flags & TNL_F_OUT_KEY_ACTION) *options = be64_get_low32(OVS_CB(skb)->tun_id); + + if (mutable->out_key || mutable->flags & TNL_F_OUT_KEY_ACTION) options--; - } if (mutable->flags & TNL_F_CSUM) *(__sum16 *)options = csum_fold(skb_checksum(skb, @@ -205,8 +207,8 @@ static void gre_err(struct sk_buff *skb, u32 info) if (tunnel_hdr_len < 0) return; - vport = ovs_tnl_find_port(iph->saddr, iph->daddr, key, TNL_T_PROTO_GRE, - &mutable); + vport = ovs_tnl_find_port(dev_net(skb->dev), iph->saddr, iph->daddr, key, + TNL_T_PROTO_GRE, &mutable); if (!vport) return; @@ -342,8 +344,8 @@ static int gre_rcv(struct sk_buff *skb) goto error; iph = ip_hdr(skb); - vport = ovs_tnl_find_port(iph->daddr, iph->saddr, key, TNL_T_PROTO_GRE, - &mutable); + vport = ovs_tnl_find_port(dev_net(skb->dev), iph->daddr, iph->saddr, key, + TNL_T_PROTO_GRE, &mutable); if (unlikely(!vport)) { icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); goto error; @@ -381,6 +383,9 @@ static struct vport *gre_create(const struct vport_parms *parms) static const struct net_protocol gre_protocol_handlers = { .handler = gre_rcv, .err_handler = gre_err, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) + .netns_ok = 1, +#endif }; static int gre_init(void)