summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2014-03-18 18:09:09 +0100
committerPablo Neira Ayuso <pablo@gnumonks.org>2014-03-18 18:30:05 +0100
commit23ddc1f778abc7e4ae649003e0d0052859afd5a6 (patch)
tree125874eabcab52b38017786fb00c088bf5f92b79
parent2cbf0a14830ef97ed97a61da4d669c0be03f5ddb (diff)
gtp: fix incorrect UDP header length field
With this fix, osmo-sgsn doesn't ignore our tunneled packet anymore. It was complaining about incorrect packet length for received packets. And osmo-ggsn is working in my testbed :-).
-rw-r--r--gtp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gtp.c b/gtp.c
index 35d7e87..a9a546c 100644
--- a/gtp.c
+++ b/gtp.c
@@ -632,7 +632,7 @@ static netdev_tx_t gtp_dev_xmit(struct sk_buff *skb, struct net_device *dev)
unsigned int payload_len;
struct gtp_pktinfo pktinfo;
unsigned int proto = ntohs(skb->protocol);
- int err;
+ int gtph_len, err;
rcu_read_lock();
switch (proto) {
@@ -668,13 +668,15 @@ static netdev_tx_t gtp_dev_xmit(struct sk_buff *skb, struct net_device *dev)
switch (pktinfo.pctx->gtp_version) {
case GTP_V0:
uh->source = uh->dest = htons(GTP0_PORT);
+ gtph_len = sizeof(struct gtp0_header);
break;
case GTP_V1:
uh->source = uh->dest = htons(GTP1U_PORT);
+ gtph_len = sizeof(struct gtp1_header);
break;
}
- uh->len = htons(sizeof(struct udphdr) + payload_len);
+ uh->len = htons(sizeof(struct udphdr) + payload_len + gtph_len);
uh->check = 0;
pr_info("gtp -> UDP src: %u dst: %u (len %u)\n",