mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-09-21 21:05:21 +00:00
Merge commit 'bcb25084d31fdb90fcf1666f10e73fe0f863afc0' into sark-bgp-rebased
This commit is contained in:
commit
14bb6fd29a
@ -557,6 +557,11 @@ test-ospf-custom:
|
|||||||
variables:
|
variables:
|
||||||
TEST_NAME: cf-ospf-custom
|
TEST_NAME: cf-ospf-custom
|
||||||
|
|
||||||
|
test-ospf-area:
|
||||||
|
<<: *test-base
|
||||||
|
variables:
|
||||||
|
TEST_NAME: cf-ospf-area
|
||||||
|
|
||||||
test-ospf-vrf:
|
test-ospf-vrf:
|
||||||
<<: *test-base
|
<<: *test-base
|
||||||
variables:
|
variables:
|
||||||
@ -611,3 +616,8 @@ test-babel-auth:
|
|||||||
<<: *test-base
|
<<: *test-base
|
||||||
variables:
|
variables:
|
||||||
TEST_NAME: cf-babel-auth
|
TEST_NAME: cf-babel-auth
|
||||||
|
|
||||||
|
test-rip-base:
|
||||||
|
<<: *test-base
|
||||||
|
variables:
|
||||||
|
TEST_NAME: cf-rip-base
|
||||||
|
@ -255,7 +255,7 @@ WHITE [ \t]
|
|||||||
return IP4;
|
return IP4;
|
||||||
}
|
}
|
||||||
|
|
||||||
{XIGIT}{2}(:{XIGIT}{2}|{XIGIT}{2}){15,} {
|
{XIGIT}{2}((:{XIGIT}{2}){15,}|({XIGIT}{2}){15,}) {
|
||||||
char *s = yytext;
|
char *s = yytext;
|
||||||
size_t len = 0, i;
|
size_t len = 0, i;
|
||||||
struct bytestring *bytes;
|
struct bytestring *bytes;
|
||||||
|
@ -335,6 +335,26 @@ ip p;
|
|||||||
p = 1234:5678::;
|
p = 1234:5678::;
|
||||||
bt_assert(!p.is_v4);
|
bt_assert(!p.is_v4);
|
||||||
bt_assert(p.mask(24) = 1234:5600::);
|
bt_assert(p.mask(24) = 1234:5600::);
|
||||||
|
|
||||||
|
p = 1:2:3:4:5:6:7:8;
|
||||||
|
bt_assert(!p.is_v4);
|
||||||
|
bt_assert(format(p) = "1:2:3:4:5:6:7:8");
|
||||||
|
bt_assert(p.mask(64) = 1:2:3:4::);
|
||||||
|
|
||||||
|
p = 10:20:30:40:50:60:70:80;
|
||||||
|
bt_assert(!p.is_v4);
|
||||||
|
bt_assert(format(p) = "10:20:30:40:50:60:70:80");
|
||||||
|
bt_assert(p.mask(64) = 10:20:30:40::);
|
||||||
|
|
||||||
|
p = 1090:20a0:30b0:40c0:50d0:60e0:70f0:8000;
|
||||||
|
bt_assert(!p.is_v4);
|
||||||
|
bt_assert(format(p) = "1090:20a0:30b0:40c0:50d0:60e0:70f0:8000");
|
||||||
|
bt_assert(p.mask(64) = 1090:20a0:30b0:40c0::);
|
||||||
|
|
||||||
|
p = ::fffe:6:c0c:936d:88c7:35d3;
|
||||||
|
bt_assert(!p.is_v4);
|
||||||
|
bt_assert(format(p) = "::fffe:6:c0c:936d:88c7:35d3");
|
||||||
|
bt_assert(p.mask(64) = 0:0:fffe:6::);
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_test_suite(t_ip, "Testing ip address");
|
bt_test_suite(t_ip, "Testing ip address");
|
||||||
|
@ -681,7 +681,7 @@ nl_add_multipath(struct nlmsghdr *h, uint bufsize, struct nexthop *nh, int af, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct nexthop *
|
static struct nexthop *
|
||||||
nl_parse_multipath(struct nl_parse_state *s, struct krt_proto *p, struct rtattr *ra, int af)
|
nl_parse_multipath(struct nl_parse_state *s, struct krt_proto *p, const net_addr *n, struct rtattr *ra, int af, int krt_src)
|
||||||
{
|
{
|
||||||
struct rtattr *a[BIRD_RTA_MAX];
|
struct rtattr *a[BIRD_RTA_MAX];
|
||||||
struct rtnexthop *nh = RTA_DATA(ra);
|
struct rtnexthop *nh = RTA_DATA(ra);
|
||||||
@ -695,9 +695,9 @@ nl_parse_multipath(struct nl_parse_state *s, struct krt_proto *p, struct rtattr
|
|||||||
{
|
{
|
||||||
/* Use RTNH_OK(nh,len) ?? */
|
/* Use RTNH_OK(nh,len) ?? */
|
||||||
if ((len < sizeof(*nh)) || (len < nh->rtnh_len))
|
if ((len < sizeof(*nh)) || (len < nh->rtnh_len))
|
||||||
return NULL;
|
goto err;
|
||||||
|
|
||||||
if (nh->rtnh_flags & RTNH_F_DEAD)
|
if ((nh->rtnh_flags & RTNH_F_DEAD) && (krt_src != KRT_SRC_BIRD))
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
*last = rv = lp_allocz(s->pool, NEXTHOP_MAX_SIZE);
|
*last = rv = lp_allocz(s->pool, NEXTHOP_MAX_SIZE);
|
||||||
@ -706,7 +706,10 @@ nl_parse_multipath(struct nl_parse_state *s, struct krt_proto *p, struct rtattr
|
|||||||
rv->weight = nh->rtnh_hops;
|
rv->weight = nh->rtnh_hops;
|
||||||
rv->iface = if_find_by_index(nh->rtnh_ifindex);
|
rv->iface = if_find_by_index(nh->rtnh_ifindex);
|
||||||
if (!rv->iface)
|
if (!rv->iface)
|
||||||
return NULL;
|
{
|
||||||
|
log(L_ERR "KRT: Received route %N with unknown ifindex %u", n, nh->rtnh_ifindex);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Nonexistent RTNH_PAYLOAD ?? */
|
/* Nonexistent RTNH_PAYLOAD ?? */
|
||||||
nl_attr_len = nh->rtnh_len - RTNH_LENGTH(0);
|
nl_attr_len = nh->rtnh_len - RTNH_LENGTH(0);
|
||||||
@ -714,18 +717,18 @@ nl_parse_multipath(struct nl_parse_state *s, struct krt_proto *p, struct rtattr
|
|||||||
{
|
{
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
if (!nl_parse_attrs(RTNH_DATA(nh), nexthop_attr_want4, a, sizeof(a)))
|
if (!nl_parse_attrs(RTNH_DATA(nh), nexthop_attr_want4, a, sizeof(a)))
|
||||||
return NULL;
|
goto err;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
if (!nl_parse_attrs(RTNH_DATA(nh), nexthop_attr_want6, a, sizeof(a)))
|
if (!nl_parse_attrs(RTNH_DATA(nh), nexthop_attr_want6, a, sizeof(a)))
|
||||||
return NULL;
|
goto err;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_MPLS_KERNEL
|
#ifdef HAVE_MPLS_KERNEL
|
||||||
case AF_MPLS:
|
case AF_MPLS:
|
||||||
if (!nl_parse_attrs(RTNH_DATA(nh), nexthop_attr_want_mpls, a, sizeof(a)))
|
if (!nl_parse_attrs(RTNH_DATA(nh), nexthop_attr_want_mpls, a, sizeof(a)))
|
||||||
return NULL;
|
goto err;
|
||||||
|
|
||||||
if (a[RTA_NEWDST])
|
if (a[RTA_NEWDST])
|
||||||
rv->labels = rta_get_mpls(a[RTA_NEWDST], rv->label);
|
rv->labels = rta_get_mpls(a[RTA_NEWDST], rv->label);
|
||||||
@ -734,7 +737,7 @@ nl_parse_multipath(struct nl_parse_state *s, struct krt_proto *p, struct rtattr
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a[RTA_GATEWAY])
|
if (a[RTA_GATEWAY])
|
||||||
@ -757,14 +760,19 @@ nl_parse_multipath(struct nl_parse_state *s, struct krt_proto *p, struct rtattr
|
|||||||
nbr = neigh_find(&p->p, rv->gw, rv->iface,
|
nbr = neigh_find(&p->p, rv->gw, rv->iface,
|
||||||
(rv->flags & RNF_ONLINK) ? NEF_ONLINK : 0);
|
(rv->flags & RNF_ONLINK) ? NEF_ONLINK : 0);
|
||||||
if (!nbr || (nbr->scope == SCOPE_HOST))
|
if (!nbr || (nbr->scope == SCOPE_HOST))
|
||||||
return NULL;
|
{
|
||||||
|
log(L_ERR "KRT: Received route %N with strange next-hop %I", n, rv->gw);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_MPLS_KERNEL
|
#ifdef HAVE_MPLS_KERNEL
|
||||||
if (a[RTA_ENCAP] && a[RTA_ENCAP_TYPE])
|
if (a[RTA_ENCAP] && a[RTA_ENCAP_TYPE])
|
||||||
{
|
{
|
||||||
if (rta_get_u16(a[RTA_ENCAP_TYPE]) != LWTUNNEL_ENCAP_MPLS) {
|
if (rta_get_u16(a[RTA_ENCAP_TYPE]) != LWTUNNEL_ENCAP_MPLS)
|
||||||
log(L_WARN "KRT: Unknown encapsulation method %d in multipath", rta_get_u16(a[RTA_ENCAP_TYPE]));
|
{
|
||||||
|
log(L_WARN "KRT: Received route %N with unknown encapsulation method %d",
|
||||||
|
n, rta_get_u16(a[RTA_ENCAP_TYPE]));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -785,6 +793,10 @@ nl_parse_multipath(struct nl_parse_state *s, struct krt_proto *p, struct rtattr
|
|||||||
first = nexthop_sort(first);
|
first = nexthop_sort(first);
|
||||||
|
|
||||||
return first;
|
return first;
|
||||||
|
|
||||||
|
err:
|
||||||
|
log(L_ERR "KRT: Received strange multipath route %N", n);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1682,19 +1694,16 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
|
|||||||
|
|
||||||
if (a[RTA_MULTIPATH])
|
if (a[RTA_MULTIPATH])
|
||||||
{
|
{
|
||||||
struct nexthop *nh = nl_parse_multipath(s, p, a[RTA_MULTIPATH], i->rtm_family);
|
struct nexthop *nh = nl_parse_multipath(s, p, net, a[RTA_MULTIPATH], i->rtm_family, krt_src);
|
||||||
if (!nh)
|
if (!nh)
|
||||||
{
|
SKIP("strange RTA_MULTIPATH\n");
|
||||||
log(L_ERR "KRT: Received strange multipath route %N", net);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nexthop_link(ra, nh);
|
nexthop_link(ra, nh);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i->rtm_flags & RTNH_F_DEAD)
|
if ((i->rtm_flags & RTNH_F_DEAD) && (krt_src != KRT_SRC_BIRD))
|
||||||
return;
|
SKIP("ignore RTNH_F_DEAD\n");
|
||||||
|
|
||||||
ra->nh.iface = if_find_by_index(oif);
|
ra->nh.iface = if_find_by_index(oif);
|
||||||
if (!ra->nh.iface)
|
if (!ra->nh.iface)
|
||||||
|
Loading…
Reference in New Issue
Block a user