* Falk Brockerhoff <[EMAIL PROTECTED]> [2006-03-29 12:38]:
> Hello,
>
> I'm just playing around with OpenBGP on OpenBSD3.8. My BGP Session
> comes up, MD5 works fine. OpenBGP is a intuitiv tool and works fine. :)
>
> But I didn't find any documentation for migrating some parts of my
> cisco config to openbgpd. I configured internal BGP between my core-
> router and an openbgp border-router. The session comes up and
> openbgpd receives all my prefixes from the core-router, multiple /32
> addresses, some /29-networks and so on. But I want only to be
> specified networks announced to my external bgp-neighbor. On my Cisco
> border-router I done this with an "aggregate-address 192.168.0.0
> 255.255.255.0"-Statement.
>
> I take a look on the documentation, searched the source-code for
> anything spelled like aggregate or something like this, but I wasn't
> lucky. The network-Statement isn't doing aggregating, is it?
njet. we don't have any aggregate code, and you're the first one ever
to ask :)
> The second problem is, that I want to announce an external full-feed,
> received with openbgpd, to my core-router. This works fine, but the
> next-hop is the ip-adress of my external bgp-neighbor. But it should
> be the ip-address of the border-router.
of course! you should have an IBGP that makes your other routes have a
route to that... like OpenOSPFD :)
> On Cisco I configured
> "neighbor 10.0.0.2 next-hop-self", but how to do this with openbgp?
that, again, is sth nobody ever asked for or missed :)
however, the (completely untested except for compilation) diff below
should add "set nexthop self".
Index: bgpd.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v
retrieving revision 1.195
diff -u -p -r1.195 bgpd.h
--- bgpd.h 22 Mar 2006 13:30:35 -0000 1.195
+++ bgpd.h 29 Mar 2006 12:08:44 -0000
@@ -598,6 +598,7 @@ enum action_types {
ACTION_SET_NEXTHOP_REJECT,
ACTION_SET_NEXTHOP_BLACKHOLE,
ACTION_SET_NEXTHOP_NOMODIFY,
+ ACTION_SET_NEXTHOP_SELF,
ACTION_SET_COMMUNITY,
ACTION_DEL_COMMUNITY,
ACTION_PFTABLE,
Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
retrieving revision 1.184
diff -u -p -r1.184 parse.y
--- parse.y 22 Mar 2006 13:30:35 -0000 1.184
+++ parse.y 29 Mar 2006 12:08:44 -0000
@@ -159,7 +159,7 @@ typedef struct {
%token FROM TO ANY
%token CONNECTED STATIC
%token PREFIX PREFIXLEN SOURCEAS TRANSITAS COMMUNITY DELETE
-%token SET LOCALPREF MED METRIC NEXTHOP REJECT BLACKHOLE NOMODIFY
+%token SET LOCALPREF MED METRIC NEXTHOP REJECT BLACKHOLE NOMODIFY SELF
%token PREPEND_SELF PREPEND_PEER PFTABLE WEIGHT RTLABEL
%token ERROR
%token IPSEC ESP AH SPI IKE
@@ -1386,6 +1386,11 @@ filter_set_opt : LOCALPREF number {
fatal(NULL);
$$->type = ACTION_SET_NEXTHOP_NOMODIFY;
}
+ | NEXTHOP SELF {
+ if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
+ fatal(NULL);
+ $$->type = ACTION_SET_NEXTHOP_SELF;
+ }
| PREPEND_SELF number {
if (($$ = calloc(1, sizeof(struct filter_set))) == NULL)
fatal(NULL);
@@ -1599,6 +1604,7 @@ lookup(char *s)
{ "route-reflector", REFLECTOR},
{ "router-id", ROUTERID},
{ "rtlabel", RTLABEL},
+ { "self", SELF},
{ "set", SET},
{ "softreconfig", SOFTRECONFIG},
{ "source-as", SOURCEAS},
@@ -2505,6 +2511,7 @@ get_rule(enum action_types type)
switch (type) {
case ACTION_SET_PREPEND_SELF:
case ACTION_SET_NEXTHOP_NOMODIFY:
+ case ACTION_SET_NEXTHOP_SELF:
out = 1;
break;
default:
Index: printconf.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/printconf.c,v
retrieving revision 1.54
diff -u -p -r1.54 printconf.c
--- printconf.c 22 Mar 2006 13:30:35 -0000 1.54
+++ printconf.c 29 Mar 2006 12:08:45 -0000
@@ -114,6 +114,9 @@ print_set(struct filter_set_head *set)
case ACTION_SET_NEXTHOP_NOMODIFY:
printf("nexthop no-modify ");
break;
+ case ACTION_SET_NEXTHOP_SELF:
+ printf("nexthop self ");
+ break;
case ACTION_SET_PREPEND_SELF:
printf("prepend-self %u ", s->action.prepend);
break;
Index: rde.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.h,v
retrieving revision 1.90
diff -u -p -r1.90 rde.h
--- rde.h 22 Mar 2006 10:18:49 -0000 1.90
+++ rde.h 29 Mar 2006 12:08:45 -0000
@@ -150,9 +150,10 @@ LIST_HEAD(prefix_head, prefix);
#define F_NEXTHOP_REJECT 0x0200
#define F_NEXTHOP_BLACKHOLE 0x0400
#define F_NEXTHOP_NOMODIFY 0x0800
-#define F_ATTR_LINKED 0x1000
-#define F_LOCAL 0x2000 /* Local-RIB */
-#define F_ORIGINAL 0x4000 /* Adj-RIB-In */
+#define F_NEXTHOP_SELF 0x1000
+#define F_ATTR_LINKED 0x2000
+#define F_LOCAL 0x4000 /* Local-RIB */
+#define F_ORIGINAL 0x8000 /* Adj-RIB-In */
#define ORIGIN_IGP 0
Index: rde_filter.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_filter.c,v
retrieving revision 1.46
diff -u -p -r1.46 rde_filter.c
--- rde_filter.c 9 Feb 2006 21:05:09 -0000 1.46
+++ rde_filter.c 29 Mar 2006 12:08:45 -0000
@@ -160,6 +160,7 @@ rde_apply_set(struct rde_aspath *asp, st
case ACTION_SET_NEXTHOP_REJECT:
case ACTION_SET_NEXTHOP_BLACKHOLE:
case ACTION_SET_NEXTHOP_NOMODIFY:
+ case ACTION_SET_NEXTHOP_SELF:
nexthop_modify(asp, &set->action.nexthop, set->type,
af);
break;
@@ -512,6 +513,7 @@ filterset_equal(struct filter_set_head *
case ACTION_SET_NEXTHOP_BLACKHOLE:
case ACTION_SET_NEXTHOP_REJECT:
case ACTION_SET_NEXTHOP_NOMODIFY:
+ case ACTION_SET_NEXTHOP_SELF:
if (a->type == b->type)
continue;
break;
Index: rde_rib.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_rib.c,v
retrieving revision 1.84
diff -u -p -r1.84 rde_rib.c
--- rde_rib.c 15 Mar 2006 15:37:40 -0000 1.84
+++ rde_rib.c 29 Mar 2006 12:08:45 -0000
@@ -880,6 +880,10 @@ nexthop_modify(struct rde_aspath *asp, s
asp->flags |= F_NEXTHOP_NOMODIFY;
return;
}
+ if (type == ACTION_SET_NEXTHOP_SELF) {
+ asp->flags |= F_NEXTHOP_SELF;
+ return;
+ }
if (af != nexthop->af)
return;
Index: rde_update.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_update.c,v
retrieving revision 1.49
diff -u -p -r1.49 rde_update.c
--- rde_update.c 13 Jan 2006 13:04:33 -0000 1.49
+++ rde_update.c 29 Mar 2006 12:08:45 -0000
@@ -513,7 +513,9 @@ up_get_nexthop(struct rde_peer *peer, st
return (peer->local_v4_addr.v4.s_addr);
else
return (a->nexthop->exit_nexthop.v4.s_addr);
- } else if (!peer->conf.ebgp) {
+ } else if (a->flags & F_NEXTHOP_SELF)
+ return (peer->local_v4_addr.v4.s_addr);
+ else if (!peer->conf.ebgp) {
/*
* If directly connected use peer->local_v4_addr
* this is only true for announced networks.
--
BS Web Services, http://www.bsws.de/
OpenBSD-based Webhosting, Mail Services, Managed Servers, ...
Unix is very simple, but it takes a genius to understand the simplicity.
(Dennis Ritchie)