gtp: initialize transmit sequence number

According to TS 09.60 (8.1.1.1), this has to be zero for the first T-PDU.
This commit is contained in:
Pablo Neira Ayuso 2014-02-11 03:16:12 +01:00
parent 5f59df2a24
commit 30d7dc1a0b
1 changed files with 2 additions and 1 deletions

3
gtp.c
View File

@ -415,7 +415,7 @@ gtp0_push_header(struct sk_buff *skb, struct pdp_ctx *pctx, int payload_len)
gtp0->flags = 0x1e; /* V0, GTP-non-prime */
gtp0->type = GTP_TPDU;
gtp0->length = htons(payload_len);
gtp0->seq = htons(atomic_inc_return(&pctx->tx_seq) % 0xffff);
gtp0->seq = htons((atomic_inc_return(&pctx->tx_seq)-1) % 0xffff);
gtp0->flow = htonl(pctx->flow);
gtp0->number = 0xFF;
gtp0->spare[0] = gtp0->spare[1] = gtp0->spare[2] = 0xFF;
@ -942,6 +942,7 @@ static int ipv4_pdp_add(struct gtp_instance *gti, struct genl_info *info)
pctx->tid = tid;
pctx->sgsn_addr.ip4.s_addr = sgsn_addr;
pctx->ms_addr.ip4.s_addr = ms_addr;
atomic_set(&pctx->tx_seq, 0);
hash_tid = ipv4_hashfn(tid) % gti->hash_size;