summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ripd/parse.y
diff options
context:
space:
mode:
authorremi <remi@openbsd.org>2018-12-31 20:34:16 +0000
committerremi <remi@openbsd.org>2018-12-31 20:34:16 +0000
commit1acb5c27eafb3266b644f895f020ae367c3af9eb (patch)
treefca3e8e60fadb38db4f69014ae604c22498ed93b /usr.sbin/ripd/parse.y
parentnanosleep: loop tsleep(9) to ensure coverage of the full timeout range. (diff)
downloadwireguard-openbsd-1acb5c27eafb3266b644f895f020ae367c3af9eb.tar.xz
wireguard-openbsd-1acb5c27eafb3266b644f895f020ae367c3af9eb.zip
Add config option fib-priority to set a custom prio for routes ripd
insers into the kernel routing table. OK deraadt@
Diffstat (limited to 'usr.sbin/ripd/parse.y')
-rw-r--r--usr.sbin/ripd/parse.y15
1 files changed, 13 insertions, 2 deletions
diff --git a/usr.sbin/ripd/parse.y b/usr.sbin/ripd/parse.y
index f77493a88f6..4f8283f58ae 100644
--- a/usr.sbin/ripd/parse.y
+++ b/usr.sbin/ripd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.44 2018/11/11 13:55:07 remi Exp $ */
+/* $OpenBSD: parse.y,v 1.45 2018/12/31 20:34:16 remi Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <net/route.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ctype.h>
@@ -104,7 +105,8 @@ typedef struct {
%}
-%token SPLIT_HORIZON TRIGGERED_UPDATES FIBUPDATE REDISTRIBUTE RDOMAIN
+%token SPLIT_HORIZON TRIGGERED_UPDATES FIBPRIORITY FIBUPDATE
+%token REDISTRIBUTE RDOMAIN
%token AUTHKEY AUTHTYPE AUTHMD AUTHMDKEYID
%token INTERFACE RTLABEL
%token COST PASSIVE
@@ -196,6 +198,13 @@ conf_main : SPLIT_HORIZON STRING {
}
conf->rdomain = $2;
}
+ | FIBPRIORITY NUMBER {
+ if ($2 <= RTP_NONE || $2 > RTP_MAX) {
+ yyerror("invalid fib-priority");
+ YYERROR;
+ }
+ conf->fib_priority = $2;
+ }
| FIBUPDATE yesno {
if ($2 == 0)
conf->flags |= RIPD_FLAG_NO_FIB_UPDATE;
@@ -423,6 +432,7 @@ lookup(char *s)
{"auth-type", AUTHTYPE},
{"cost", COST},
{"demote", DEMOTE},
+ {"fib-priority", FIBPRIORITY},
{"fib-update", FIBUPDATE},
{"interface", INTERFACE},
{"no", NO},
@@ -771,6 +781,7 @@ parse_config(char *filename, int opts)
defs->auth_type = AUTH_NONE;
conf->opts = opts;
conf->options = OPT_SPLIT_POISONED;
+ conf->fib_priority = RTP_RIP;
SIMPLEQ_INIT(&conf->redist_list);
if ((file = pushfile(filename, !(conf->opts & RIPD_OPT_NOACTION))) == NULL) {