Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Feb 2010 06:21:37 GMT
From:      Alexander Zagrebin <alexz@visp.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/144054: opnbgpd doesn't announce a host routes
Message-ID:  <201002180621.o1I6Lb5N025060@www.freebsd.org>
Resent-Message-ID: <201002180630.o1I6U1bB054810@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         144054
>Category:       ports
>Synopsis:       opnbgpd doesn't announce a host routes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 18 06:30:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Zagrebin
>Release:        7.1-RELEASE
>Organization:
>Environment:
FreeBSD xxx.visp.ru 7.1-RELEASE-p4 FreeBSD 7.1-RELEASE-p4 #0: Fri Dec 25 23:06:40 MSK 2009     root@xxx.visp.ru:/usr/src/sys/amd64/compile/KERNEL  amd64
>Description:
I have noticed that openbgpd (including the latest openbgpd-4.6.20100215) doesn't announce a host routes.
The reason is in fact that openbgpd doesn't interpret a host routes as "connected".

>How-To-Repeat:
Create point-to-point link:
# ifconfig tun0 create inet 1.2.3.4 5.6.7.8
or add host route
# route add 6.7.8.9 some_gateway

# netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
..
5.6.7.8            1.2.3.4            UH          0        0   tun0
6.7.8.9            x.y.z.t            UGHS        0        0 vlan20
..

Now use `bgpctl show rib`, `bgpctl show ip bgp out nei gw` etc to see that openbgpd doesn't "see" and doesn't announce a host routes
>Fix:
The attached patch solves the problem.

Patch attached with submission follows:

--- bgpd/kroute.c.orig	2009-12-26 09:03:41.000000000 +0300
+++ bgpd/kroute.c	2009-12-26 09:27:42.000000000 +0300
@@ -2255,8 +2255,10 @@
 					break;
 				kr->r.prefixlen =
 				    mask2prefixlen(sa_in->sin_addr.s_addr);
-			} else if (rtm->rtm_flags & RTF_HOST)
+			} else if (rtm->rtm_flags & RTF_HOST) {
 				kr->r.prefixlen = 32;
+				kr->r.flags |= F_CONNECTED;
+			}
 			else
 				kr->r.prefixlen =
 				    prefixlen_classful(kr->r.prefix.s_addr);
@@ -2293,8 +2295,10 @@
 				if (sa_in6->sin6_len == 0)
 					break;
 				kr6->r.prefixlen = mask2prefixlen6(sa_in6);
-			} else if (rtm->rtm_flags & RTF_HOST)
+			} else if (rtm->rtm_flags & RTF_HOST) {
 				kr6->r.prefixlen = 128;
+				kr->r.flags |= F_CONNECTED;
+			}
 			else
 				fatalx("INET6 route without netmask");
 			break;
@@ -2560,8 +2564,10 @@
 			if (sa_in->sin_len != 0)
 				prefixlen = mask2prefixlen(
 				    sa_in->sin_addr.s_addr);
-		} else if (rtm->rtm_flags & RTF_HOST)
+		} else if (rtm->rtm_flags & RTF_HOST) {
 			prefixlen = 32;
+			flags |= F_CONNECTED;
+		}
 		else
 			prefixlen =
 			    prefixlen_classful(prefix.v4.s_addr);
@@ -2573,8 +2579,10 @@
 		if (sa_in6 != NULL) {
 			if (sa_in6->sin6_len != 0)
 				prefixlen = mask2prefixlen6(sa_in6);
-		} else if (rtm->rtm_flags & RTF_HOST)
+		} else if (rtm->rtm_flags & RTF_HOST) {
 			prefixlen = 128;
+			kr->r.flags |= F_CONNECTED;
+		}
 		else
 			fatalx("in6 net addr without netmask");
 		break;


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002180621.o1I6Lb5N025060>