[PATCH 3/4] [gprs] Fix hardcoded IP addresses in GPRS UDP communication

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/OpenBSC@lists.osmocom.org/.

Harald Welte laforge at gnumonks.org
Fri Nov 20 12:56:56 UTC 2009


On Wed, Nov 18, 2009 at 11:40:10PM +0100, Sylvain Munaut wrote:
> From: Sylvain Munaut <tnt at 246tNt.com>
> 
> Note, there is still an ugly hack: We send packets to the
> first BTS we find and not the "right" one, mostly because
> I had no idea how to find the right one ...

ok, I think we should wait for a proper solution, rather than replacing one
hack with another one.

> @@ -346,6 +347,9 @@ struct gsm_bts {
>  		struct {
>  			u_int16_t site_id;
>  			u_int16_t bts_id;
> +
> +			struct in_addr ina_local;
> +			struct in_addr ina_remote;
>  		} ip_access;

this makes sense, sure.

> -	/* FIXME: patch our own IP address as SGSN IP */
> -	//nanobts_attr_nsvc0[10] = 
> +	/* patch our own IP address as SGSN IP */
> +	memcpy(&nanobts_attr_nsvc0[10], &bts->ip_access.ina_local, 4);

that, too.

> @@ -513,11 +527,19 @@ static int handle_gprs_write(struct bsc_fd *bfd)
>  
>  int ipac_gprs_send(struct msgb *msg)
>  {
> +	struct gsm_bts *bts;
>  	struct sockaddr_in sin;
>  	int rc;
>  
> +		/* FIXME: Just take the first ip.access bts we find */
> +	llist_for_each_entry(bts, &e1h->gsmnet->bts_list, list) {
> +		if (!is_ipaccess_bts(bts))
> +			continue;
> +		break;
> +	}
> +

msg->trx will be set, so you can simply dereference msg->trx->bts to get to the
bts to which this should be sent.

please change that, test it and resubmit.  Thanks!

-- 
- Harald Welte <laforge at gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)




More information about the OpenBSC mailing list