summaryrefslogtreecommitdiff
path: root/net/ipv4/netfilter/nf_nat_proto_gre.c
diff options
context:
space:
mode:
authorGao Feng <fgao@ikuai8.com>2016-08-25 15:08:47 (GMT)
committerPablo Neira Ayuso <pablo@netfilter.org>2016-09-07 08:36:52 (GMT)
commitc579a9e7d58f66030a144c7a33cc9bdf827a4b6d (patch)
tree6f39337e5813c1cea79cb3317225b7bb03465a71 /net/ipv4/netfilter/nf_nat_proto_gre.c
parentecc6569f3503b39f45bc6b86197b5e0a8533fb72 (diff)
downloadlinux-c579a9e7d58f66030a144c7a33cc9bdf827a4b6d.tar.xz
netfilter: gre: Use consistent GRE and PTTP header structure instead of the ones defined by netfilter
There are two existing strutures which defines the GRE and PPTP header. So use these two structures instead of the ones defined by netfilter to keep consitent with other codes. Signed-off-by: Gao Feng <fgao@ikuai8.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv4/netfilter/nf_nat_proto_gre.c')
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_gre.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/ipv4/netfilter/nf_nat_proto_gre.c b/net/ipv4/netfilter/nf_nat_proto_gre.c
index 93198d7..edf0500 100644
--- a/net/ipv4/netfilter/nf_nat_proto_gre.c
+++ b/net/ipv4/netfilter/nf_nat_proto_gre.c
@@ -88,8 +88,8 @@ gre_manip_pkt(struct sk_buff *skb,
const struct nf_conntrack_tuple *tuple,
enum nf_nat_manip_type maniptype)
{
- const struct gre_hdr *greh;
- struct gre_hdr_pptp *pgreh;
+ const struct gre_base_hdr *greh;
+ struct pptp_gre_header *pgreh;
/* pgreh includes two optional 32bit fields which are not required
* to be there. That's where the magic '8' comes from */
@@ -97,18 +97,19 @@ gre_manip_pkt(struct sk_buff *skb,
return false;
greh = (void *)skb->data + hdroff;
- pgreh = (struct gre_hdr_pptp *)greh;
+ pgreh = (struct pptp_gre_header *)greh;
/* we only have destination manip of a packet, since 'source key'
* is not present in the packet itself */
if (maniptype != NF_NAT_MANIP_DST)
return true;
- switch (greh->version) {
- case ntohs(GRE_VERSION_0):
+
+ switch (greh->flags & GRE_VERSION) {
+ case GRE_VERSION_0:
/* We do not currently NAT any GREv0 packets.
* Try to behave like "nf_nat_proto_unknown" */
break;
- case ntohs(GRE_VERSION_1):
+ case GRE_VERSION_1:
pr_debug("call_id -> 0x%04x\n", ntohs(tuple->dst.u.gre.key));
pgreh->call_id = tuple->dst.u.gre.key;
break;