kernel-pfroute: Let get_nexthop() default to destination address
authorTobias Brunner <tobias@strongswan.org>
Tue, 11 Mar 2014 14:19:33 +0000 (15:19 +0100)
committerTobias Brunner <tobias@strongswan.org>
Mon, 31 Mar 2014 12:32:44 +0000 (14:32 +0200)
src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c

index a8a57a5..63c38bb 100644 (file)
@@ -1576,16 +1576,20 @@ retry:
                }
                DBG1(DBG_KNL, "PF_ROUTE lookup failed: %s", strerror(errno));
        }
-       if (!host)
+       if (nexthop)
        {
-               return NULL;
+               host = host ?: dest->clone(dest);
        }
-       if (!nexthop)
+       else
        {       /* make sure the source address is not virtual and usable */
                addr_entry_t *entry, lookup = {
                        .ip = host,
                };
 
+               if (!host)
+               {
+                       return NULL;
+               }
                this->lock->read_lock(this->lock);
                entry = this->addrs->get_match(this->addrs, &lookup,
                                                                        (void*)addr_map_entry_match_up_and_usable);