mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
Follow-up work on integration
This commit is contained in:
parent
e92a4b855f
commit
23c212e7f1
@ -205,7 +205,6 @@ f_generate_ec(u16 kind, struct f_inst *tk, struct f_inst *tv)
|
|||||||
cf_error("Can't operate with key of non-integer/IPv4 type in EC constructor");
|
cf_error("Can't operate with key of non-integer/IPv4 type in EC constructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef IPV6
|
|
||||||
/* IP->Quad implicit conversion */
|
/* IP->Quad implicit conversion */
|
||||||
else if (tk->code == 'C') {
|
else if (tk->code == 'C') {
|
||||||
c1 = 1;
|
c1 = 1;
|
||||||
@ -223,7 +222,6 @@ f_generate_ec(u16 kind, struct f_inst *tk, struct f_inst *tv)
|
|||||||
else
|
else
|
||||||
cf_error("Can't operate with key of non-integer/IPv4 type in EC constructor");
|
cf_error("Can't operate with key of non-integer/IPv4 type in EC constructor");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (tv->code == 'c') {
|
if (tv->code == 'c') {
|
||||||
if (tv->aux != T_INT)
|
if (tv->aux != T_INT)
|
||||||
|
@ -31,15 +31,15 @@ net_format(const net_addr *N, char *buf, int buflen)
|
|||||||
{
|
{
|
||||||
net_addr_union *n = (void *) N;
|
net_addr_union *n = (void *) N;
|
||||||
|
|
||||||
/* FIXME: quick hack */
|
/* XXXX fix %I vs %R */
|
||||||
switch (n->n.type)
|
switch (n->n.type)
|
||||||
{
|
{
|
||||||
case NET_IP4:
|
case NET_IP4:
|
||||||
return bsnprintf(buf, buflen, "%I/%d", n->ip4.prefix, n->ip4.pxlen);
|
return bsnprintf(buf, buflen, "%R/%d", n->ip4.prefix, n->ip4.pxlen);
|
||||||
case NET_IP6:
|
case NET_IP6:
|
||||||
return bsnprintf(buf, buflen, "%I/%d", n->ip6.prefix, n->ip6.pxlen);
|
return bsnprintf(buf, buflen, "%I/%d", n->ip6.prefix, n->ip6.pxlen);
|
||||||
case NET_VPN4:
|
case NET_VPN4:
|
||||||
return bsnprintf(buf, buflen, "%u:%u %I/%d", (u32) (n->vpn4.rd >> 32), (u32) n->vpn4.rd, n->vpn4.prefix, n->vpn4.pxlen);
|
return bsnprintf(buf, buflen, "%u:%u %R/%d", (u32) (n->vpn4.rd >> 32), (u32) n->vpn4.rd, n->vpn4.prefix, n->vpn4.pxlen);
|
||||||
case NET_VPN6:
|
case NET_VPN6:
|
||||||
return bsnprintf(buf, buflen, "%u:%u %I/%d", (u32) (n->vpn6.rd >> 32), (u32) n->vpn6.rd, n->vpn6.prefix, n->vpn6.pxlen);
|
return bsnprintf(buf, buflen, "%u:%u %I/%d", (u32) (n->vpn6.rd >> 32), (u32) n->vpn6.rd, n->vpn6.prefix, n->vpn6.pxlen);
|
||||||
}
|
}
|
||||||
|
@ -199,20 +199,20 @@ static inline void net_copy_vpn6(net_addr_vpn6 *dst, const net_addr_vpn6 *src)
|
|||||||
|
|
||||||
|
|
||||||
static inline u32 net_hash_ip4(const net_addr_ip4 *n)
|
static inline u32 net_hash_ip4(const net_addr_ip4 *n)
|
||||||
{ return ip4_hash(n->prefix) ^ ((u32) n->pxlen << 26); }
|
{ return ip4_hash32(n->prefix) ^ ((u32) n->pxlen << 26); }
|
||||||
|
|
||||||
static inline u32 net_hash_ip6(const net_addr_ip6 *n)
|
static inline u32 net_hash_ip6(const net_addr_ip6 *n)
|
||||||
{ return ip6_hash(n->prefix) ^ ((u32) n->pxlen << 26); }
|
{ return ip6_hash32(n->prefix) ^ ((u32) n->pxlen << 26); }
|
||||||
|
|
||||||
/* XXXX */
|
/* XXXX */
|
||||||
static inline u32 u64_hash(u32 a)
|
static inline u32 u64_hash(u32 a)
|
||||||
{ return u32_hash(a); }
|
{ return u32_hash(a); }
|
||||||
|
|
||||||
static inline u32 net_hash_vpn4(const net_addr_vpn4 *n)
|
static inline u32 net_hash_vpn4(const net_addr_vpn4 *n)
|
||||||
{ return ip4_hash(n->prefix) ^ ((u32) n->pxlen << 26) ^ u64_hash(n->rd); }
|
{ return ip4_hash32(n->prefix) ^ ((u32) n->pxlen << 26) ^ u64_hash(n->rd); }
|
||||||
|
|
||||||
static inline u32 net_hash_vpn6(const net_addr_vpn6 *n)
|
static inline u32 net_hash_vpn6(const net_addr_vpn6 *n)
|
||||||
{ return ip6_hash(n->prefix) ^ ((u32) n->pxlen << 26) ^ u64_hash(n->rd); }
|
{ return ip6_hash32(n->prefix) ^ ((u32) n->pxlen << 26) ^ u64_hash(n->rd); }
|
||||||
|
|
||||||
|
|
||||||
static inline int net_validate_ip4(const net_addr_ip4 *n)
|
static inline int net_validate_ip4(const net_addr_ip4 *n)
|
||||||
|
14
lib/printf.c
14
lib/printf.c
@ -292,9 +292,13 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args)
|
|||||||
case 'I': {
|
case 'I': {
|
||||||
ip_addr a = va_arg(args, ip_addr);
|
ip_addr a = va_arg(args, ip_addr);
|
||||||
if (flags & SPECIAL)
|
if (flags & SPECIAL)
|
||||||
ipa_ntox(a, ipbuf);
|
ip6_ntox(ipa_to_ip6(a), ipbuf);
|
||||||
else {
|
else {
|
||||||
ipa_ntop(a, ipbuf);
|
// XXXX better IPv4 / IPv6 distinction
|
||||||
|
if (ipa_is_ip4(a))
|
||||||
|
ip4_ntop(ipa_to_ip4(a), ipbuf);
|
||||||
|
else
|
||||||
|
ip6_ntop(ipa_to_ip6(a), ipbuf);
|
||||||
if (field_width == 1)
|
if (field_width == 1)
|
||||||
field_width = (ipa_is_ip4(a) ? IP4_MAX_TEXT_LENGTH : IP6_MAX_TEXT_LENGTH);
|
field_width = (ipa_is_ip4(a) ? IP4_MAX_TEXT_LENGTH : IP6_MAX_TEXT_LENGTH);
|
||||||
}
|
}
|
||||||
@ -319,11 +323,7 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args)
|
|||||||
/* Router/Network ID - essentially IPv4 address in u32 value */
|
/* Router/Network ID - essentially IPv4 address in u32 value */
|
||||||
case 'R':
|
case 'R':
|
||||||
x = va_arg(args, u32);
|
x = va_arg(args, u32);
|
||||||
bsprintf(ipbuf, "%d.%d.%d.%d",
|
ip4_ntop(ip4_from_u32(x), ipbuf);
|
||||||
((x >> 24) & 0xff),
|
|
||||||
((x >> 16) & 0xff),
|
|
||||||
((x >> 8) & 0xff),
|
|
||||||
(x & 0xff));
|
|
||||||
s = ipbuf;
|
s = ipbuf;
|
||||||
goto str;
|
goto str;
|
||||||
|
|
||||||
|
16
lib/socket.h
16
lib/socket.h
@ -67,19 +67,15 @@ void sk_set_tbsize(sock *s, uint val); /* Resize TX buffer, keeping content */
|
|||||||
void sk_set_tbuf(sock *s, void *tbuf); /* Switch TX buffer, NULL-> return to internal */
|
void sk_set_tbuf(sock *s, void *tbuf); /* Switch TX buffer, NULL-> return to internal */
|
||||||
void sk_dump_all(void);
|
void sk_dump_all(void);
|
||||||
|
|
||||||
|
static inline int sk_is_ipv4(sock *s)
|
||||||
|
{ return s->af == AF_INET; }
|
||||||
|
|
||||||
|
static inline int sk_is_ipv6(sock *s)
|
||||||
|
{ return s->af == AF_INET6; }
|
||||||
|
|
||||||
static inline int sk_send_buffer_empty(sock *sk)
|
static inline int sk_send_buffer_empty(sock *sk)
|
||||||
{ return sk->tbuf == sk->tpos; }
|
{ return sk->tbuf == sk->tpos; }
|
||||||
|
|
||||||
|
|
||||||
#ifdef IPV6
|
|
||||||
#define sk_is_ipv4(X) 0
|
|
||||||
#define sk_is_ipv6(X) 1
|
|
||||||
#else
|
|
||||||
#define sk_is_ipv4(X) 1
|
|
||||||
#define sk_is_ipv6(X) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
int sk_setup_multicast(sock *s); /* Prepare UDP or IP socket for multicasting */
|
int sk_setup_multicast(sock *s); /* Prepare UDP or IP socket for multicasting */
|
||||||
int sk_join_group(sock *s, ip_addr maddr); /* Join multicast group on sk iface */
|
int sk_join_group(sock *s, ip_addr maddr); /* Join multicast group on sk iface */
|
||||||
int sk_leave_group(sock *s, ip_addr maddr); /* Leave multicast group on sk iface */
|
int sk_leave_group(sock *s, ip_addr maddr); /* Leave multicast group on sk iface */
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
* if possible.
|
* if possible.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lib/endian.h"
|
||||||
#include "lib/string.h"
|
#include "lib/string.h"
|
||||||
|
|
||||||
static inline u16
|
static inline u16
|
||||||
|
@ -532,10 +532,8 @@ ifa_update(struct ifa *a)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef IPV6
|
if ((a->prefix.type == NET_IP4) && (i->flags & IF_BROADCAST) && ipa_zero(a->brd))
|
||||||
if ((i->flags & IF_BROADCAST) && !ipa_nonzero(a->brd))
|
|
||||||
log(L_ERR "Missing broadcast address for interface %s", i->name);
|
log(L_ERR "Missing broadcast address for interface %s", i->name);
|
||||||
#endif
|
|
||||||
|
|
||||||
b = mb_alloc(if_pool, sizeof(struct ifa));
|
b = mb_alloc(if_pool, sizeof(struct ifa));
|
||||||
memcpy(b, a, sizeof(struct ifa));
|
memcpy(b, a, sizeof(struct ifa));
|
||||||
|
@ -59,7 +59,7 @@ static void
|
|||||||
fib_ht_alloc(struct fib *f)
|
fib_ht_alloc(struct fib *f)
|
||||||
{
|
{
|
||||||
f->hash_size = 1 << f->hash_order;
|
f->hash_size = 1 << f->hash_order;
|
||||||
f->hash_shift = 16 - f->hash_order;
|
f->hash_shift = 32 - f->hash_order;
|
||||||
if (f->hash_order > HASH_HI_MAX - HASH_HI_STEP)
|
if (f->hash_order > HASH_HI_MAX - HASH_HI_STEP)
|
||||||
f->entries_max = ~0;
|
f->entries_max = ~0;
|
||||||
else
|
else
|
||||||
@ -168,7 +168,7 @@ fib_rehash(struct fib *f, int step)
|
|||||||
struct fib_node *e = f->hash_table[FIB_HASH(f, a, t)]; \
|
struct fib_node *e = f->hash_table[FIB_HASH(f, a, t)]; \
|
||||||
while (e && !net_equal_##t(CAST(t) e->addr, CAST(t) a)) \
|
while (e && !net_equal_##t(CAST(t) e->addr, CAST(t) a)) \
|
||||||
e = e->next; \
|
e = e->next; \
|
||||||
fib_node_to_user(f, e); \
|
e ? fib_node_to_user(f, e) : NULL; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define FIB_INSERT(f,a,e,t) \
|
#define FIB_INSERT(f,a,e,t) \
|
||||||
@ -247,7 +247,7 @@ fib_insert(struct fib *f, const net_addr *a, struct fib_node *e)
|
|||||||
void *
|
void *
|
||||||
fib_get(struct fib *f, const net_addr *a)
|
fib_get(struct fib *f, const net_addr *a)
|
||||||
{
|
{
|
||||||
char *b = fib_find(f, a);
|
void *b = fib_find(f, a);
|
||||||
if (b)
|
if (b)
|
||||||
return b;
|
return b;
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ fib_get(struct fib *f, const net_addr *a)
|
|||||||
else
|
else
|
||||||
b = mb_alloc(f->fib_pool, f->node_size + a->length);
|
b = mb_alloc(f->fib_pool, f->node_size + a->length);
|
||||||
|
|
||||||
struct fib_node *e = (void *) (b + f->node_offset);
|
struct fib_node *e = fib_user_to_node(f, b);
|
||||||
e->readers = NULL;
|
e->readers = NULL;
|
||||||
e->flags = 0;
|
e->flags = 0;
|
||||||
e->uid = 0;
|
e->uid = 0;
|
||||||
@ -522,6 +522,7 @@ found:
|
|||||||
void
|
void
|
||||||
fib_check(struct fib *f)
|
fib_check(struct fib *f)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
uint i, ec, lo, nulls;
|
uint i, ec, lo, nulls;
|
||||||
|
|
||||||
ec = 0;
|
ec = 0;
|
||||||
@ -557,6 +558,8 @@ fib_check(struct fib *f)
|
|||||||
}
|
}
|
||||||
if (ec != f->entries)
|
if (ec != f->entries)
|
||||||
bug("fib_check: invalid entry count (%d != %d)", ec, f->entries);
|
bug("fib_check: invalid entry count (%d != %d)", ec, f->entries);
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -130,21 +130,27 @@ CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN, VIRTUAL, CHECK, LINK, ONLY, BFD)
|
|||||||
CF_KEYWORDS(RX, BUFFER, LARGE, NORMAL, STUBNET, HIDDEN, SUMMARY, TAG, EXTERNAL)
|
CF_KEYWORDS(RX, BUFFER, LARGE, NORMAL, STUBNET, HIDDEN, SUMMARY, TAG, EXTERNAL)
|
||||||
CF_KEYWORDS(WAIT, DELAY, LSADB, ECMP, LIMIT, WEIGHT, NSSA, TRANSLATOR, STABILITY)
|
CF_KEYWORDS(WAIT, DELAY, LSADB, ECMP, LIMIT, WEIGHT, NSSA, TRANSLATOR, STABILITY)
|
||||||
CF_KEYWORDS(GLOBAL, LSID, ROUTER, SELF, INSTANCE, REAL, NETMASK, TX, PRIORITY, LENGTH)
|
CF_KEYWORDS(GLOBAL, LSID, ROUTER, SELF, INSTANCE, REAL, NETMASK, TX, PRIORITY, LENGTH)
|
||||||
CF_KEYWORDS(SECONDARY, MERGE, LSA, SUPPRESSION)
|
CF_KEYWORDS(SECONDARY, MERGE, LSA, SUPPRESSION, OSPF2, OSPF3)
|
||||||
|
|
||||||
%type <ld> lsadb_args
|
%type <ld> lsadb_args
|
||||||
%type <i> nbma_eligible
|
%type <i> ospf_variant nbma_eligible
|
||||||
|
|
||||||
CF_GRAMMAR
|
CF_GRAMMAR
|
||||||
|
|
||||||
CF_ADDTO(proto, ospf_proto '}' { ospf_proto_finish(); } )
|
CF_ADDTO(proto, ospf_proto '}' { ospf_proto_finish(); } )
|
||||||
|
|
||||||
ospf_proto_start: proto_start OSPF {
|
ospf_variant:
|
||||||
|
OSPF { $$ = 1; }
|
||||||
|
| OSPF2 { $$ = 1; }
|
||||||
|
| OSPF3 { $$ = 0; }
|
||||||
|
;
|
||||||
|
|
||||||
|
ospf_proto_start: proto_start ospf_variant {
|
||||||
this_proto = proto_config_new(&proto_ospf, $1);
|
this_proto = proto_config_new(&proto_ospf, $1);
|
||||||
init_list(&OSPF_CFG->area_list);
|
init_list(&OSPF_CFG->area_list);
|
||||||
init_list(&OSPF_CFG->vlink_list);
|
init_list(&OSPF_CFG->vlink_list);
|
||||||
OSPF_CFG->tick = OSPF_DEFAULT_TICK;
|
OSPF_CFG->tick = OSPF_DEFAULT_TICK;
|
||||||
OSPF_CFG->ospf2 = OSPF_IS_V2;
|
OSPF_CFG->ospf2 = $2;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -648,6 +648,9 @@ ospf_reconfigure(struct proto *P, struct proto_config *c)
|
|||||||
if (proto_get_router_id(c) != p->router_id)
|
if (proto_get_router_id(c) != p->router_id)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (p->ospf2 != new->ospf2)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (p->rfc1583 != new->rfc1583)
|
if (p->rfc1583 != new->rfc1583)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -37,14 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef IPV6
|
|
||||||
#define OSPF_IS_V2 0
|
|
||||||
#else
|
|
||||||
#define OSPF_IS_V2 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// FIXME: MAX_PREFIX_LENGTH
|
|
||||||
|
|
||||||
#define OSPF_TRACE(flags, msg, args...) \
|
#define OSPF_TRACE(flags, msg, args...) \
|
||||||
do { if ((p->p.debug & flags) || OSPF_FORCE_DEBUG) \
|
do { if ((p->p.debug & flags) || OSPF_FORCE_DEBUG) \
|
||||||
log(L_TRACE "%s: " msg, p->p.name , ## args ); } while(0)
|
log(L_TRACE "%s: " msg, p->p.name , ## args ); } while(0)
|
||||||
@ -837,16 +829,12 @@ static inline void ospf_notify_net_lsa(struct ospf_iface *ifa)
|
|||||||
static inline void ospf_notify_link_lsa(struct ospf_iface *ifa)
|
static inline void ospf_notify_link_lsa(struct ospf_iface *ifa)
|
||||||
{ ifa->update_link_lsa = 1; }
|
{ ifa->update_link_lsa = 1; }
|
||||||
|
|
||||||
|
|
||||||
#define ospf_is_v2(X) OSPF_IS_V2
|
|
||||||
#define ospf_is_v3(X) (!OSPF_IS_V2)
|
|
||||||
/*
|
|
||||||
static inline int ospf_is_v2(struct ospf_proto *p)
|
static inline int ospf_is_v2(struct ospf_proto *p)
|
||||||
{ return p->ospf2; }
|
{ return p->ospf2; }
|
||||||
|
|
||||||
static inline int ospf_is_v3(struct ospf_proto *p)
|
static inline int ospf_is_v3(struct ospf_proto *p)
|
||||||
{ return ! p->ospf2; }
|
{ return ! p->ospf2; }
|
||||||
*/
|
|
||||||
static inline int ospf_get_version(struct ospf_proto *p)
|
static inline int ospf_get_version(struct ospf_proto *p)
|
||||||
{ return ospf_is_v2(p) ? 2 : 3; }
|
{ return ospf_is_v2(p) ? 2 : 3; }
|
||||||
|
|
||||||
|
@ -1428,7 +1428,7 @@ loop:
|
|||||||
static void *
|
static void *
|
||||||
ospf_fib_route(struct fib *f, ip_addr a)
|
ospf_fib_route(struct fib *f, ip_addr a)
|
||||||
{
|
{
|
||||||
if (ospf_is_v2(p))
|
if (f->addr_type == NET_IP4)
|
||||||
return ospf_fib_route_ip4(f, ipa_to_ip4(a), IP4_MAX_PREFIX_LENGTH);
|
return ospf_fib_route_ip4(f, ipa_to_ip4(a), IP4_MAX_PREFIX_LENGTH);
|
||||||
else
|
else
|
||||||
return ospf_fib_route_ip6(f, ipa_to_ip6(a), IP6_MAX_PREFIX_LENGTH);
|
return ospf_fib_route_ip6(f, ipa_to_ip6(a), IP6_MAX_PREFIX_LENGTH);
|
||||||
|
@ -32,24 +32,29 @@ rip_check_auth(void)
|
|||||||
|
|
||||||
CF_DECLS
|
CF_DECLS
|
||||||
|
|
||||||
CF_KEYWORDS(RIP, ECMP, LIMIT, WEIGHT, INFINITY, METRIC, UPDATE, TIMEOUT,
|
CF_KEYWORDS(RIP, RIPNG, ECMP, LIMIT, WEIGHT, INFINITY, METRIC, UPDATE, TIMEOUT,
|
||||||
GARBAGE, PORT, ADDRESS, MODE, BROADCAST, MULTICAST, PASSIVE,
|
GARBAGE, PORT, ADDRESS, MODE, BROADCAST, MULTICAST, PASSIVE,
|
||||||
VERSION, SPLIT, HORIZON, POISON, REVERSE, CHECK, ZERO, TIME, BFD,
|
VERSION, SPLIT, HORIZON, POISON, REVERSE, CHECK, ZERO, TIME, BFD,
|
||||||
AUTHENTICATION, NONE, PLAINTEXT, CRYPTOGRAPHIC, MD5, TTL, SECURITY,
|
AUTHENTICATION, NONE, PLAINTEXT, CRYPTOGRAPHIC, MD5, TTL, SECURITY,
|
||||||
RX, TX, BUFFER, LENGTH, PRIORITY, ONLY, LINK, RIP_METRIC, RIP_TAG)
|
RX, TX, BUFFER, LENGTH, PRIORITY, ONLY, LINK, RIP_METRIC, RIP_TAG)
|
||||||
|
|
||||||
%type <i> rip_auth
|
%type <i> rip_variant rip_auth
|
||||||
|
|
||||||
CF_GRAMMAR
|
CF_GRAMMAR
|
||||||
|
|
||||||
CF_ADDTO(proto, rip_proto)
|
CF_ADDTO(proto, rip_proto)
|
||||||
|
|
||||||
rip_proto_start: proto_start RIP
|
rip_variant:
|
||||||
|
RIP { $$ = 1; }
|
||||||
|
| RIPNG { $$ = 0; }
|
||||||
|
;
|
||||||
|
|
||||||
|
rip_proto_start: proto_start rip_variant
|
||||||
{
|
{
|
||||||
this_proto = proto_config_new(&proto_rip, $1);
|
this_proto = proto_config_new(&proto_rip, $1);
|
||||||
init_list(&RIP_CFG->patt_list);
|
init_list(&RIP_CFG->patt_list);
|
||||||
|
|
||||||
RIP_CFG->rip2 = RIP_IS_V2;
|
RIP_CFG->rip2 = $2;
|
||||||
RIP_CFG->infinity = RIP_DEFAULT_INFINITY;
|
RIP_CFG->infinity = RIP_DEFAULT_INFINITY;
|
||||||
|
|
||||||
RIP_CFG->min_timeout_time = 60;
|
RIP_CFG->min_timeout_time = 60;
|
||||||
|
@ -736,7 +736,8 @@ rip_open_socket(struct rip_iface *ifa)
|
|||||||
sk->tos = ifa->cf->tx_tos;
|
sk->tos = ifa->cf->tx_tos;
|
||||||
sk->priority = ifa->cf->tx_priority;
|
sk->priority = ifa->cf->tx_priority;
|
||||||
sk->ttl = ifa->cf->ttl_security ? 255 : 1;
|
sk->ttl = ifa->cf->ttl_security ? 255 : 1;
|
||||||
sk->flags = SKF_LADDR_RX | ((ifa->cf->ttl_security == 1) ? SKF_TTL_RX : 0);
|
sk->flags = SKF_LADDR_RX | (rip_is_ng(p) ? SKF_V6ONLY : 0) |
|
||||||
|
((ifa->cf->ttl_security == 1) ? SKF_TTL_RX : 0);
|
||||||
|
|
||||||
/* sk->rbsize and sk->tbsize are handled in rip_iface_update_buffers() */
|
/* sk->rbsize and sk->tbsize are handled in rip_iface_update_buffers() */
|
||||||
|
|
||||||
|
@ -1097,11 +1097,12 @@ rip_start(struct proto *P)
|
|||||||
struct rip_config *cf = (void *) (P->cf);
|
struct rip_config *cf = (void *) (P->cf);
|
||||||
|
|
||||||
init_list(&p->iface_list);
|
init_list(&p->iface_list);
|
||||||
fib_init(&p->rtable, P->pool, rip_is_v2(p) ? NET_IP4 : NET_IP6,
|
fib_init(&p->rtable, P->pool, cf->rip2 ? NET_IP4 : NET_IP6,
|
||||||
sizeof(struct rip_entry), OFFSETOF(struct rip_entry, n), 0, NULL);
|
sizeof(struct rip_entry), OFFSETOF(struct rip_entry, n), 0, NULL);
|
||||||
p->rte_slab = sl_new(P->pool, sizeof(struct rip_rte));
|
p->rte_slab = sl_new(P->pool, sizeof(struct rip_rte));
|
||||||
p->timer = tm_new_set(P->pool, rip_timer, p, 0, 0);
|
p->timer = tm_new_set(P->pool, rip_timer, p, 0, 0);
|
||||||
|
|
||||||
|
p->rip2 = cf->rip2;
|
||||||
p->ecmp = cf->ecmp;
|
p->ecmp = cf->ecmp;
|
||||||
p->infinity = cf->infinity;
|
p->infinity = cf->infinity;
|
||||||
p->triggered = 0;
|
p->triggered = 0;
|
||||||
@ -1121,6 +1122,9 @@ rip_reconfigure(struct proto *P, struct proto_config *c)
|
|||||||
struct rip_config *new = (void *) c;
|
struct rip_config *new = (void *) c;
|
||||||
// struct rip_config *old = (void *) (P->cf);
|
// struct rip_config *old = (void *) (P->cf);
|
||||||
|
|
||||||
|
if (new->rip2 != p->rip2)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (new->infinity != p->infinity)
|
if (new->infinity != p->infinity)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -27,12 +27,6 @@
|
|||||||
#include "lib/timer.h"
|
#include "lib/timer.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef IPV6
|
|
||||||
#define RIP_IS_V2 0
|
|
||||||
#else
|
|
||||||
#define RIP_IS_V2 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define RIP_V1 1
|
#define RIP_V1 1
|
||||||
#define RIP_V2 2
|
#define RIP_V2 2
|
||||||
|
|
||||||
@ -98,6 +92,7 @@ struct rip_proto
|
|||||||
slab *rte_slab; /* Slab for internal routes (struct rip_rte) */
|
slab *rte_slab; /* Slab for internal routes (struct rip_rte) */
|
||||||
timer *timer; /* Main protocol timer */
|
timer *timer; /* Main protocol timer */
|
||||||
|
|
||||||
|
u8 rip2; /* RIPv2 (IPv4) or RIPng (IPv6) */
|
||||||
u8 ecmp; /* Maximum number of nexthops in ECMP route, or 0 */
|
u8 ecmp; /* Maximum number of nexthops in ECMP route, or 0 */
|
||||||
u8 infinity; /* Maximum metric value, representing infinity */
|
u8 infinity; /* Maximum metric value, representing infinity */
|
||||||
u8 triggered; /* Logical AND of interface want_triggered values */
|
u8 triggered; /* Logical AND of interface want_triggered values */
|
||||||
@ -190,16 +185,11 @@ struct rip_rte
|
|||||||
#define EA_RIP_METRIC EA_CODE(EAP_RIP, 0)
|
#define EA_RIP_METRIC EA_CODE(EAP_RIP, 0)
|
||||||
#define EA_RIP_TAG EA_CODE(EAP_RIP, 1)
|
#define EA_RIP_TAG EA_CODE(EAP_RIP, 1)
|
||||||
|
|
||||||
#define rip_is_v2(X) RIP_IS_V2
|
|
||||||
#define rip_is_ng(X) (!RIP_IS_V2)
|
|
||||||
|
|
||||||
/*
|
|
||||||
static inline int rip_is_v2(struct rip_proto *p)
|
static inline int rip_is_v2(struct rip_proto *p)
|
||||||
{ return p->rip2; }
|
{ return p->rip2; }
|
||||||
|
|
||||||
static inline int rip_is_ng(struct rip_proto *p)
|
static inline int rip_is_ng(struct rip_proto *p)
|
||||||
{ return ! p->rip2; }
|
{ return ! p->rip2; }
|
||||||
*/
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
rip_reset_tx_session(struct rip_proto *p, struct rip_iface *ifa)
|
rip_reset_tx_session(struct rip_proto *p, struct rip_iface *ifa)
|
||||||
|
@ -477,12 +477,12 @@ nl_parse_multipath(struct krt_proto *p, struct rtattr *ra)
|
|||||||
nl_parse_attrs(RTNH_DATA(nh), mpnh_attr_want4, a, sizeof(a));
|
nl_parse_attrs(RTNH_DATA(nh), mpnh_attr_want4, a, sizeof(a));
|
||||||
if (a[RTA_GATEWAY])
|
if (a[RTA_GATEWAY])
|
||||||
{
|
{
|
||||||
memcpy(&rv->gw, RTA_DATA(a[RTA_GATEWAY]), sizeof(ip_addr));
|
rv->gw = rta_get_ipa(a[RTA_GATEWAY]);
|
||||||
ipa_ntoh(rv->gw);
|
|
||||||
|
|
||||||
neighbor *ng = neigh_find2(&p->p, &rv->gw, rv->iface,
|
neighbor *nbr;
|
||||||
|
nbr = neigh_find2(&p->p, &rv->gw, rv->iface,
|
||||||
(nh->rtnh_flags & RTNH_F_ONLINK) ? NEF_ONLINK : 0);
|
(nh->rtnh_flags & RTNH_F_ONLINK) ? NEF_ONLINK : 0);
|
||||||
if (!ng || (ng->scope == SCOPE_HOST))
|
if (!nbr || (nbr->scope == SCOPE_HOST))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1165,18 +1165,17 @@ nl_parse_route(struct nlmsghdr *h, int scan)
|
|||||||
|
|
||||||
if (a[RTA_GATEWAY])
|
if (a[RTA_GATEWAY])
|
||||||
{
|
{
|
||||||
neighbor *ng;
|
|
||||||
ra.dest = RTD_ROUTER;
|
ra.dest = RTD_ROUTER;
|
||||||
memcpy(&ra.gw, RTA_DATA(a[RTA_GATEWAY]), sizeof(ra.gw));
|
ra.gw = rta_get_ipa(a[RTA_GATEWAY]);
|
||||||
ipa_ntoh(ra.gw);
|
|
||||||
|
|
||||||
/* Silently skip strange 6to4 routes */
|
/* Silently skip strange 6to4 routes */
|
||||||
if ((i->rtm_family == AF_INET6) && ipa_in_net(ra.gw, IPA_NONE, 96))
|
if ((i->rtm_family == AF_INET6) && ipa_in_net(ra.gw, IPA_NONE, 96))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ng = neigh_find2(&p->p, &ra.gw, ra.iface,
|
neighbor *nbr;
|
||||||
|
nbr = neigh_find2(&p->p, &ra.gw, ra.iface,
|
||||||
(i->rtm_flags & RTNH_F_ONLINK) ? NEF_ONLINK : 0);
|
(i->rtm_flags & RTNH_F_ONLINK) ? NEF_ONLINK : 0);
|
||||||
if (!ng || (ng->scope == SCOPE_HOST))
|
if (!nbr || (nbr->scope == SCOPE_HOST))
|
||||||
{
|
{
|
||||||
log(L_ERR "KRT: Received route %N with strange next-hop %I", net->n.addr, ra.gw);
|
log(L_ERR "KRT: Received route %N with strange next-hop %I", net->n.addr, ra.gw);
|
||||||
return;
|
return;
|
||||||
|
@ -72,15 +72,15 @@ tags:
|
|||||||
|
|
||||||
install: all
|
install: all
|
||||||
$(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/@runtimedir@
|
$(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/@runtimedir@
|
||||||
$(INSTALL_PROGRAM) $(exedir)/bird $(DESTDIR)/$(sbindir)/bird@SUFFIX@
|
$(INSTALL_PROGRAM) $(exedir)/bird $(DESTDIR)/$(sbindir)/bird
|
||||||
$(INSTALL_PROGRAM) $(exedir)/birdcl $(DESTDIR)/$(sbindir)/birdcl@SUFFIX@
|
$(INSTALL_PROGRAM) $(exedir)/birdcl $(DESTDIR)/$(sbindir)/birdcl
|
||||||
if test -n "@CLIENT@" ; then \
|
if test -n "@CLIENT@" ; then \
|
||||||
$(INSTALL_PROGRAM) $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc@SUFFIX@ ; \
|
$(INSTALL_PROGRAM) $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc ; \
|
||||||
fi
|
fi
|
||||||
if ! test -f $(DESTDIR)/@CONFIG_FILE@ ; then \
|
if ! test -f $(DESTDIR)/@CONFIG_FILE@ ; then \
|
||||||
$(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/@CONFIG_FILE@ ; \
|
$(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/@CONFIG_FILE@ ; \
|
||||||
else \
|
else \
|
||||||
echo "Not overwriting old bird@SUFFIX@.conf" ; \
|
echo "Not overwriting old bird.conf" ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install-docs:
|
install-docs:
|
||||||
|
Loading…
Reference in New Issue
Block a user