/*
- * 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
#include <net/ip.h>
#include <net/protocol.h>
+#include "datapath.h"
#include "tunnel.h"
#include "vport.h"
#include "vport-generic.h"
- 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,
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;
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;
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)