gtp: fix missing family in pdp context

Add also some instrumentation, I'll remove it later on.
This commit is contained in:
Pablo Neira Ayuso 2014-01-24 00:33:26 +01:00
parent 2ccd6261d9
commit 1350e5f734
1 changed files with 5 additions and 0 deletions

5
gtp.c
View File

@ -193,6 +193,8 @@ static struct pdp_ctx *ipv4_pdp_find(struct gtp_instance *gti,
head = &gti->addr_hash[ipv4_hashfn(ms_addr) % gti->hash_size];
hlist_for_each_entry_rcu(pdp, head, hlist_addr) {
pr_info("af %u : pdp->ms %pI4 == ms %pI4\n",
pdp->af, &pdp->ms_addr.ip4, &ms_addr);
if (pdp->af == AF_INET && pdp->ms_addr.ip4 == ms_addr)
return pdp;
}
@ -860,11 +862,14 @@ static int ipv4_pdp_add(struct gtp_instance *gti, uint32_t version,
if (pctx == NULL)
return -ENOMEM;
pctx->af = AF_INET;
pctx->gtp_version = version;
pctx->tid = tid;
pctx->sgsn_addr.ip4 = sgsn_addr;
pctx->ms_addr.ip4 = ms_addr;
pr_info("added pdp %p\n", pctx);
hlist_add_head_rcu(&pctx->hlist_addr, &gti->addr_hash[hash_ms]);
hlist_add_head_rcu(&pctx->hlist_tid, &gti->tid_hash[hash_tid]);