summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
Diffstat (limited to 'nest')
-rw-r--r--nest/a-path.c2
-rw-r--r--nest/a-set.c135
-rw-r--r--nest/attrs.h32
-rw-r--r--nest/bfd.h2
-rw-r--r--nest/config.Y32
-rw-r--r--nest/locks.c3
-rw-r--r--nest/password.c17
-rw-r--r--nest/password.h11
-rw-r--r--nest/route.h6
-rw-r--r--nest/rt-attr.c17
-rw-r--r--nest/rt-table.c22
11 files changed, 246 insertions, 33 deletions
diff --git a/nest/a-path.c b/nest/a-path.c
index e1031b7b..b453f702 100644
--- a/nest/a-path.c
+++ b/nest/a-path.c
@@ -370,7 +370,7 @@ as_path_filter(struct linpool *pool, struct adata *path, struct f_tree *set, u32
}
}
- int nl = d - buf;
+ uint nl = d - buf;
if (nl == path->length)
return path;
diff --git a/nest/a-set.c b/nest/a-set.c
index a6116022..bd244e2e 100644
--- a/nest/a-set.c
+++ b/nest/a-set.c
@@ -116,7 +116,7 @@ int
ec_set_format(struct adata *set, int from, byte *buf, uint size)
{
u32 *z = int_set_get_data(set);
- byte *end = buf + size - 24;
+ byte *end = buf + size - 64;
int from2 = MAX(from, 0);
int to = int_set_get_size(set);
int i;
@@ -142,6 +142,43 @@ ec_set_format(struct adata *set, int from, byte *buf, uint size)
}
int
+lc_format(byte *buf, lcomm lc)
+{
+ return bsprintf(buf, "(%u, %u, %u)", lc.asn, lc.ldp1, lc.ldp2);
+}
+
+int
+lc_set_format(struct adata *set, int from, byte *buf, uint bufsize)
+{
+ u32 *d = (u32 *) set->data;
+ byte *end = buf + bufsize - 64;
+ int from2 = MAX(from, 0);
+ int to = set->length / 4;
+ int i;
+
+ for (i = from2; i < to; i += 3)
+ {
+ if (buf > end)
+ {
+ if (from < 0)
+ strcpy(buf, "...");
+ else
+ buf[-1] = 0;
+ return i;
+ }
+
+ buf += bsprintf(buf, "(%u, %u, %u)", d[i], d[i+1], d[i+2]);
+ *buf++ = ' ';
+ }
+
+ if (i != from2)
+ buf--;
+
+ *buf = 0;
+ return 0;
+}
+
+int
int_set_contains(struct adata *list, u32 val)
{
if (!list)
@@ -177,6 +214,24 @@ ec_set_contains(struct adata *list, u64 val)
return 0;
}
+int
+lc_set_contains(struct adata *list, lcomm val)
+{
+ if (!list)
+ return 0;
+
+ u32 *l = int_set_get_data(list);
+ int len = int_set_get_size(list);
+ int i;
+
+ for (i = 0; i < len; i += 3)
+ if (lc_match(l, i, val))
+ return 1;
+
+ return 0;
+}
+
+
struct adata *
int_set_add(struct linpool *pool, struct adata *list, u32 val)
{
@@ -189,9 +244,13 @@ int_set_add(struct linpool *pool, struct adata *list, u32 val)
len = list ? list->length : 0;
res = lp_alloc(pool, sizeof(struct adata) + len + 4);
res->length = len + 4;
- * (u32 *) res->data = val;
+
if (list)
- memcpy((char *) res->data + 4, list->data, list->length);
+ memcpy(res->data, list->data, list->length);
+
+ u32 *c = (u32 *) (res->data + len);
+ *c = val;
+
return res;
}
@@ -208,13 +267,30 @@ ec_set_add(struct linpool *pool, struct adata *list, u64 val)
if (list)
memcpy(res->data, list->data, list->length);
- u32 *l = (u32 *) (res->data + res->length - 8);
+ u32 *l = (u32 *) (res->data + olen);
l[0] = ec_hi(val);
l[1] = ec_lo(val);
return res;
}
+struct adata *
+lc_set_add(struct linpool *pool, struct adata *list, lcomm val)
+{
+ if (lc_set_contains(list, val))
+ return list;
+
+ int olen = list ? list->length : 0;
+ struct adata *res = lp_alloc(pool, sizeof(struct adata) + olen + LCOMM_LENGTH);
+ res->length = olen + LCOMM_LENGTH;
+
+ if (list)
+ memcpy(res->data, list->data, list->length);
+
+ lc_put((u32 *) (res->data + olen), val);
+
+ return res;
+}
struct adata *
int_set_del(struct linpool *pool, struct adata *list, u32 val)
@@ -265,6 +341,27 @@ ec_set_del(struct linpool *pool, struct adata *list, u64 val)
return res;
}
+struct adata *
+lc_set_del(struct linpool *pool, struct adata *list, lcomm val)
+{
+ if (!lc_set_contains(list, val))
+ return list;
+
+ struct adata *res;
+ res = lp_alloc(pool, sizeof(struct adata) + list->length - LCOMM_LENGTH);
+ res->length = list->length - LCOMM_LENGTH;
+
+ u32 *l = int_set_get_data(list);
+ u32 *k = int_set_get_data(res);
+ int len = int_set_get_size(list);
+ int i;
+
+ for (i=0; i < len; i += 3)
+ if (! lc_match(l, i, val))
+ k = lc_copy(k, l+i);
+
+ return res;
+}
struct adata *
int_set_union(struct linpool *pool, struct adata *l1, struct adata *l2)
@@ -328,3 +425,33 @@ ec_set_union(struct linpool *pool, struct adata *l1, struct adata *l2)
memcpy(res->data + l1->length, tmp, len);
return res;
}
+
+struct adata *
+lc_set_union(struct linpool *pool, struct adata *l1, struct adata *l2)
+{
+ if (!l1)
+ return l2;
+ if (!l2)
+ return l1;
+
+ struct adata *res;
+ int len = int_set_get_size(l2);
+ u32 *l = int_set_get_data(l2);
+ u32 tmp[len];
+ u32 *k = tmp;
+ int i;
+
+ for (i = 0; i < len; i += 3)
+ if (!lc_set_contains(l1, lc_get(l, i)))
+ k = lc_copy(k, l+i);
+
+ if (k == tmp)
+ return l1;
+
+ len = (k - tmp) * 4;
+ res = lp_alloc(pool, sizeof(struct adata) + l1->length + len);
+ res->length = l1->length + len;
+ memcpy(res->data, l1->data, l1->length);
+ memcpy(res->data + l1->length, tmp, len);
+ return res;
+}
diff --git a/nest/attrs.h b/nest/attrs.h
index 670b048f..548d71a9 100644
--- a/nest/attrs.h
+++ b/nest/attrs.h
@@ -68,6 +68,7 @@ int as_path_match(struct adata *path, struct f_path_mask *mask);
/* Transitive bit (for first u32 half of EC) */
#define EC_TBIT 0x40000000
+#define ECOMM_LENGTH 8
static inline int int_set_get_size(struct adata *list)
{ return list->length / 4; }
@@ -75,6 +76,9 @@ static inline int int_set_get_size(struct adata *list)
static inline int ec_set_get_size(struct adata *list)
{ return list->length / 8; }
+static inline int lc_set_get_size(struct adata *list)
+{ return list->length / 12; }
+
static inline u32 *int_set_get_data(struct adata *list)
{ return (u32 *) list->data; }
@@ -98,17 +102,45 @@ static inline u64 ec_ip4(u64 kind, u64 key, u64 val)
static inline u64 ec_generic(u64 key, u64 val)
{ return (key << 32) | val; }
+/* Large community value */
+typedef struct lcomm {
+ u32 asn;
+ u32 ldp1;
+ u32 ldp2;
+} lcomm;
+
+#define LCOMM_LENGTH 12
+
+static inline lcomm lc_get(const u32 *l, int i)
+{ return (lcomm) { l[i], l[i+1], l[i+2] }; }
+
+static inline void lc_put(u32 *l, lcomm v)
+{ l[0] = v.asn; l[1] = v.ldp1; l[2] = v.ldp2; }
+
+static inline int lc_match(const u32 *l, int i, lcomm v)
+{ return (l[i] == v.asn && l[i+1] == v.ldp1 && l[i+2] == v.ldp2); }
+
+static inline u32 *lc_copy(u32 *dst, const u32 *src)
+{ memcpy(dst, src, LCOMM_LENGTH); return dst + 3; }
+
+
int int_set_format(struct adata *set, int way, int from, byte *buf, uint size);
int ec_format(byte *buf, u64 ec);
int ec_set_format(struct adata *set, int from, byte *buf, uint size);
+int lc_format(byte *buf, lcomm lc);
+int lc_set_format(struct adata *set, int from, byte *buf, uint size);
int int_set_contains(struct adata *list, u32 val);
int ec_set_contains(struct adata *list, u64 val);
+int lc_set_contains(struct adata *list, lcomm val);
struct adata *int_set_add(struct linpool *pool, struct adata *list, u32 val);
struct adata *ec_set_add(struct linpool *pool, struct adata *list, u64 val);
+struct adata *lc_set_add(struct linpool *pool, struct adata *list, lcomm val);
struct adata *int_set_del(struct linpool *pool, struct adata *list, u32 val);
struct adata *ec_set_del(struct linpool *pool, struct adata *list, u64 val);
+struct adata *lc_set_del(struct linpool *pool, struct adata *list, lcomm val);
struct adata *int_set_union(struct linpool *pool, struct adata *l1, struct adata *l2);
struct adata *ec_set_union(struct linpool *pool, struct adata *l1, struct adata *l2);
+struct adata *lc_set_union(struct linpool *pool, struct adata *l1, struct adata *l2);
#endif
diff --git a/nest/bfd.h b/nest/bfd.h
index f1e95cb2..b0ebe31d 100644
--- a/nest/bfd.h
+++ b/nest/bfd.h
@@ -42,7 +42,7 @@ struct bfd_request {
struct bfd_request * bfd_request_session(pool *p, ip_addr addr, ip_addr local, struct iface *iface, void (*hook)(struct bfd_request *), void *data);
-static inline void cf_check_bfd(int use) { }
+static inline void cf_check_bfd(int use UNUSED) { }
#else
diff --git a/nest/config.Y b/nest/config.Y
index 2a746657..776e5d16 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -13,6 +13,7 @@ CF_HDR
#include "nest/password.h"
#include "nest/cmds.h"
#include "lib/lists.h"
+#include "lib/mac.h"
CF_DEFINES
@@ -68,7 +69,8 @@ CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE, STATES, ROUTES, FILT
CF_KEYWORDS(IPV4, IPV6, VPN4, VPN6, ROA4, ROA6)
CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED)
CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES)
-CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, NOEXPORT, GENERATE) /* ,ROA */
+CF_KEYWORDS(ALGORITHM, KEYED, HMAC, MD5, SHA1, SHA256, SHA384, SHA512)
+CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, NOEXPORT, GENERATE)
CF_KEYWORDS(LISTEN, BGP, V6ONLY, DUAL, ADDRESS, PORT, PASSWORDS, DESCRIPTION, SORTED)
CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, IGP_METRIC, CLASS, DSCP)
CF_KEYWORDS(GRACEFUL, RESTART, WAIT, MAX, FLUSH, AS)
@@ -86,7 +88,7 @@ CF_ENUM(T_ENUM_ROA, ROA_, UNKNOWN, VALID, INVALID)
%type <s> optsym
%type <ra> r_args
%type <sd> sym_args
-%type <i> proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_mode limit_action net_type table_sorted tos
+%type <i> proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_mode limit_action net_type table_sorted tos password_algorithm
%type <ps> proto_patt proto_patt2
%type <cc> channel_start proto_channel
%type <cl> limit_spec
@@ -419,7 +421,7 @@ password_list:
| password_item
;
-password_items:
+password_items:
/* empty */
| password_item ';' password_items
;
@@ -438,11 +440,13 @@ password_item_begin:
}
this_p_item = cfg_alloc(sizeof (struct password_item));
this_p_item->password = $2;
+ this_p_item->length = strlen($2);
this_p_item->genfrom = 0;
this_p_item->gento = TIME_INFINITY;
this_p_item->accfrom = 0;
this_p_item->accto = TIME_INFINITY;
this_p_item->id = password_id++;
+ this_p_item->alg = ALG_UNDEFINED;
add_tail(this_p_list, &this_p_item->n);
}
;
@@ -453,10 +457,24 @@ password_item_params:
| GENERATE TO datetime ';' password_item_params { this_p_item->gento = $3; }
| ACCEPT FROM datetime ';' password_item_params { this_p_item->accfrom = $3; }
| ACCEPT TO datetime ';' password_item_params { this_p_item->accto = $3; }
+ | FROM datetime ';' password_item_params { this_p_item->genfrom = this_p_item->accfrom = $2; }
+ | TO datetime ';' password_item_params { this_p_item->gento = this_p_item->accto = $2; }
| ID expr ';' password_item_params { this_p_item->id = $2; if ($2 <= 0) cf_error("Password ID has to be greated than zero."); }
+ | ALGORITHM password_algorithm ';' password_item_params { this_p_item->alg = $2; }
;
-
+password_algorithm:
+ KEYED MD5 { $$ = ALG_MD5; }
+ | KEYED SHA1 { $$ = ALG_SHA1; }
+ | KEYED SHA256 { $$ = ALG_SHA256; }
+ | KEYED SHA384 { $$ = ALG_SHA384; }
+ | KEYED SHA512 { $$ = ALG_SHA512; }
+ | HMAC MD5 { $$ = ALG_HMAC_MD5; }
+ | HMAC SHA1 { $$ = ALG_HMAC_SHA1; }
+ | HMAC SHA256 { $$ = ALG_HMAC_SHA256; }
+ | HMAC SHA384 { $$ = ALG_HMAC_SHA384; }
+ | HMAC SHA512 { $$ = ALG_HMAC_SHA512; }
+ ;
/* Core commands */
CF_CLI_HELP(SHOW, ..., [[Show status information]])
@@ -605,7 +623,7 @@ CF_CLI(EVAL, term, <expr>, [[Evaluate an expression]])
{ cmd_eval($2); } ;
CF_CLI_HELP(ECHO, ..., [[Control echoing of log messages]])
-CF_CLI(ECHO, echo_mask echo_size, (all | off | { debug | trace | info | remote | warning | error | auth }) [<buffer-size>], [[Control echoing of log messages]]) {
+CF_CLI(ECHO, echo_mask echo_size, (all | off | { debug|trace|info|remote|warning|error|auth [, ...] }) [<buffer-size>], [[Control echoing of log messages]]) {
cli_set_log_echo(this_cli, $2, $3);
cli_msg(0, "");
} ;
@@ -638,11 +656,11 @@ CF_CLI(RELOAD OUT, proto_patt, <protocol> | \"<pattern>\" | all, [[Reload protoc
{ proto_apply_cmd($3, proto_cmd_reload, 1, CMD_RELOAD_OUT); } ;
CF_CLI_HELP(DEBUG, ..., [[Control protocol debugging via BIRD logs]])
-CF_CLI(DEBUG, proto_patt debug_mask, (<protocol> | <pattern> | all) (all | off | { states | routes | filters | interfaces | events | packets }), [[Control protocol debugging via BIRD logs]])
+CF_CLI(DEBUG, proto_patt debug_mask, (<protocol> | \"<pattern>\" | all) (all | off | { states|routes|filters|interfaces|events|packets [, ...] }), [[Control protocol debugging via BIRD logs]])
{ proto_apply_cmd($2, proto_cmd_debug, 1, $3); } ;
CF_CLI_HELP(MRTDUMP, ..., [[Control protocol debugging via MRTdump files]])
-CF_CLI(MRTDUMP, proto_patt mrtdump_mask, (<protocol> | <pattern> | all) (all | off | { states | messages }), [[Control protocol debugging via MRTdump format]])
+CF_CLI(MRTDUMP, proto_patt mrtdump_mask, (<protocol> | \"<pattern>\" | all) (all | off | { states|messages [, ...] }), [[Control protocol debugging via MRTdump format]])
{ proto_apply_cmd($2, proto_cmd_mrtdump, 1, $3); } ;
CF_CLI(RESTRICT,,,[[Restrict current CLI session to safe commands]])
diff --git a/nest/locks.c b/nest/locks.c
index ad2af493..84b8b0ae 100644
--- a/nest/locks.c
+++ b/nest/locks.c
@@ -100,7 +100,8 @@ static struct resclass olock_class = {
sizeof(struct object_lock),
olock_free,
olock_dump,
- NULL
+ NULL,
+ NULL,
};
/**
diff --git a/nest/password.c b/nest/password.c
index 91aaa418..e4813741 100644
--- a/nest/password.c
+++ b/nest/password.c
@@ -10,6 +10,7 @@
#include "nest/bird.h"
#include "nest/password.h"
#include "lib/string.h"
+#include "lib/mac.h"
struct password_item *last_password_item = NULL;
@@ -37,7 +38,7 @@ password_find(list *l, int first_fit)
}
struct password_item *
-password_find_by_id(list *l, int id)
+password_find_by_id(list *l, uint id)
{
struct password_item *pi;
@@ -66,3 +67,17 @@ password_find_by_value(list *l, char *pass, uint size)
return NULL;
}
+uint
+max_mac_length(list *l)
+{
+ struct password_item *pi;
+ uint val = 0;
+
+ if (!l)
+ return 0;
+
+ WALK_LIST(pi, *l)
+ val = MAX(val, mac_type_length(pi->alg));
+
+ return val;
+}
diff --git a/nest/password.h b/nest/password.h
index cbf80b99..78244985 100644
--- a/nest/password.h
+++ b/nest/password.h
@@ -9,19 +9,22 @@
#ifndef PASSWORD_H
#define PASSWORD_H
+
#include "sysdep/unix/timer.h"
struct password_item {
node n;
- char *password;
- int id;
+ char *password; /* Key data, null terminated */
+ uint length; /* Key length, without null */
+ uint id; /* Key ID */
+ uint alg; /* MAC algorithm */
bird_clock_t accfrom, accto, genfrom, gento;
};
extern struct password_item *last_password_item;
struct password_item *password_find(list *l, int first_fit);
-struct password_item *password_find_by_id(list *l, int id);
+struct password_item *password_find_by_id(list *l, uint id);
struct password_item *password_find_by_value(list *l, char *pass, uint size);
static inline int password_verify(struct password_item *p1, char *p2, uint size)
@@ -31,4 +34,6 @@ static inline int password_verify(struct password_item *p1, char *p2, uint size)
return !memcmp(buf, p2, size);
}
+uint max_mac_length(list *l);
+
#endif
diff --git a/nest/route.h b/nest/route.h
index a536def7..f2e883b6 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -285,7 +285,6 @@ rte *rte_find(net *net, struct rte_src *src);
rte *rte_get_temp(struct rta *);
void rte_update2(struct channel *c, net_addr *n, rte *new, struct rte_src *src);
/* rte_update() moved to protocol.h to avoid dependency conflicts */
-void rte_discard(rtable *tab, rte *old);
int rt_examine(rtable *t, net_addr *a, struct proto *p, struct filter *filter);
rte *rt_export_merged(struct channel *c, net *net, rte **rt_free, struct ea_list **tmpa, linpool *pool, int silent);
void rt_refresh_begin(rtable *t, struct channel *c);
@@ -445,7 +444,7 @@ typedef struct eattr {
#define EA_ALLOW_UNDEF 0x10000 /* ea_find: allow EAF_TYPE_UNDEF */
#define EA_BIT(n) ((n) << 24) /* Used in bitfield accessors */
-#define EAF_TYPE_MASK 0x0f /* Mask with this to get type */
+#define EAF_TYPE_MASK 0x1f /* Mask with this to get type */
#define EAF_TYPE_INT 0x01 /* 32-bit unsigned integer number */
#define EAF_TYPE_OPAQUE 0x02 /* Opaque byte string (not filterable) */
#define EAF_TYPE_IP_ADDRESS 0x04 /* IP address */
@@ -454,7 +453,8 @@ typedef struct eattr {
#define EAF_TYPE_BITFIELD 0x09 /* 32-bit embedded bitfield */
#define EAF_TYPE_INT_SET 0x0a /* Set of u32's (e.g., a community list) */
#define EAF_TYPE_EC_SET 0x0e /* Set of pairs of u32's - ext. community list */
-#define EAF_TYPE_UNDEF 0x0f /* `force undefined' entry */
+#define EAF_TYPE_LC_SET 0x12 /* Set of triplets of u32's - large community list */
+#define EAF_TYPE_UNDEF 0x1f /* `force undefined' entry */
#define EAF_EMBEDDED 0x01 /* Data stored in eattr.u.data (part of type spec) */
#define EAF_VAR_LENGTH 0x02 /* Attribute length is variable (part of type spec) */
#define EAF_ORIGINATED 0x40 /* The attribute has originated locally */
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index bb2b3561..e280bbd9 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -733,7 +733,7 @@ static inline void
opaque_format(struct adata *ad, byte *buf, uint size)
{
byte *bound = buf + size - 10;
- int i;
+ uint i;
for(i = 0; i < ad->length; i++)
{
@@ -776,6 +776,18 @@ ea_show_ec_set(struct cli *c, struct adata *ad, byte *pos, byte *buf, byte *end)
}
}
+static inline void
+ea_show_lc_set(struct cli *c, struct adata *ad, byte *pos, byte *buf, byte *end)
+{
+ int i = lc_set_format(ad, 0, pos, end - pos);
+ cli_printf(c, -1012, "\t%s", buf);
+ while (i)
+ {
+ i = lc_set_format(ad, i, buf, end - buf - 1);
+ cli_printf(c, -1012, "\t\t%s", buf);
+ }
+}
+
/**
* ea_show - print an &eattr to CLI
* @c: destination CLI
@@ -840,6 +852,9 @@ ea_show(struct cli *c, eattr *e)
case EAF_TYPE_EC_SET:
ea_show_ec_set(c, ad, pos, buf, end);
return;
+ case EAF_TYPE_LC_SET:
+ ea_show_lc_set(c, ad, pos, buf, end);
+ return;
case EAF_TYPE_UNDEF:
default:
bsprintf(pos, "<type %02x>", e->type);
diff --git a/nest/rt-table.c b/nest/rt-table.c
index eb9dc3a5..4260e493 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -63,7 +63,7 @@ make_tmp_attrs(struct rte *rt, struct linpool *pool)
{
struct ea_list *(*mta)(struct rte *rt, struct linpool *pool);
mta = rt->attrs->src->proto->make_tmp_attrs;
- return mta ? mta(rt, rte_update_pool) : NULL;
+ return mta ? mta(rt, pool) : NULL;
}
@@ -713,7 +713,7 @@ mpnh_merge_rta(struct mpnh *nhs, rta *a, linpool *pool, int max)
{
struct mpnh nh = { .gw = a->gw, .iface = a->iface };
struct mpnh *nh2 = (a->dest == RTD_MULTIPATH) ? a->nexthops : &nh;
- return mpnh_merge(nhs, nh2, 1, 0, max, rte_update_pool);
+ return mpnh_merge(nhs, nh2, 1, 0, max, pool);
}
rte *
@@ -1403,8 +1403,8 @@ rte_announce_i(rtable *tab, unsigned type, net *net, rte *new, rte *old,
rte_update_unlock();
}
-void
-rte_discard(rtable *t, rte *old) /* Non-filtered route deletion, used during garbage collection */
+static inline void
+rte_discard(rte *old) /* Non-filtered route deletion, used during garbage collection */
{
rte_update_lock();
rte_recalculate(old->sender, old->net, NULL, old->attrs->src);
@@ -1695,7 +1695,7 @@ again:
return;
}
- rte_discard(tab, e);
+ rte_discard(e);
limit--;
goto rescan;
@@ -1780,7 +1780,7 @@ rta_apply_hostentry(rta *a, struct hostentry *he)
}
static inline rte *
-rt_next_hop_update_rte(rtable *tab, rte *old)
+rt_next_hop_update_rte(rtable *tab UNUSED, rte *old)
{
rta a;
memcpy(&a, old->attrs, sizeof(rta));
@@ -2166,11 +2166,11 @@ hc_remove(struct hostcache *hc, struct hostentry *he)
static void
hc_alloc_table(struct hostcache *hc, unsigned order)
{
- unsigned hsize = 1 << order;
+ uint hsize = 1 << order;
hc->hash_order = order;
hc->hash_shift = 32 - order;
- hc->hash_max = (order >= HC_HI_ORDER) ? ~0 : (hsize HC_HI_MARK);
- hc->hash_min = (order <= HC_LO_ORDER) ? 0 : (hsize HC_LO_MARK);
+ hc->hash_max = (order >= HC_HI_ORDER) ? ~0U : (hsize HC_HI_MARK);
+ hc->hash_min = (order <= HC_LO_ORDER) ? 0U : (hsize HC_LO_MARK);
hc->hash_table = mb_allocz(rt_table_pool, hsize * sizeof(struct hostentry *));
}
@@ -2178,10 +2178,10 @@ hc_alloc_table(struct hostcache *hc, unsigned order)
static void
hc_resize(struct hostcache *hc, unsigned new_order)
{
- unsigned old_size = 1 << hc->hash_order;
struct hostentry **old_table = hc->hash_table;
struct hostentry *he, *hen;
- int i;
+ uint old_size = 1 << hc->hash_order;
+ uint i;
hc_alloc_table(hc, new_order);
for (i = 0; i < old_size; i++)