From: Alan T. DeKok Date: Fri, 11 Feb 2011 09:59:42 +0000 (+0100) Subject: gnore socket if address families don't match. Closes bug #143 X-Git-Tag: release_2_1_11~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=995b62f847b93ca217d35c1bbbbe8dcc5157635f;p=thirdparty%2Ffreeradius-server.git gnore socket if address families don't match. Closes bug #143 When allocating an Id for proxying, the code previously did not pay attention to address families. So if you have two home servers, on V4 only and one V6 only, it could use a local V4 proxy socket to connect to a V6 server, This doesn't work. --- diff --git a/src/lib/packet.c b/src/lib/packet.c index a000ae5f317..82d23d8ef37 100644 --- a/src/lib/packet.c +++ b/src/lib/packet.c @@ -657,7 +657,7 @@ int fr_packet_list_num_elements(fr_packet_list_t *pl) int fr_packet_list_id_alloc(fr_packet_list_t *pl, RADIUS_PACKET *request) { - int i, id, start, fd; + int i, id, start; int src_any = 0; uint32_t free_mask; fr_packet_dst2id_t my_pd, *pd; @@ -733,7 +733,6 @@ int fr_packet_list_id_alloc(fr_packet_list_t *pl, id = start = (int) fr_rand() & 0xff; while (pd->id[id] == pl->mask) { /* all sockets are using this ID */ - redo: id++; id &= 0xff; if (id == start) { @@ -750,6 +749,11 @@ int fr_packet_list_id_alloc(fr_packet_list_t *pl, ps = &(pl->sockets[i]); + /* + * Address families don't match, skip it. + */ + if (ps->ipaddr.af != request->dst_ipaddr.af) continue; + /* * We're sourcing from *, and they asked for a * specific source address: ignore it.