mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-15 19:02:17 +00:00
zebra: add xxxNETCONF messages to the netlink BPF filter
Allow self-produced xxxNETCONF netlink messages through the BPF filter we use. Just like address-configuration actions, we'll process NETCONF changes in one path, whether the changes were generated by zebra or by something else in the host OS. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
This commit is contained in:
parent
777f96503e
commit
9f3f1486c8
@ -38,7 +38,6 @@
|
|||||||
#include "lib_errors.h"
|
#include "lib_errors.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
|
|
||||||
//#include "zebra/zserv.h"
|
|
||||||
#include "zebra/zebra_router.h"
|
#include "zebra/zebra_router.h"
|
||||||
#include "zebra/zebra_ns.h"
|
#include "zebra/zebra_ns.h"
|
||||||
#include "zebra/zebra_vrf.h"
|
#include "zebra/zebra_vrf.h"
|
||||||
@ -414,7 +413,12 @@ static int dplane_netlink_information_fetch(struct nlmsghdr *h, ns_id_t ns_id,
|
|||||||
case RTM_DELADDR:
|
case RTM_DELADDR:
|
||||||
return netlink_interface_addr_dplane(h, ns_id, startup);
|
return netlink_interface_addr_dplane(h, ns_id, startup);
|
||||||
|
|
||||||
/* TODO */
|
case RTM_NEWNETCONF:
|
||||||
|
case RTM_DELNETCONF:
|
||||||
|
return netlink_netconf_change(h, ns_id, startup);
|
||||||
|
|
||||||
|
/* TODO -- other messages for the dplane socket and pthread */
|
||||||
|
|
||||||
case RTM_NEWLINK:
|
case RTM_NEWLINK:
|
||||||
case RTM_DELLINK:
|
case RTM_DELLINK:
|
||||||
|
|
||||||
@ -463,8 +467,8 @@ int kernel_dplane_read(struct zebra_dplane_info *info)
|
|||||||
* then the normal course of operations). We are intentionally
|
* then the normal course of operations). We are intentionally
|
||||||
* allowing some messages from ourselves through
|
* allowing some messages from ourselves through
|
||||||
* ( I'm looking at you Interface based netlink messages )
|
* ( I'm looking at you Interface based netlink messages )
|
||||||
* so that we only had to write one way to handle incoming
|
* so that we only have to write one way to handle incoming
|
||||||
* address add/delete changes.
|
* address add/delete and xxxNETCONF changes.
|
||||||
*/
|
*/
|
||||||
static void netlink_install_filter(int sock, uint32_t pid, uint32_t dplane_pid)
|
static void netlink_install_filter(int sock, uint32_t pid, uint32_t dplane_pid)
|
||||||
{
|
{
|
||||||
@ -480,7 +484,8 @@ static void netlink_install_filter(int sock, uint32_t pid, uint32_t dplane_pid)
|
|||||||
* if (nlmsg_pid == pid ||
|
* if (nlmsg_pid == pid ||
|
||||||
* nlmsg_pid == dplane_pid) {
|
* nlmsg_pid == dplane_pid) {
|
||||||
* if (the incoming nlmsg_type ==
|
* if (the incoming nlmsg_type ==
|
||||||
* RTM_NEWADDR | RTM_DELADDR)
|
* RTM_NEWADDR || RTM_DELADDR || RTM_NEWNETCONF ||
|
||||||
|
* RTM_DELNETCONF)
|
||||||
* keep this message
|
* keep this message
|
||||||
* else
|
* else
|
||||||
* skip this message
|
* skip this message
|
||||||
@ -499,7 +504,7 @@ static void netlink_install_filter(int sock, uint32_t pid, uint32_t dplane_pid)
|
|||||||
/*
|
/*
|
||||||
* 2: Compare to dplane pid
|
* 2: Compare to dplane pid
|
||||||
*/
|
*/
|
||||||
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, htonl(dplane_pid), 0, 4),
|
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, htonl(dplane_pid), 0, 6),
|
||||||
/*
|
/*
|
||||||
* 3: Load the nlmsg_type into BPF register
|
* 3: Load the nlmsg_type into BPF register
|
||||||
*/
|
*/
|
||||||
@ -508,17 +513,27 @@ static void netlink_install_filter(int sock, uint32_t pid, uint32_t dplane_pid)
|
|||||||
/*
|
/*
|
||||||
* 4: Compare to RTM_NEWADDR
|
* 4: Compare to RTM_NEWADDR
|
||||||
*/
|
*/
|
||||||
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, htons(RTM_NEWADDR), 2, 0),
|
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, htons(RTM_NEWADDR), 4, 0),
|
||||||
/*
|
/*
|
||||||
* 5: Compare to RTM_DELADDR
|
* 5: Compare to RTM_DELADDR
|
||||||
*/
|
*/
|
||||||
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, htons(RTM_DELADDR), 1, 0),
|
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, htons(RTM_DELADDR), 3, 0),
|
||||||
/*
|
/*
|
||||||
* 6: This is the end state of we want to skip the
|
* 6: Compare to RTM_NEWNETCONF
|
||||||
|
*/
|
||||||
|
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, htons(RTM_NEWNETCONF), 2,
|
||||||
|
0),
|
||||||
|
/*
|
||||||
|
* 7: Compare to RTM_DELNETCONF
|
||||||
|
*/
|
||||||
|
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, htons(RTM_DELNETCONF), 1,
|
||||||
|
0),
|
||||||
|
/*
|
||||||
|
* 8: This is the end state of we want to skip the
|
||||||
* message
|
* message
|
||||||
*/
|
*/
|
||||||
BPF_STMT(BPF_RET | BPF_K, 0),
|
BPF_STMT(BPF_RET | BPF_K, 0),
|
||||||
/* 7: This is the end state of we want to keep
|
/* 9: This is the end state of we want to keep
|
||||||
* the message
|
* the message
|
||||||
*/
|
*/
|
||||||
BPF_STMT(BPF_RET | BPF_K, 0xffff),
|
BPF_STMT(BPF_RET | BPF_K, 0xffff),
|
||||||
|
Loading…
Reference in New Issue
Block a user