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:
parent
2cbf0a1483
commit
23ddc1f778
6
gtp.c
6
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;
|
unsigned int payload_len;
|
||||||
struct gtp_pktinfo pktinfo;
|
struct gtp_pktinfo pktinfo;
|
||||||
unsigned int proto = ntohs(skb->protocol);
|
unsigned int proto = ntohs(skb->protocol);
|
||||||
int err;
|
int gtph_len, err;
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
switch (proto) {
|
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) {
|
switch (pktinfo.pctx->gtp_version) {
|
||||||
case GTP_V0:
|
case GTP_V0:
|
||||||
uh->source = uh->dest = htons(GTP0_PORT);
|
uh->source = uh->dest = htons(GTP0_PORT);
|
||||||
|
gtph_len = sizeof(struct gtp0_header);
|
||||||
break;
|
break;
|
||||||
case GTP_V1:
|
case GTP_V1:
|
||||||
uh->source = uh->dest = htons(GTP1U_PORT);
|
uh->source = uh->dest = htons(GTP1U_PORT);
|
||||||
|
gtph_len = sizeof(struct gtp1_header);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uh->len = htons(sizeof(struct udphdr) + payload_len);
|
uh->len = htons(sizeof(struct udphdr) + payload_len + gtph_len);
|
||||||
uh->check = 0;
|
uh->check = 0;
|
||||||
|
|
||||||
pr_info("gtp -> UDP src: %u dst: %u (len %u)\n",
|
pr_info("gtp -> UDP src: %u dst: %u (len %u)\n",
|
||||||
|
|
Loading…
Reference in New Issue