]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fix some minor issues
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 12 Dec 2017 14:56:31 +0000 (15:56 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 12 Dec 2017 14:57:14 +0000 (15:57 +0100)
lib/flowspec_test.c
lib/net.h
sysdep/bsd/krt-sock.Y
sysdep/bsd/krt-sock.c
sysdep/bsd/krt-sys.h

index 69bc279d65d09ecc49ad2f3674b7ca14575e11bc..dd71dc7b752f3b932974b3a547d80673585234d7 100644 (file)
@@ -70,8 +70,8 @@ t_first_part(void)
   net_addr_flow4 *f;
   NET_ADDR_FLOW4_(f, ip4_build(10,0,0,1), 24, ((byte[]) { 0x00, 0x00, 0xab }));
 
-  const byte const *under240 = &f->data[1];
-  const byte const *above240 = &f->data[2];
+  const byte *under240 = &f->data[1];
+  const byte *above240 = &f->data[2];
 
   /* Case 0x00 0x00 */
   bt_assert(flow4_first_part(f) == NULL);
index 4b2077ae4935844a895299cc46878d4df8053d56..69f006415890c11274fc71d58da757f66eab54fe 100644 (file)
--- a/lib/net.h
+++ b/lib/net.h
@@ -358,10 +358,10 @@ static inline int net_zero_roa6(const net_addr_roa6 *a)
 { return !a->pxlen && ip6_zero(a->prefix) && !a->max_pxlen && !a->asn; }
 
 static inline int net_zero_flow4(const net_addr_flow4 *a)
-{ return !a->pxlen && ip4_zero(a->prefix) && !a->data; }
+{ return !a->pxlen && ip4_zero(a->prefix) && (a->length == sizeof(net_addr_flow4)); }
 
 static inline int net_zero_flow6(const net_addr_flow6 *a)
-{ return !a->pxlen && ip6_zero(a->prefix) && !a->data; }
+{ return !a->pxlen && ip6_zero(a->prefix) && (a->length == sizeof(net_addr_flow6)); }
 
 static inline int net_zero_mpls(const net_addr_mpls *a)
 { return !a->label; }
index 0218f188c0b27976ae44ea89f95cb0aaa172f722..81422c79e2543f7319af3c7f5ffb6df1044fd8e6 100644 (file)
@@ -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;
    }
index 604cd5106522cda7dff0465573ae46165da35310..0a52cfbd00a74fbe136821916474d8474314f46d 100644 (file)
@@ -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
index ed667e8049987d23e76bd2b15c4d69b25851be30..aa6cc72e34d1557e32dbbc9f9593180ecb5cb511 100644 (file)
@@ -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 */