]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
gnore socket if address families don't match. Closes bug #143
authorAlan T. DeKok <aland@freeradius.org>
Fri, 11 Feb 2011 09:59:42 +0000 (10:59 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 11 Feb 2011 09:59:42 +0000 (10:59 +0100)
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.

src/lib/packet.c

index a000ae5f3172e257b1fc345e63b7629dac4b1b12..82d23d8ef378387344334f83f2ffbd7205bae2a3 100644 (file)
@@ -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.