Hi Sylvain,
On Fri, Nov 20, 2009 at 03:11:33PM +0100, Sylvain Munaut wrote:
/* 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.
That was my first thought. But it's not set (or at least not always), leading to a seg fault when I tried that. For examples packets send with gprs_ns_tx_simple don't have it set. And I didn't see any clean way to get it from where those were generated.
ok, we need to fix those. I understand that the NS layer does not know yet which BTS has sent it. That's what the ns_link structure was intended for.
However, what makes probably even more sense is to identify the BTS based on its source IP address in the input/ipaccess.c code. So for every packet we receive, we iterate over all BTS's and compare the source IP address. If we have a match, we assign msg->trx = bts->c0 and all higher layers have that knowledge and can use it.
Regards,