From dc7f62ffa9e2b26d84a46bc3354816e9e7bd66ab Mon Sep 17 00:00:00 2001 From: david Date: Wed, 8 Jun 2011 05:15:20 +0000 Subject: [PATCH] Continue to consider a target directly connected if its gateway is equal to its own address. --- libnetutil/netutil.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index c9b7c5b4f..0ca6c3dce 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -2966,9 +2966,11 @@ static int route_dst_netlink(const struct sockaddr_storage *dst, for ( ; RTA_OK(rtattr, len); rtattr = RTA_NEXT(rtattr, len)) { if (rtattr->rta_type == RTA_GATEWAY) { - rnfo->direct_connect = 0; rc = set_sockaddr(&rnfo->nexthop, rtmsg->rtm_family, RTA_DATA(rtattr)); assert(rc != -1); + /* Don't consider it directly connected if nexthop == dst. */ + if (!sockaddr_storage_equal(dst, &rnfo->nexthop)) + rnfo->direct_connect = 0; } else if (rtattr->rta_type == RTA_OIF && ii == NULL) { char namebuf[32]; int intf_index;