summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2014-02-20 00:24:24 +0100
committerPablo Neira Ayuso <pablo@gnumonks.org>2014-02-20 00:24:24 +0100
commit972c2a20b021a3b1581f361d282e2f4e0c226689 (patch)
tree40ad6cf39f7600f9d8ca0c82885b0cea4a751c92
parent1fa0cd93f82dc95390c7d1c6dfca85d6729768cb (diff)
gtp: use GTP_V0 and GTP_V1 whenever possible
Just a cleanup.
-rw-r--r--gtp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gtp.c b/gtp.c
index 74cd4a4..017b129 100644
--- a/gtp.c
+++ b/gtp.c
@@ -231,7 +231,7 @@ static int gtp0_udp_encap_recv(struct gtp_instance *gti, struct sk_buff *skb)
gtp0 = (struct gtp0_header *)skb->data;
/* check for GTP Version 0 */
- if ((gtp0->flags >> 5) != 0)
+ if ((gtp0->flags >> 5) != GTP_V0)
goto out;
/* check if it is T-PDU. if not -> userspace */
@@ -684,10 +684,14 @@ static netdev_tx_t gtp_dev_xmit(struct sk_buff *skb, struct net_device *dev)
skb_reset_transport_header(skb);
uh = udp_hdr(skb);
- if (pktinfo.pctx->gtp_version == 0)
+ switch (pktinfo.pctx->gtp_version) {
+ case GTP_V0:
uh->source = uh->dest = htons(GTP0_PORT);
- else
+ break;
+ case GTP_V1:
uh->source = uh->dest = htons(GTP1U_PORT);
+ break;
+ }
uh->len = htons(sizeof(struct udphdr) + payload_len);
uh->check = 0;