Change in libosmocore[master]: gprs_ns_sns: Use "correct" remote IP address for local IP endpoint

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Mar 16 17:09:12 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/13293


Change subject: gprs_ns_sns: Use "correct" remote IP address for local IP endpoint
......................................................................

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.

Change-Id: Ic094621eb01d7458063f531289d5eeadf52bf330
---
M src/gb/gprs_ns_sns.c
1 file changed, 2 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/93/13293/1

diff --git a/src/gb/gprs_ns_sns.c b/src/gb/gprs_ns_sns.c
index b0ee5d7..cbaa468 100644
--- a/src/gb/gprs_ns_sns.c
+++ b/src/gb/gprs_ns_sns.c
@@ -657,8 +657,8 @@
 		/* 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);

-- 
To view, visit https://gerrit.osmocom.org/13293
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic094621eb01d7458063f531289d5eeadf52bf330
Gerrit-Change-Number: 13293
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190316/c4e4dc09/attachment.htm>


More information about the gerrit-log mailing list