mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-25 22:30:52 +00:00
commit
c5fd908903
@ -817,6 +817,8 @@ kernel_init (struct zebra_ns *zns)
|
|||||||
thread_add_read(zebrad.master, kernel_read, zns, zns->netlink.sock,
|
thread_add_read(zebrad.master, kernel_read, zns, zns->netlink.sock,
|
||||||
&zns->t_netlink);
|
&zns->t_netlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rt_netlink_init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -102,6 +102,21 @@ struct gw_family_t
|
|||||||
union g_addr gate;
|
union g_addr gate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
char ipv4_ll_buf[16] = "169.254.0.1";
|
||||||
|
struct in_addr ipv4_ll;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The ipv4_ll data structure is used for all 5549
|
||||||
|
* additions to the kernel. Let's figure out the
|
||||||
|
* correct value one time instead for every
|
||||||
|
* install/remove of a 5549 type route
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
rt_netlink_init (void)
|
||||||
|
{
|
||||||
|
inet_pton (AF_INET, ipv4_ll_buf, &ipv4_ll);
|
||||||
|
}
|
||||||
|
|
||||||
static inline int is_selfroute(int proto)
|
static inline int is_selfroute(int proto)
|
||||||
{
|
{
|
||||||
if ((proto == RTPROT_BGP) || (proto == RTPROT_OSPF) ||
|
if ((proto == RTPROT_BGP) || (proto == RTPROT_OSPF) ||
|
||||||
@ -678,10 +693,6 @@ _netlink_route_build_singlepath(
|
|||||||
(nexthop->type == NEXTHOP_TYPE_IPV6
|
(nexthop->type == NEXTHOP_TYPE_IPV6
|
||||||
|| nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX))
|
|| nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX))
|
||||||
{
|
{
|
||||||
char buf[16] = "169.254.0.1";
|
|
||||||
struct in_addr ipv4_ll;
|
|
||||||
|
|
||||||
inet_pton (AF_INET, buf, &ipv4_ll);
|
|
||||||
rtmsg->rtm_flags |= RTNH_F_ONLINK;
|
rtmsg->rtm_flags |= RTNH_F_ONLINK;
|
||||||
addattr_l (nlmsg, req_size, RTA_GATEWAY, &ipv4_ll, 4);
|
addattr_l (nlmsg, req_size, RTA_GATEWAY, &ipv4_ll, 4);
|
||||||
addattr32 (nlmsg, req_size, RTA_OIF, nexthop->ifindex);
|
addattr32 (nlmsg, req_size, RTA_OIF, nexthop->ifindex);
|
||||||
@ -696,10 +707,16 @@ _netlink_route_build_singlepath(
|
|||||||
if (IS_ZEBRA_DEBUG_KERNEL)
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
zlog_debug(" 5549: _netlink_route_build_singlepath() (%s): "
|
zlog_debug(" 5549: _netlink_route_build_singlepath() (%s): "
|
||||||
"nexthop via %s if %u",
|
"nexthop via %s if %u",
|
||||||
routedesc, buf, nexthop->ifindex);
|
routedesc, ipv4_ll_buf, nexthop->ifindex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* label_buf is *only* currently used within debugging.
|
||||||
|
* As such when we assign it we are guarding it inside
|
||||||
|
* a debug test. If you want to change this make sure
|
||||||
|
* you fix this assumption
|
||||||
|
*/
|
||||||
label_buf[0] = '\0';
|
label_buf[0] = '\0';
|
||||||
/* outgoing label - either as NEWDST (in the case of LSR) or as ENCAP
|
/* outgoing label - either as NEWDST (in the case of LSR) or as ENCAP
|
||||||
* (in the case of LER)
|
* (in the case of LER)
|
||||||
@ -723,13 +740,16 @@ _netlink_route_build_singlepath(
|
|||||||
{
|
{
|
||||||
bos = ((i == (nh_label->num_labels - 1)) ? 1 : 0);
|
bos = ((i == (nh_label->num_labels - 1)) ? 1 : 0);
|
||||||
out_lse[i] = mpls_lse_encode (nh_label->label[i], 0, 0, bos);
|
out_lse[i] = mpls_lse_encode (nh_label->label[i], 0, 0, bos);
|
||||||
if (!num_labels)
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
sprintf (label_buf, "label %d", nh_label->label[i]);
|
{
|
||||||
else
|
if (!num_labels)
|
||||||
{
|
sprintf (label_buf, "label %d", nh_label->label[i]);
|
||||||
sprintf (label_buf1, "/%d", nh_label->label[i]);
|
else
|
||||||
strcat (label_buf, label_buf1);
|
{
|
||||||
}
|
sprintf (label_buf1, "/%d", nh_label->label[i]);
|
||||||
|
strcat (label_buf, label_buf1);
|
||||||
|
}
|
||||||
|
}
|
||||||
num_labels++;
|
num_labels++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -883,10 +903,6 @@ _netlink_route_build_multipath(
|
|||||||
(nexthop->type == NEXTHOP_TYPE_IPV6
|
(nexthop->type == NEXTHOP_TYPE_IPV6
|
||||||
|| nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX))
|
|| nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX))
|
||||||
{
|
{
|
||||||
char buf[16] = "169.254.0.1";
|
|
||||||
struct in_addr ipv4_ll;
|
|
||||||
|
|
||||||
inet_pton (AF_INET, buf, &ipv4_ll);
|
|
||||||
bytelen = 4;
|
bytelen = 4;
|
||||||
rtnh->rtnh_flags |= RTNH_F_ONLINK;
|
rtnh->rtnh_flags |= RTNH_F_ONLINK;
|
||||||
rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY,
|
rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY,
|
||||||
@ -902,10 +918,16 @@ _netlink_route_build_multipath(
|
|||||||
if (IS_ZEBRA_DEBUG_KERNEL)
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
zlog_debug(" 5549: netlink_route_build_multipath() (%s): "
|
zlog_debug(" 5549: netlink_route_build_multipath() (%s): "
|
||||||
"nexthop via %s if %u",
|
"nexthop via %s if %u",
|
||||||
routedesc, buf, nexthop->ifindex);
|
routedesc, ipv4_ll_buf, nexthop->ifindex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* label_buf is *only* currently used within debugging.
|
||||||
|
* As such when we assign it we are guarding it inside
|
||||||
|
* a debug test. If you want to change this make sure
|
||||||
|
* you fix this assumption
|
||||||
|
*/
|
||||||
label_buf[0] = '\0';
|
label_buf[0] = '\0';
|
||||||
/* outgoing label - either as NEWDST (in the case of LSR) or as ENCAP
|
/* outgoing label - either as NEWDST (in the case of LSR) or as ENCAP
|
||||||
* (in the case of LER)
|
* (in the case of LER)
|
||||||
@ -929,13 +951,16 @@ _netlink_route_build_multipath(
|
|||||||
{
|
{
|
||||||
bos = ((i == (nh_label->num_labels - 1)) ? 1 : 0);
|
bos = ((i == (nh_label->num_labels - 1)) ? 1 : 0);
|
||||||
out_lse[i] = mpls_lse_encode (nh_label->label[i], 0, 0, bos);
|
out_lse[i] = mpls_lse_encode (nh_label->label[i], 0, 0, bos);
|
||||||
if (!num_labels)
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
sprintf (label_buf, "label %d", nh_label->label[i]);
|
{
|
||||||
else
|
if (!num_labels)
|
||||||
{
|
sprintf (label_buf, "label %d", nh_label->label[i]);
|
||||||
sprintf (label_buf1, "/%d", nh_label->label[i]);
|
else
|
||||||
strcat (label_buf, label_buf1);
|
{
|
||||||
}
|
sprintf (label_buf1, "/%d", nh_label->label[i]);
|
||||||
|
strcat (label_buf, label_buf1);
|
||||||
|
}
|
||||||
|
}
|
||||||
num_labels++;
|
num_labels++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#define RTPROT_RIP 189
|
#define RTPROT_RIP 189
|
||||||
#define RTPROT_RIPNG 190
|
#define RTPROT_RIPNG 190
|
||||||
|
|
||||||
|
void rt_netlink_init (void);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
clear_nhlfe_installed (zebra_lsp_t *lsp);
|
clear_nhlfe_installed (zebra_lsp_t *lsp);
|
||||||
|
Loading…
Reference in New Issue
Block a user