-.\" $OpenBSD: bgpd.conf.5,v 1.170 2018/07/05 19:51:35 jmc Exp $
+.\" $OpenBSD: bgpd.conf.5,v 1.171 2018/07/11 14:08:46 benno Exp $
.\"
.\" Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
.\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: July 5 2018 $
+.Dd $Mdocdate: July 11 2018 $
.Dt BGPD.CONF 5
.Os
.Sh NAME
.Pq Ic inet Ns | Ns Ic inet6
.Ic rtlabel Ar label Op Ic set ...\&
.Xc
+.It Xo
+.Ic network
+.Pq Ic inet Ns | Ns Ic inet6
+.Ic priority Ar number Op Ic set ...\&
+.Xc
.\" NOT IMPLEMENTED. DO WE WANT THIS?
.\" .It Xo
.\" .Ic network prefix-set
routes with the specified
.Ar label
will be announced.
+If set to
+.Ic priority ,
+routes with the specified
+.Ar priority
+will be announced.
.Bd -literal -offset indent
network 192.168.7.0/24
.Ed
-/* $OpenBSD: parse.y,v 1.327 2018/07/10 12:40:41 benno Exp $ */
+/* $OpenBSD: parse.y,v 1.328 2018/07/11 14:08:46 benno Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
%token COMMUNITY EXTCOMMUNITY LARGECOMMUNITY
%token PREFIX PREFIXLEN PREFIXSET SOURCEAS TRANSITAS PEERAS DELETE MAXASLEN
%token MAXASSEQ SET LOCALPREF MED METRIC NEXTHOP REJECT BLACKHOLE NOMODIFY SELF
-%token PREPEND_SELF PREPEND_PEER PFTABLE WEIGHT RTLABEL ORIGIN
+%token PREPEND_SELF PREPEND_PEER PFTABLE WEIGHT RTLABEL ORIGIN PRIORITY
%token ERROR INCLUDE
%token IPSEC ESP AH SPI IKE
%token IPV4 IPV6
TAILQ_INSERT_TAIL(netconf, n, entry);
}
+ | NETWORK family PRIORITY NUMBER filter_set {
+ struct network *n;
+ if ($4 < RTP_LOCAL && $4 > RTP_MAX) {
+ yyerror("priority %lld > max %d or < min %d", $4,
+ RTP_MAX, RTP_LOCAL);
+ YYERROR;
+ }
+
+ if ((n = calloc(1, sizeof(struct network))) == NULL)
+ fatal("new_network");
+ if (afi2aid($2, SAFI_UNICAST, &n->net.prefix.aid) ==
+ -1) {
+ yyerror("unknown family");
+ filterset_free($5);
+ free($5);
+ YYERROR;
+ }
+ n->net.type = NETWORK_PRIORITY;
+ n->net.priority = $4;
+ filterset_move($5, &n->net.attrset);
+ free($5);
+
+ TAILQ_INSERT_TAIL(netconf, n, entry);
+ }
| NETWORK family nettype filter_set {
struct network *n;
{ "prefixlen", PREFIXLEN},
{ "prepend-neighbor", PREPEND_PEER},
{ "prepend-self", PREPEND_SELF},
+ { "priority", PRIORITY},
{ "qualify", QUALIFY},
{ "quick", QUICK},
{ "rd", RD},
struct sym *sym, *next;
struct peer *p, *pnext;
struct rde_rib *rr;
+ struct network *n;
int errors = 0;
conf = new_config();
errors = file->errors;
popfile();
+ /* check that we dont try to announce our own routes */
+ TAILQ_FOREACH(n, netconf, entry)
+ if (n->net.priority == conf->fib_priority) {
+ errors++;
+ logit(LOG_CRIT, "network priority %d == fib-priority "
+ "%d is not allowed.",
+ n->net.priority, conf->fib_priority);
+ }
+
/* Free macros and check which have not been used. */
TAILQ_FOREACH_SAFE(sym, &symhead, entry, next) {
if ((cmd_opts & BGPD_OPT_VERBOSE2) && !sym->used)
-/* $OpenBSD: printconf.c,v 1.108 2018/06/13 09:33:51 claudio Exp $ */
+/* $OpenBSD: printconf.c,v 1.109 2018/07/11 14:08:46 benno Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
printf("%snetwork %s rtlabel \"%s\"", c,
print_af(n->prefix.aid), rtlabel_id2name(n->rtlabel));
break;
+ case NETWORK_PRIORITY:
+ printf("%snetwork %s priority %d", c,
+ print_af(n->prefix.aid), n->priority);
+ break;
default:
printf("%snetwork %s/%u", c, log_addr(&n->prefix),
n->prefixlen);