diff options
author | Jan Maria Matejka <mq@ucw.cz> | 2017-12-13 10:29:10 +0100 |
---|---|---|
committer | Jan Maria Matejka <mq@ucw.cz> | 2017-12-13 10:29:10 +0100 |
commit | cb21c5ffa92494b1a4bf110605509de3326b6c3d (patch) | |
tree | bd1c37b57c1d1aa45efecf4868ddf7d3ff27c489 /sysdep/bsd | |
parent | 71c51aa4ab0daa3490f9a488f505eb25102c4705 (diff) | |
parent | 1e11918c8c56e3505193f4e6426c1a34aaae3941 (diff) |
Merge branch 'int-new' of gitlab.labs.nic.cz:labs/bird into int-new
Diffstat (limited to 'sysdep/bsd')
-rw-r--r-- | sysdep/bsd/krt-sock.Y | 4 | ||||
-rw-r--r-- | sysdep/bsd/krt-sock.c | 10 | ||||
-rw-r--r-- | sysdep/bsd/krt-sys.h | 2 |
3 files changed, 10 insertions, 6 deletions
diff --git a/sysdep/bsd/krt-sock.Y b/sysdep/bsd/krt-sock.Y index 0218f188..81422c79 100644 --- a/sysdep/bsd/krt-sock.Y +++ b/sysdep/bsd/krt-sock.Y @@ -20,8 +20,8 @@ kern_sys_item: KERNEL TABLE expr { if ($3 && (krt_max_tables == 1)) cf_error("Multiple kernel routing tables not supported"); - if ($3 < 0 || $3 >= krt_max_tables) - cf_error("Kernel table id must be in range 0-%d", krt_max_tables - 1); + if ($3 >= krt_max_tables) + cf_error("Kernel table id must be in range 0-%u", krt_max_tables - 1); THIS_KRT->sys.table_id = $3; } diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index 604cd510..0a52cfbd 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -74,11 +74,11 @@ const int rt_default_ecmp = 0; /* Dynamic max number of tables */ -int krt_max_tables; +uint krt_max_tables; #ifdef KRT_USE_SYSCTL_NET_FIBS -static int +static uint krt_get_max_tables(void) { int fibs; @@ -90,7 +90,11 @@ krt_get_max_tables(void) return 1; } - return MIN(fibs, KRT_MAX_TABLES); + /* Should not happen */ + if (fibs < 1) + return 1; + + return (uint) MIN(fibs, KRT_MAX_TABLES); } #else diff --git a/sysdep/bsd/krt-sys.h b/sysdep/bsd/krt-sys.h index ed667e80..aa6cc72e 100644 --- a/sysdep/bsd/krt-sys.h +++ b/sysdep/bsd/krt-sys.h @@ -31,7 +31,7 @@ static inline void kif_sys_copy_config(struct kif_config *d UNUSED, struct kif_c /* Kernel routes */ -extern int krt_max_tables; +extern uint krt_max_tables; struct krt_params { int table_id; /* Kernel table ID we sync with */ |