/* Network Flow Specification */
flow_num_op:
- TRUE { $$ = 0b000; }
- | '=' { $$ = 0b001; }
- | NEQ { $$ = 0b110; }
- | '<' { $$ = 0b100; }
- | LEQ { $$ = 0b101; }
- | '>' { $$ = 0b010; }
- | GEQ { $$ = 0b011; }
- | FALSE { $$ = 0b111; }
+ TRUE { $$ = FLOW_OP_TRUE; }
+ | '=' { $$ = FLOW_OP_EQ; }
+ | NEQ { $$ = FLOW_OP_NEQ; }
+ | '<' { $$ = FLOW_OP_LT; }
+ | LEQ { $$ = FLOW_OP_LEQ; }
+ | '>' { $$ = FLOW_OP_GT; }
+ | GEQ { $$ = FLOW_OP_GEQ; }
+ | FALSE { $$ = FLOW_OP_FALSE; }
;
flow_logic_op:
- OR { $$ = 0x00; }
- | AND { $$ = 0x40; }
+ OR { $$ = FLOW_OP_OR; }
+ | AND { $$ = FLOW_OP_AND; }
;
flow_num_type_:
flow_num_opt_ext_expr:
expr {
flow_check_cf_value_length(this_flow, $1);
- flow_builder_add_op_val(this_flow, 0b001, $1);
+ flow_builder_add_op_val(this_flow, FLOW_OP_EQ, $1);
}
| expr DDOT expr {
flow_check_cf_value_length(this_flow, $1);
flow_check_cf_value_length(this_flow, $3);
- flow_builder_add_op_val(this_flow, 0b011, $1); /* >= */
- flow_builder_add_op_val(this_flow, 0x40 | 0b101, $3); /* AND <= */
+ flow_builder_add_op_val(this_flow, FLOW_OP_GEQ, $1);
+ flow_builder_add_op_val(this_flow, FLOW_OP_AND | FLOW_OP_LEQ, $3);
}
;
if (a)
{
flow_builder_add_op_val(fb, op ^ 0x01, a);
- op |= 0x40;
+ op |= FLOW_OP_AND;
}
if (b)
*/
/* Flowspec operators for [op, value]+ pairs */
-#define FLOW_TRUE 0b000
-#define FLOW_EQ 0b001
-#define FLOW_GT 0b010
-#define FLOW_GTE 0b011
-#define FLOW_LT 0b100
-#define FLOW_LTE 0b101
-#define FLOW_NEQ 0b110
-#define FLOW_FALSE 0b111
static const char *
num_op_str(const byte *op)
{
switch (*op & 0x07)
{
- case FLOW_TRUE: return "true";
- case FLOW_EQ: return "=";
- case FLOW_GT: return ">";
- case FLOW_GTE: return ">=";
- case FLOW_LT: return "<";
- case FLOW_LTE: return "<=";
- case FLOW_NEQ: return "!=";
- case FLOW_FALSE: return "false";
+ case FLOW_OP_TRUE: return "true";
+ case FLOW_OP_EQ: return "=";
+ case FLOW_OP_GT: return ">";
+ case FLOW_OP_GEQ: return ">=";
+ case FLOW_OP_LT: return "<";
+ case FLOW_OP_LEQ: return "<=";
+ case FLOW_OP_NEQ: return "!=";
+ case FLOW_OP_FALSE: return "false";
}
return NULL;
{
/* XXX: I don't like this so complicated if-tree */
if (!isset_and(op) &&
- ((num_op( op) == FLOW_EQ) || (num_op( op) == FLOW_GTE)) &&
- ((num_op(last_op) == FLOW_EQ) || (num_op(last_op) == FLOW_LTE)))
+ ((num_op( op) == FLOW_OP_EQ) || (num_op( op) == FLOW_OP_GEQ)) &&
+ ((num_op(last_op) == FLOW_OP_EQ) || (num_op(last_op) == FLOW_OP_LEQ)))
{
b->pos--; /* Remove last char (it is a space) */
buffer_puts(b, ",");
val = get_value(op+1, len);
if (!isset_end(op) && !isset_and(op) && isset_and(op+1+len) &&
- (num_op(op) == FLOW_GTE) && (num_op(op+1+len) == FLOW_LTE))
+ (num_op(op) == FLOW_OP_GEQ) && (num_op(op+1+len) == FLOW_OP_LEQ))
{
/* Display interval */
buffer_print(b, "%u..", val);
val = get_value(op+1, len);
buffer_print(b, "%u", val);
}
- else if (num_op(op) == FLOW_EQ)
+ else if (num_op(op) == FLOW_OP_EQ)
{
buffer_print(b, "%u", val);
}
#include "lib/net.h"
+/* Flow component operators */
+#define FLOW_OP_TRUE 0x00 /* 0b000 */
+#define FLOW_OP_EQ 0x01 /* 0b001 */
+#define FLOW_OP_GT 0x02 /* 0b010 */
+#define FLOW_OP_GEQ 0x03 /* 0b011 */
+#define FLOW_OP_LT 0x04 /* 0b100 */
+#define FLOW_OP_LEQ 0x05 /* 0b101 */
+#define FLOW_OP_NEQ 0x06 /* 0b110 */
+#define FLOW_OP_FALSE 0x07 /* 0b111 */
+
+#define FLOW_OP_OR 0x00
+#define FLOW_OP_AND 0x40
+
+
/* Types of components in flowspec */
enum flow_type {
FLOW_TYPE_DST_PREFIX = 1,
static void proto_rethink_goal(struct proto *p);
static char *proto_state_name(struct proto *p);
static void channel_verify_limits(struct channel *c);
-static void channel_reset_limit(struct channel_limit *l);
+static inline void channel_reset_limit(struct channel_limit *l);
static inline int proto_is_done(struct proto *p)
/* BFD CSNs are in 32-bit circular number space */
u32 csn = ntohl(auth->csn);
if (s->rx_csn_known &&
- (((csn - s->rx_csn) > (3 * s->detect_mult)) ||
+ (((csn - s->rx_csn) > (3 * (uint) s->detect_mult)) ||
(meticulous && (csn == s->rx_csn))))
{
/* We want to report both new and old CSN */
/* Stale entries that should be removed */
if ((en->valid == RIP_ENTRY_STALE) &&
- ((en->changed + ifa->cf->garbage_time) <= now))
+ ((en->changed + (bird_clock_t) ifa->cf->garbage_time) <= now))
goto next_entry;
/* Triggered updates */
rip_iface_update_buffers(ifa);
- if (ifa->next_regular > (now + new->update_time))
+ if (ifa->next_regular > (now + (bird_clock_t) new->update_time))
ifa->next_regular = now + (random() % new->update_time) + 1;
if (new->check_link != old->check_link)
#ifndef HAVE_STRUCT_RTVIA
struct rtvia {
- __kernel_sa_family_t rtvia_family;
- __u8 rtvia_addr[0];
+ unsigned short rtvia_family;
+ u8 rtvia_addr[0];
};
#endif
s->tx_hook(s);
}
+#ifdef HAVE_LIBSSH
static void
sk_ssh_connected(sock *s)
{
s->type = SK_SSH;
s->tx_hook(s);
}
+#endif
static int
sk_passive_connected(sock *s, int type)