mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 01:40:16 +00:00
zebra: Send RTPROT_ZEBRA for netlink messages missing this data
Update neighbor entries and rule entries to have the RTPROT_ZEBRA protocol value. So we can tell where things come from. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
d3d7feb597
commit
f3dbec60f2
@ -1440,6 +1440,7 @@ static void _netlink_mpls_debug(int cmd, uint32_t label, const char *routedesc)
|
|||||||
static int netlink_neigh_update(int cmd, int ifindex, uint32_t addr, char *lla,
|
static int netlink_neigh_update(int cmd, int ifindex, uint32_t addr, char *lla,
|
||||||
int llalen, ns_id_t ns_id)
|
int llalen, ns_id_t ns_id)
|
||||||
{
|
{
|
||||||
|
uint8_t protocol = RTPROT_ZEBRA;
|
||||||
struct {
|
struct {
|
||||||
struct nlmsghdr n;
|
struct nlmsghdr n;
|
||||||
struct ndmsg ndm;
|
struct ndmsg ndm;
|
||||||
@ -1460,6 +1461,8 @@ static int netlink_neigh_update(int cmd, int ifindex, uint32_t addr, char *lla,
|
|||||||
req.ndm.ndm_ifindex = ifindex;
|
req.ndm.ndm_ifindex = ifindex;
|
||||||
req.ndm.ndm_type = RTN_UNICAST;
|
req.ndm.ndm_type = RTN_UNICAST;
|
||||||
|
|
||||||
|
addattr_l(&req.n, sizeof(req),
|
||||||
|
NDA_PROTOCOL, &protocol, sizeof(protocol));
|
||||||
addattr_l(&req.n, sizeof(req), NDA_DST, &addr, 4);
|
addattr_l(&req.n, sizeof(req), NDA_DST, &addr, 4);
|
||||||
addattr_l(&req.n, sizeof(req), NDA_LLADDR, lla, llalen);
|
addattr_l(&req.n, sizeof(req), NDA_LLADDR, lla, llalen);
|
||||||
|
|
||||||
@ -1930,6 +1933,7 @@ int kernel_neigh_update(int add, int ifindex, uint32_t addr, char *lla,
|
|||||||
static int netlink_vxlan_flood_update_ctx(const struct zebra_dplane_ctx *ctx,
|
static int netlink_vxlan_flood_update_ctx(const struct zebra_dplane_ctx *ctx,
|
||||||
int cmd)
|
int cmd)
|
||||||
{
|
{
|
||||||
|
uint8_t protocol = RTPROT_ZEBRA;
|
||||||
struct {
|
struct {
|
||||||
struct nlmsghdr n;
|
struct nlmsghdr n;
|
||||||
struct ndmsg ndm;
|
struct ndmsg ndm;
|
||||||
@ -1950,6 +1954,8 @@ static int netlink_vxlan_flood_update_ctx(const struct zebra_dplane_ctx *ctx,
|
|||||||
req.ndm.ndm_flags |= NTF_SELF; // Handle by "self", not "master"
|
req.ndm.ndm_flags |= NTF_SELF; // Handle by "self", not "master"
|
||||||
|
|
||||||
|
|
||||||
|
addattr_l(&req.n, sizeof(req),
|
||||||
|
NDA_PROTOCOL, &protocol, sizeof(protocol));
|
||||||
addattr_l(&req.n, sizeof(req), NDA_LLADDR, &dst_mac, 6);
|
addattr_l(&req.n, sizeof(req), NDA_LLADDR, &dst_mac, 6);
|
||||||
req.ndm.ndm_ifindex = dplane_ctx_get_ifindex(ctx);
|
req.ndm.ndm_ifindex = dplane_ctx_get_ifindex(ctx);
|
||||||
|
|
||||||
@ -2297,6 +2303,7 @@ int netlink_macfdb_read_specific_mac(struct zebra_ns *zns,
|
|||||||
static enum zebra_dplane_result
|
static enum zebra_dplane_result
|
||||||
netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx)
|
netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx)
|
||||||
{
|
{
|
||||||
|
uint8_t protocol = RTPROT_ZEBRA;
|
||||||
struct {
|
struct {
|
||||||
struct nlmsghdr n;
|
struct nlmsghdr n;
|
||||||
struct ndmsg ndm;
|
struct ndmsg ndm;
|
||||||
@ -2330,6 +2337,8 @@ netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx)
|
|||||||
else
|
else
|
||||||
req.ndm.ndm_flags |= NTF_EXT_LEARNED;
|
req.ndm.ndm_flags |= NTF_EXT_LEARNED;
|
||||||
|
|
||||||
|
addattr_l(&req.n, sizeof(req),
|
||||||
|
NDA_PROTOCOL, &protocol, sizeof(protocol));
|
||||||
addattr_l(&req.n, sizeof(req), NDA_LLADDR,
|
addattr_l(&req.n, sizeof(req), NDA_LLADDR,
|
||||||
dplane_ctx_mac_get_addr(ctx), 6);
|
dplane_ctx_mac_get_addr(ctx), 6);
|
||||||
req.ndm.ndm_ifindex = dplane_ctx_get_ifindex(ctx);
|
req.ndm.ndm_ifindex = dplane_ctx_get_ifindex(ctx);
|
||||||
@ -2748,6 +2757,7 @@ int netlink_neigh_change(struct nlmsghdr *h, ns_id_t ns_id)
|
|||||||
static int netlink_neigh_update_ctx(const struct zebra_dplane_ctx *ctx,
|
static int netlink_neigh_update_ctx(const struct zebra_dplane_ctx *ctx,
|
||||||
int cmd)
|
int cmd)
|
||||||
{
|
{
|
||||||
|
uint8_t protocol = RTPROT_ZEBRA;
|
||||||
struct {
|
struct {
|
||||||
struct nlmsghdr n;
|
struct nlmsghdr n;
|
||||||
struct ndmsg ndm;
|
struct ndmsg ndm;
|
||||||
@ -2782,6 +2792,8 @@ static int netlink_neigh_update_ctx(const struct zebra_dplane_ctx *ctx,
|
|||||||
req.ndm.ndm_type = RTN_UNICAST;
|
req.ndm.ndm_type = RTN_UNICAST;
|
||||||
req.ndm.ndm_flags = flags;
|
req.ndm.ndm_flags = flags;
|
||||||
|
|
||||||
|
addattr_l(&req.n, sizeof(req),
|
||||||
|
NDA_PROTOCOL, &protocol, sizeof(protocol));
|
||||||
ipa_len = IS_IPADDR_V4(ip) ? IPV4_MAX_BYTELEN : IPV6_MAX_BYTELEN;
|
ipa_len = IS_IPADDR_V4(ip) ? IPV4_MAX_BYTELEN : IPV6_MAX_BYTELEN;
|
||||||
addattr_l(&req.n, sizeof(req), NDA_DST, &ip->ip.addr, ipa_len);
|
addattr_l(&req.n, sizeof(req), NDA_DST, &ip->ip.addr, ipa_len);
|
||||||
if (mac)
|
if (mac)
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
*/
|
*/
|
||||||
static int netlink_rule_update(int cmd, struct zebra_pbr_rule *rule)
|
static int netlink_rule_update(int cmd, struct zebra_pbr_rule *rule)
|
||||||
{
|
{
|
||||||
|
uint8_t protocol = RTPROT_ZEBRA;
|
||||||
int family;
|
int family;
|
||||||
int bytelen;
|
int bytelen;
|
||||||
struct {
|
struct {
|
||||||
@ -78,6 +79,9 @@ static int netlink_rule_update(int cmd, struct zebra_pbr_rule *rule)
|
|||||||
req.frh.family = family;
|
req.frh.family = family;
|
||||||
req.frh.action = FR_ACT_TO_TBL;
|
req.frh.action = FR_ACT_TO_TBL;
|
||||||
|
|
||||||
|
addattr_l(&req.n, sizeof(req),
|
||||||
|
FRA_PROTOCOL, &protocol, sizeof(protocol));
|
||||||
|
|
||||||
/* rule's pref # */
|
/* rule's pref # */
|
||||||
addattr32(&req.n, sizeof(req), FRA_PRIORITY, rule->rule.priority);
|
addattr32(&req.n, sizeof(req), FRA_PRIORITY, rule->rule.priority);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user