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 :-).
This commit is contained in:
Pablo Neira Ayuso 2014-03-18 18:09:09 +01:00
parent 2cbf0a1483
commit 23ddc1f778
1 changed files with 4 additions and 2 deletions

6
gtp.c
View File

@ -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",