diff options
author | Harald Welte <laforge@gnumonks.org> | 2019-03-16 18:06:22 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2019-03-16 18:34:58 +0100 |
commit | 24e67f86dd5da3c36eae4476e50d630689612d87 (patch) | |
tree | 4ce47a721092437ca2494a6d5eaeaef6824a2936 /src/gb | |
parent | 94c9b449cfbafb610c1679cf733394f2df58f178 (diff) |
gprs_ns_sns: Use "correct" remote IP address for local IP endpoint
we cannot use "nsi->nsip.remote_ip", as this address is not set
when SNS is in use. We can only have a valid nsi->nsip.remote_ip
if there's only a single NS-VC inside the NS Instance, as this would
connect() the UDP socket to the remote IP/port, breaking any possibility
to have multiple NS-VCs to different SGNS-side IP addresses.
Closes: OS#3845
Change-Id: Ic094621eb01d7458063f531289d5eeadf52bf330
Diffstat (limited to 'src/gb')
-rw-r--r-- | src/gb/gprs_ns_sns.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gb/gprs_ns_sns.c b/src/gb/gprs_ns_sns.c index b0ee5d79..cbaa4685 100644 --- a/src/gb/gprs_ns_sns.c +++ b/src/gb/gprs_ns_sns.c @@ -657,8 +657,8 @@ struct osmo_fsm_inst *gprs_sns_bss_fsm_alloc(void *ctx, struct gprs_nsvc *nsvc, /* unspecified local address. Figure out which address the kernel would use if we * wanted to send a packet to the remote_ip */ char local_ip[32]; - struct in_addr in = { .s_addr = htonl(nsi->nsip.remote_ip) }; - osmo_sock_local_ip(local_ip, inet_ntoa(in)); + struct sockaddr_in *daddr = &nsvc->ip.bts_addr; + osmo_sock_local_ip(local_ip, inet_ntoa(daddr->sin_addr)); ip4->ip_addr = inet_addr(local_ip); } ip4->udp_port = htons(gss->nsi->nsip.local_port); |