-/* $OpenBSD: bgpd.h,v 1.452 2022/08/31 15:51:44 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.453 2022/09/21 21:12:03 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
/* kroute.c */
int kr_init(int *, uint8_t);
+int kr_default_prio(void);
+int kr_check_prio(long long);
int ktable_update(u_int, char *, int);
void ktable_preload(void);
void ktable_postload(void);
-/* $OpenBSD: kroute.c,v 1.299 2022/09/15 08:20:14 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.300 2022/09/21 21:12:03 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
return (0);
}
+int
+kr_default_prio(void)
+{
+ return RTP_BGP;
+}
+
+int
+kr_check_prio(long long prio)
+{
+ if (prio <= RTP_LOCAL || prio > RTP_MAX)
+ return 0;
+ return 1;
+}
+
int
ktable_new(u_int rtableid, u_int rdomid, char *name, int fs)
{
-/* $OpenBSD: parse.y,v 1.435 2022/08/17 15:15:26 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.436 2022/09/21 21:12:04 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
TAILQ_INSERT_TAIL(conf->listen_addrs, la, entry);
}
| FIBPRIORITY NUMBER {
- if ($2 <= RTP_LOCAL || $2 > RTP_MAX) {
- yyerror("fib-priority %lld must be between "
- "%u and %u", $2, RTP_LOCAL + 1, RTP_MAX);
+ if (!kr_check_prio($2)) {
+ yyerror("fib-priority %lld out of range", $2);
YYERROR;
}
conf->fib_priority = $2;
}
| NETWORK family PRIORITY NUMBER filter_set {
struct network *n;
- if ($4 <= RTP_LOCAL && $4 > RTP_MAX) {
- yyerror("priority %lld must be between "
- "%u and %u", $4, RTP_LOCAL + 1, RTP_MAX);
+ if (!kr_check_prio($4)) {
+ yyerror("priority %lld out of range", $4);
YYERROR;
}
c->holdtime = INTERVAL_HOLD;
c->connectretry = INTERVAL_CONNECTRETRY;
c->bgpid = get_bgpid();
- c->fib_priority = RTP_BGP;
+ c->fib_priority = kr_default_prio();
c->default_tableid = getrtable();
if (!ktable_exists(c->default_tableid, &rdomid))
fatalx("current routing table %u does not exist",
-/* $OpenBSD: printconf.c,v 1.158 2022/08/17 09:15:06 claudio Exp $ */
+/* $OpenBSD: printconf.c,v 1.159 2022/09/21 21:12:04 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
printf("nexthop qualify via bgp\n");
if (conf->flags & BGPD_FLAG_NEXTHOP_DEFAULT)
printf("nexthop qualify via default\n");
- if (conf->fib_priority != RTP_BGP)
+ if (conf->fib_priority != kr_default_prio())
printf("fib-priority %hhu\n", conf->fib_priority);
printf("\n");
}