NS: don't memcmp sockaddr_in but compare ip and port individually

this seems to work more portably (ppc/32bit big endian)
This commit is contained in:
Harald Welte 2010-05-12 11:56:39 +00:00
parent c1402a68c5
commit 38407efdf8
1 changed files with 5 additions and 4 deletions

View File

@ -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;