diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-05-12 11:56:39 +0000 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-05-12 18:28:00 +0200 |
commit | 38407efdf88992e11c06659eb3f15d3142e1726f (patch) | |
tree | 9d552f70d4d3c4601c04cd2173e6cba85448f379 | |
parent | c1402a68c55ea8c30b2aa9db7ae16e5df0820948 (diff) |
NS: don't memcmp sockaddr_in but compare ip and port individually
this seems to work more portably (ppc/32bit big endian)
-rw-r--r-- | openbsc/src/gprs/gprs_ns.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/openbsc/src/gprs/gprs_ns.c b/openbsc/src/gprs/gprs_ns.c index 9cb33005..a166956b 100644 --- a/openbsc/src/gprs/gprs_ns.c +++ b/openbsc/src/gprs/gprs_ns.c @@ -104,7 +104,9 @@ static struct gprs_nsvc *nsvc_by_rem_addr(struct gprs_ns_inst *nsi, { struct gprs_nsvc *nsvc; llist_for_each_entry(nsvc, &nsi->gprs_nsvcs, list) { - if (!memcmp(&nsvc->ip.bts_addr, sin, sizeof(*sin))) + if (nsvc->ip.bts_addr.sin_addr.s_addr == + sin->sin_addr.s_addr && + nsvc->ip.bts_addr.sin_port == sin->sin_port) return nsvc; } return NULL; @@ -764,10 +766,9 @@ struct gprs_nsvc *nsip_connect(struct gprs_ns_inst *nsi, struct gprs_nsvc *nsvc; nsvc = nsvc_by_rem_addr(nsi, dest); - if (!nsvc) { + if (!nsvc) nsvc = nsvc_create(nsi, nsvci); - nsvc->ip.bts_addr = *dest; - } + nsvc->ip.bts_addr = *dest; nsvc->nsei = nsei; nsvc->nsvci = nsvci; nsvc->remote_end_is_sgsn = 1; |