]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
ignore old clients if their prefix is too small
authorAlan T. DeKok <aland@freeradius.org>
Fri, 5 Jan 2018 15:26:37 +0000 (10:26 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 5 Jan 2018 15:26:37 +0000 (10:26 -0500)
fr_trie_lookup() returns the longest prefix match.
Which still might be smaller than the prefix of the client
we're trying to add.

src/main/client.c

index d3a989612134fd07b545d57fb03076b75db93be5..3893fc814393f14d6fd964a0d5fe1407df62fee7 100644 (file)
@@ -203,7 +203,7 @@ bool client_add(RADCLIENT_LIST *clients, RADCLIENT *client)
         *      Cannot insert the same client twice.
         */
        old = fr_trie_lookup(trie, &client->ipaddr.addr, client->ipaddr.prefix);
-       if (old) {
+       if (old && (old->ipaddr.prefix >= client->ipaddr.prefix)) {
                /*
                 *      If it's a complete duplicate, then free the new
                 *      one, and return "OK".