mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 14:55:37 +03:00
network: bridgeFDB: rename FdbEntry -> BridgeFDB
This commit is contained in:
parent
354dadb30f
commit
9671ae9d51
@ -57,6 +57,8 @@ sources = files('''
|
|||||||
networkd-address-pool.h
|
networkd-address-pool.h
|
||||||
networkd-address.c
|
networkd-address.c
|
||||||
networkd-address.h
|
networkd-address.h
|
||||||
|
networkd-bridge-fdb.c
|
||||||
|
networkd-bridge-fdb.h
|
||||||
networkd-brvlan.c
|
networkd-brvlan.c
|
||||||
networkd-brvlan.h
|
networkd-brvlan.h
|
||||||
networkd-can.c
|
networkd-can.c
|
||||||
@ -73,8 +75,6 @@ sources = files('''
|
|||||||
networkd-dhcp4.h
|
networkd-dhcp4.h
|
||||||
networkd-dhcp6.c
|
networkd-dhcp6.c
|
||||||
networkd-dhcp6.h
|
networkd-dhcp6.h
|
||||||
networkd-fdb.c
|
|
||||||
networkd-fdb.h
|
|
||||||
networkd-ipv4ll.c
|
networkd-ipv4ll.c
|
||||||
networkd-ipv4ll.h
|
networkd-ipv4ll.h
|
||||||
networkd-ipv6-proxy-ndp.c
|
networkd-ipv6-proxy-ndp.c
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "bridge.h"
|
#include "bridge.h"
|
||||||
#include "netlink-util.h"
|
#include "netlink-util.h"
|
||||||
#include "networkd-fdb.h"
|
#include "networkd-bridge-fdb.h"
|
||||||
#include "networkd-link.h"
|
#include "networkd-link.h"
|
||||||
#include "networkd-manager.h"
|
#include "networkd-manager.h"
|
||||||
#include "networkd-network.h"
|
#include "networkd-network.h"
|
||||||
@ -18,33 +18,33 @@
|
|||||||
#include "vlan-util.h"
|
#include "vlan-util.h"
|
||||||
#include "vxlan.h"
|
#include "vxlan.h"
|
||||||
|
|
||||||
#define STATIC_FDB_ENTRIES_PER_NETWORK_MAX 1024U
|
#define STATIC_BRIDGE_FDB_ENTRIES_PER_NETWORK_MAX 1024U
|
||||||
|
|
||||||
/* remove and FDB entry. */
|
/* remove and FDB entry. */
|
||||||
FdbEntry *fdb_entry_free(FdbEntry *fdb_entry) {
|
BridgeFDB *bridge_fdb_free(BridgeFDB *fdb) {
|
||||||
if (!fdb_entry)
|
if (!fdb)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (fdb_entry->network) {
|
if (fdb->network) {
|
||||||
assert(fdb_entry->section);
|
assert(fdb->section);
|
||||||
hashmap_remove(fdb_entry->network->fdb_entries_by_section, fdb_entry->section);
|
hashmap_remove(fdb->network->bridge_fdb_entries_by_section, fdb->section);
|
||||||
}
|
}
|
||||||
|
|
||||||
network_config_section_free(fdb_entry->section);
|
network_config_section_free(fdb->section);
|
||||||
return mfree(fdb_entry);
|
return mfree(fdb);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_NETWORK_SECTION_FUNCTIONS(FdbEntry, fdb_entry_free);
|
DEFINE_NETWORK_SECTION_FUNCTIONS(BridgeFDB, bridge_fdb_free);
|
||||||
|
|
||||||
/* create a new FDB entry or get an existing one. */
|
/* create a new FDB entry or get an existing one. */
|
||||||
static int fdb_entry_new_static(
|
static int bridge_fdb_new_static(
|
||||||
Network *network,
|
Network *network,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
unsigned section_line,
|
unsigned section_line,
|
||||||
FdbEntry **ret) {
|
BridgeFDB **ret) {
|
||||||
|
|
||||||
_cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
|
_cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
|
||||||
_cleanup_(fdb_entry_freep) FdbEntry *fdb_entry = NULL;
|
_cleanup_(bridge_fdb_freep) BridgeFDB *fdb = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(network);
|
assert(network);
|
||||||
@ -57,34 +57,34 @@ static int fdb_entry_new_static(
|
|||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* search entry in hashmap first. */
|
/* search entry in hashmap first. */
|
||||||
fdb_entry = hashmap_get(network->fdb_entries_by_section, n);
|
fdb = hashmap_get(network->bridge_fdb_entries_by_section, n);
|
||||||
if (fdb_entry) {
|
if (fdb) {
|
||||||
*ret = TAKE_PTR(fdb_entry);
|
*ret = TAKE_PTR(fdb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hashmap_size(network->fdb_entries_by_section) >= STATIC_FDB_ENTRIES_PER_NETWORK_MAX)
|
if (hashmap_size(network->bridge_fdb_entries_by_section) >= STATIC_BRIDGE_FDB_ENTRIES_PER_NETWORK_MAX)
|
||||||
return -E2BIG;
|
return -E2BIG;
|
||||||
|
|
||||||
/* allocate space for and FDB entry. */
|
/* allocate space for and FDB entry. */
|
||||||
fdb_entry = new(FdbEntry, 1);
|
fdb = new(BridgeFDB, 1);
|
||||||
if (!fdb_entry)
|
if (!fdb)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* init FDB structure. */
|
/* init FDB structure. */
|
||||||
*fdb_entry = (FdbEntry) {
|
*fdb = (BridgeFDB) {
|
||||||
.network = network,
|
.network = network,
|
||||||
.section = TAKE_PTR(n),
|
.section = TAKE_PTR(n),
|
||||||
.vni = VXLAN_VID_MAX + 1,
|
.vni = VXLAN_VID_MAX + 1,
|
||||||
.fdb_ntf_flags = NEIGHBOR_CACHE_ENTRY_FLAGS_SELF,
|
.ntf_flags = NEIGHBOR_CACHE_ENTRY_FLAGS_SELF,
|
||||||
};
|
};
|
||||||
|
|
||||||
r = hashmap_ensure_put(&network->fdb_entries_by_section, &network_config_hash_ops, fdb_entry->section, fdb_entry);
|
r = hashmap_ensure_put(&network->bridge_fdb_entries_by_section, &network_config_hash_ops, fdb->section, fdb);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* return allocated FDB structure. */
|
/* return allocated FDB structure. */
|
||||||
*ret = TAKE_PTR(fdb_entry);
|
*ret = TAKE_PTR(fdb);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -108,21 +108,21 @@ static int set_fdb_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* send a request to the kernel to add a FDB entry in its static MAC table. */
|
/* send a request to the kernel to add a FDB entry in its static MAC table. */
|
||||||
static int fdb_entry_configure(Link *link, FdbEntry *fdb_entry) {
|
static int bridge_fdb_configure(Link *link, BridgeFDB *fdb) {
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
assert(link->network);
|
assert(link->network);
|
||||||
assert(link->manager);
|
assert(link->manager);
|
||||||
assert(fdb_entry);
|
assert(fdb);
|
||||||
|
|
||||||
/* create new RTM message */
|
/* create new RTM message */
|
||||||
r = sd_rtnl_message_new_neigh(link->manager->rtnl, &req, RTM_NEWNEIGH, link->ifindex, AF_BRIDGE);
|
r = sd_rtnl_message_new_neigh(link->manager->rtnl, &req, RTM_NEWNEIGH, link->ifindex, AF_BRIDGE);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not create RTM_NEWNEIGH message: %m");
|
return log_link_error_errno(link, r, "Could not create RTM_NEWNEIGH message: %m");
|
||||||
|
|
||||||
r = sd_rtnl_message_neigh_set_flags(req, fdb_entry->fdb_ntf_flags);
|
r = sd_rtnl_message_neigh_set_flags(req, fdb->ntf_flags);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not set neighbor flags: %m");
|
return log_link_error_errno(link, r, "Could not set neighbor flags: %m");
|
||||||
|
|
||||||
@ -131,25 +131,25 @@ static int fdb_entry_configure(Link *link, FdbEntry *fdb_entry) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not set neighbor state: %m");
|
return log_link_error_errno(link, r, "Could not set neighbor state: %m");
|
||||||
|
|
||||||
r = sd_netlink_message_append_data(req, NDA_LLADDR, &fdb_entry->mac_addr, sizeof(fdb_entry->mac_addr));
|
r = sd_netlink_message_append_data(req, NDA_LLADDR, &fdb->mac_addr, sizeof(fdb->mac_addr));
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not append NDA_LLADDR attribute: %m");
|
return log_link_error_errno(link, r, "Could not append NDA_LLADDR attribute: %m");
|
||||||
|
|
||||||
/* VLAN Id is optional. We'll add VLAN Id only if it's specified. */
|
/* VLAN Id is optional. We'll add VLAN Id only if it's specified. */
|
||||||
if (fdb_entry->vlan_id > 0) {
|
if (fdb->vlan_id > 0) {
|
||||||
r = sd_netlink_message_append_u16(req, NDA_VLAN, fdb_entry->vlan_id);
|
r = sd_netlink_message_append_u16(req, NDA_VLAN, fdb->vlan_id);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not append NDA_VLAN attribute: %m");
|
return log_link_error_errno(link, r, "Could not append NDA_VLAN attribute: %m");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_addr_is_set(fdb_entry->family, &fdb_entry->destination_addr)) {
|
if (in_addr_is_set(fdb->family, &fdb->destination_addr)) {
|
||||||
r = netlink_message_append_in_addr_union(req, NDA_DST, fdb_entry->family, &fdb_entry->destination_addr);
|
r = netlink_message_append_in_addr_union(req, NDA_DST, fdb->family, &fdb->destination_addr);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not append NDA_DST attribute: %m");
|
return log_link_error_errno(link, r, "Could not append NDA_DST attribute: %m");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fdb_entry->vni <= VXLAN_VID_MAX) {
|
if (fdb->vni <= VXLAN_VID_MAX) {
|
||||||
r = sd_netlink_message_append_u32(req, NDA_VNI, fdb_entry->vni);
|
r = sd_netlink_message_append_u32(req, NDA_VNI, fdb->vni);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not append NDA_VNI attribute: %m");
|
return log_link_error_errno(link, r, "Could not append NDA_VNI attribute: %m");
|
||||||
}
|
}
|
||||||
@ -166,14 +166,14 @@ static int fdb_entry_configure(Link *link, FdbEntry *fdb_entry) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int link_set_bridge_fdb(Link *link) {
|
int link_set_bridge_fdb(Link *link) {
|
||||||
FdbEntry *fdb_entry;
|
BridgeFDB *fdb;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
assert(link->network);
|
assert(link->network);
|
||||||
|
|
||||||
HASHMAP_FOREACH(fdb_entry, link->network->fdb_entries_by_section) {
|
HASHMAP_FOREACH(fdb, link->network->bridge_fdb_entries_by_section) {
|
||||||
r = fdb_entry_configure(link, fdb_entry);
|
r = bridge_fdb_configure(link, fdb);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Failed to add MAC entry to static MAC table: %m");
|
return log_link_error_errno(link, r, "Failed to add MAC entry to static MAC table: %m");
|
||||||
}
|
}
|
||||||
@ -181,14 +181,14 @@ int link_set_bridge_fdb(Link *link) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void network_drop_invalid_fdb_entries(Network *network) {
|
void network_drop_invalid_bridge_fdb_entries(Network *network) {
|
||||||
FdbEntry *fdb_entry;
|
BridgeFDB *fdb;
|
||||||
|
|
||||||
assert(network);
|
assert(network);
|
||||||
|
|
||||||
HASHMAP_FOREACH(fdb_entry, network->fdb_entries_by_section)
|
HASHMAP_FOREACH(fdb, network->bridge_fdb_entries_by_section)
|
||||||
if (section_is_invalid(fdb_entry->section))
|
if (section_is_invalid(fdb->section))
|
||||||
fdb_entry_free(fdb_entry);
|
bridge_fdb_free(fdb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parse the HW address from config files. */
|
/* parse the HW address from config files. */
|
||||||
@ -204,8 +204,8 @@ int config_parse_fdb_hwaddr(
|
|||||||
void *data,
|
void *data,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
|
|
||||||
|
_cleanup_(bridge_fdb_free_or_set_invalidp) BridgeFDB *fdb = NULL;
|
||||||
Network *network = userdata;
|
Network *network = userdata;
|
||||||
_cleanup_(fdb_entry_free_or_set_invalidp) FdbEntry *fdb_entry = NULL;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(filename);
|
assert(filename);
|
||||||
@ -214,18 +214,17 @@ int config_parse_fdb_hwaddr(
|
|||||||
assert(rvalue);
|
assert(rvalue);
|
||||||
assert(data);
|
assert(data);
|
||||||
|
|
||||||
r = fdb_entry_new_static(network, filename, section_line, &fdb_entry);
|
r = bridge_fdb_new_static(network, filename, section_line, &fdb);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
r = ether_addr_from_string(rvalue, &fdb_entry->mac_addr);
|
r = ether_addr_from_string(rvalue, &fdb->mac_addr);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Not a valid MAC address, ignoring assignment: %s", rvalue);
|
log_syntax(unit, LOG_WARNING, filename, line, r, "Not a valid MAC address, ignoring assignment: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fdb_entry = NULL;
|
TAKE_PTR(fdb);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,8 +241,8 @@ int config_parse_fdb_vlan_id(
|
|||||||
void *data,
|
void *data,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
|
|
||||||
|
_cleanup_(bridge_fdb_free_or_set_invalidp) BridgeFDB *fdb = NULL;
|
||||||
Network *network = userdata;
|
Network *network = userdata;
|
||||||
_cleanup_(fdb_entry_free_or_set_invalidp) FdbEntry *fdb_entry = NULL;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(filename);
|
assert(filename);
|
||||||
@ -252,18 +251,17 @@ int config_parse_fdb_vlan_id(
|
|||||||
assert(rvalue);
|
assert(rvalue);
|
||||||
assert(data);
|
assert(data);
|
||||||
|
|
||||||
r = fdb_entry_new_static(network, filename, section_line, &fdb_entry);
|
r = bridge_fdb_new_static(network, filename, section_line, &fdb);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
r = config_parse_vlanid(unit, filename, line, section,
|
r = config_parse_vlanid(unit, filename, line, section,
|
||||||
section_line, lvalue, ltype,
|
section_line, lvalue, ltype,
|
||||||
rvalue, &fdb_entry->vlan_id, userdata);
|
rvalue, &fdb->vlan_id, userdata);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
fdb_entry = NULL;
|
TAKE_PTR(fdb);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +277,7 @@ int config_parse_fdb_destination(
|
|||||||
void *data,
|
void *data,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
|
|
||||||
_cleanup_(fdb_entry_free_or_set_invalidp) FdbEntry *fdb_entry = NULL;
|
_cleanup_(bridge_fdb_free_or_set_invalidp) BridgeFDB *fdb = NULL;
|
||||||
Network *network = userdata;
|
Network *network = userdata;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -289,11 +287,11 @@ int config_parse_fdb_destination(
|
|||||||
assert(rvalue);
|
assert(rvalue);
|
||||||
assert(data);
|
assert(data);
|
||||||
|
|
||||||
r = fdb_entry_new_static(network, filename, section_line, &fdb_entry);
|
r = bridge_fdb_new_static(network, filename, section_line, &fdb);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
r = in_addr_from_string_auto(rvalue, &fdb_entry->family, &fdb_entry->destination_addr);
|
r = in_addr_from_string_auto(rvalue, &fdb->family, &fdb->destination_addr);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
"FDB destination IP address is invalid, ignoring assignment: %s",
|
"FDB destination IP address is invalid, ignoring assignment: %s",
|
||||||
@ -301,8 +299,7 @@ int config_parse_fdb_destination(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fdb_entry = NULL;
|
TAKE_PTR(fdb);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +315,7 @@ int config_parse_fdb_vxlan_vni(
|
|||||||
void *data,
|
void *data,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
|
|
||||||
_cleanup_(fdb_entry_free_or_set_invalidp) FdbEntry *fdb_entry = NULL;
|
_cleanup_(bridge_fdb_free_or_set_invalidp) BridgeFDB *fdb = NULL;
|
||||||
Network *network = userdata;
|
Network *network = userdata;
|
||||||
uint32_t vni;
|
uint32_t vni;
|
||||||
int r;
|
int r;
|
||||||
@ -329,7 +326,7 @@ int config_parse_fdb_vxlan_vni(
|
|||||||
assert(rvalue);
|
assert(rvalue);
|
||||||
assert(data);
|
assert(data);
|
||||||
|
|
||||||
r = fdb_entry_new_static(network, filename, section_line, &fdb_entry);
|
r = bridge_fdb_new_static(network, filename, section_line, &fdb);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
@ -348,20 +345,20 @@ int config_parse_fdb_vxlan_vni(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fdb_entry->vni = vni;
|
fdb->vni = vni;
|
||||||
fdb_entry = NULL;
|
|
||||||
|
|
||||||
|
TAKE_PTR(fdb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* const fdb_ntf_flags_table[_NEIGHBOR_CACHE_ENTRY_FLAGS_MAX] = {
|
static const char* const ntf_flags_table[_NEIGHBOR_CACHE_ENTRY_FLAGS_MAX] = {
|
||||||
[NEIGHBOR_CACHE_ENTRY_FLAGS_USE] = "use",
|
[NEIGHBOR_CACHE_ENTRY_FLAGS_USE] = "use",
|
||||||
[NEIGHBOR_CACHE_ENTRY_FLAGS_SELF] = "self",
|
[NEIGHBOR_CACHE_ENTRY_FLAGS_SELF] = "self",
|
||||||
[NEIGHBOR_CACHE_ENTRY_FLAGS_MASTER] = "master",
|
[NEIGHBOR_CACHE_ENTRY_FLAGS_MASTER] = "master",
|
||||||
[NEIGHBOR_CACHE_ENTRY_FLAGS_ROUTER] = "router",
|
[NEIGHBOR_CACHE_ENTRY_FLAGS_ROUTER] = "router",
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(fdb_ntf_flags, NeighborCacheEntryFlags);
|
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(ntf_flags, NeighborCacheEntryFlags);
|
||||||
|
|
||||||
int config_parse_fdb_ntf_flags(
|
int config_parse_fdb_ntf_flags(
|
||||||
const char *unit,
|
const char *unit,
|
||||||
@ -375,8 +372,9 @@ int config_parse_fdb_ntf_flags(
|
|||||||
void *data,
|
void *data,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
|
|
||||||
_cleanup_(fdb_entry_free_or_set_invalidp) FdbEntry *fdb_entry = NULL;
|
_cleanup_(bridge_fdb_free_or_set_invalidp) BridgeFDB *fdb = NULL;
|
||||||
Network *network = userdata;
|
Network *network = userdata;
|
||||||
|
NeighborCacheEntryFlags f;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(filename);
|
assert(filename);
|
||||||
@ -385,11 +383,11 @@ int config_parse_fdb_ntf_flags(
|
|||||||
assert(rvalue);
|
assert(rvalue);
|
||||||
assert(data);
|
assert(data);
|
||||||
|
|
||||||
r = fdb_entry_new_static(network, filename, section_line, &fdb_entry);
|
r = bridge_fdb_new_static(network, filename, section_line, &fdb);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
NeighborCacheEntryFlags f = fdb_ntf_flags_from_string(rvalue);
|
f = ntf_flags_from_string(rvalue);
|
||||||
if (f < 0) {
|
if (f < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, f,
|
log_syntax(unit, LOG_WARNING, filename, line, f,
|
||||||
"FDB failed to parse AssociatedWith=, ignoring assignment: %s",
|
"FDB failed to parse AssociatedWith=, ignoring assignment: %s",
|
||||||
@ -397,8 +395,8 @@ int config_parse_fdb_ntf_flags(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fdb_entry->fdb_ntf_flags = f;
|
fdb->ntf_flags = f;
|
||||||
fdb_entry = NULL;
|
|
||||||
|
|
||||||
|
TAKE_PTR(fdb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -13,8 +13,8 @@
|
|||||||
#include "in-addr-util.h"
|
#include "in-addr-util.h"
|
||||||
#include "networkd-util.h"
|
#include "networkd-util.h"
|
||||||
|
|
||||||
typedef struct Network Network;
|
|
||||||
typedef struct Link Link;
|
typedef struct Link Link;
|
||||||
|
typedef struct Network Network;
|
||||||
|
|
||||||
typedef enum NeighborCacheEntryFlags {
|
typedef enum NeighborCacheEntryFlags {
|
||||||
NEIGHBOR_CACHE_ENTRY_FLAGS_USE = NTF_USE,
|
NEIGHBOR_CACHE_ENTRY_FLAGS_USE = NTF_USE,
|
||||||
@ -25,7 +25,7 @@ typedef enum NeighborCacheEntryFlags {
|
|||||||
_NEIGHBOR_CACHE_ENTRY_FLAGS_INVALID = -EINVAL,
|
_NEIGHBOR_CACHE_ENTRY_FLAGS_INVALID = -EINVAL,
|
||||||
} NeighborCacheEntryFlags;
|
} NeighborCacheEntryFlags;
|
||||||
|
|
||||||
typedef struct FdbEntry {
|
typedef struct BridgeFDB {
|
||||||
Network *network;
|
Network *network;
|
||||||
NetworkConfigSection *section;
|
NetworkConfigSection *section;
|
||||||
|
|
||||||
@ -36,12 +36,12 @@ typedef struct FdbEntry {
|
|||||||
|
|
||||||
struct ether_addr mac_addr;
|
struct ether_addr mac_addr;
|
||||||
union in_addr_union destination_addr;
|
union in_addr_union destination_addr;
|
||||||
NeighborCacheEntryFlags fdb_ntf_flags;
|
NeighborCacheEntryFlags ntf_flags;
|
||||||
} FdbEntry;
|
} BridgeFDB;
|
||||||
|
|
||||||
FdbEntry *fdb_entry_free(FdbEntry *fdb_entry);
|
BridgeFDB *bridge_fdb_free(BridgeFDB *fdb);
|
||||||
|
|
||||||
void network_drop_invalid_fdb_entries(Network *network);
|
void network_drop_invalid_bridge_fdb_entries(Network *network);
|
||||||
|
|
||||||
int link_set_bridge_fdb(Link *link);
|
int link_set_bridge_fdb(Link *link);
|
||||||
|
|
@ -27,11 +27,11 @@
|
|||||||
#include "network-internal.h"
|
#include "network-internal.h"
|
||||||
#include "networkd-address-label.h"
|
#include "networkd-address-label.h"
|
||||||
#include "networkd-address.h"
|
#include "networkd-address.h"
|
||||||
|
#include "networkd-bridge-fdb.h"
|
||||||
#include "networkd-can.h"
|
#include "networkd-can.h"
|
||||||
#include "networkd-dhcp-server.h"
|
#include "networkd-dhcp-server.h"
|
||||||
#include "networkd-dhcp4.h"
|
#include "networkd-dhcp4.h"
|
||||||
#include "networkd-dhcp6.h"
|
#include "networkd-dhcp6.h"
|
||||||
#include "networkd-fdb.h"
|
|
||||||
#include "networkd-ipv4ll.h"
|
#include "networkd-ipv4ll.h"
|
||||||
#include "networkd-ipv6-proxy-ndp.h"
|
#include "networkd-ipv6-proxy-ndp.h"
|
||||||
#include "networkd-link-bus.h"
|
#include "networkd-link-bus.h"
|
||||||
|
@ -9,12 +9,12 @@ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
|
|||||||
#include "net-condition.h"
|
#include "net-condition.h"
|
||||||
#include "networkd-address-label.h"
|
#include "networkd-address-label.h"
|
||||||
#include "networkd-address.h"
|
#include "networkd-address.h"
|
||||||
|
#include "networkd-bridge-fdb.h"
|
||||||
#include "networkd-can.h"
|
#include "networkd-can.h"
|
||||||
#include "networkd-dhcp-common.h"
|
#include "networkd-dhcp-common.h"
|
||||||
#include "networkd-dhcp-server.h"
|
#include "networkd-dhcp-server.h"
|
||||||
#include "networkd-dhcp4.h"
|
#include "networkd-dhcp4.h"
|
||||||
#include "networkd-dhcp6.h"
|
#include "networkd-dhcp6.h"
|
||||||
#include "networkd-fdb.h"
|
|
||||||
#include "networkd-ipv4ll.h"
|
#include "networkd-ipv4ll.h"
|
||||||
#include "networkd-ipv6-proxy-ndp.h"
|
#include "networkd-ipv6-proxy-ndp.h"
|
||||||
#include "networkd-mdb.h"
|
#include "networkd-mdb.h"
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
#include "net-condition.h"
|
#include "net-condition.h"
|
||||||
#include "networkd-address-label.h"
|
#include "networkd-address-label.h"
|
||||||
#include "networkd-address.h"
|
#include "networkd-address.h"
|
||||||
|
#include "networkd-bridge-fdb.h"
|
||||||
#include "networkd-dhcp-common.h"
|
#include "networkd-dhcp-common.h"
|
||||||
#include "networkd-dhcp-server.h"
|
#include "networkd-dhcp-server.h"
|
||||||
#include "networkd-fdb.h"
|
|
||||||
#include "networkd-manager.h"
|
#include "networkd-manager.h"
|
||||||
#include "networkd-mdb.h"
|
#include "networkd-mdb.h"
|
||||||
#include "networkd-ndisc.h"
|
#include "networkd-ndisc.h"
|
||||||
@ -230,7 +230,7 @@ int network_verify(Network *network) {
|
|||||||
network_drop_invalid_addresses(network);
|
network_drop_invalid_addresses(network);
|
||||||
network_drop_invalid_routes(network);
|
network_drop_invalid_routes(network);
|
||||||
network_drop_invalid_nexthops(network);
|
network_drop_invalid_nexthops(network);
|
||||||
network_drop_invalid_fdb_entries(network);
|
network_drop_invalid_bridge_fdb_entries(network);
|
||||||
network_drop_invalid_mdb_entries(network);
|
network_drop_invalid_mdb_entries(network);
|
||||||
network_drop_invalid_neighbors(network);
|
network_drop_invalid_neighbors(network);
|
||||||
network_drop_invalid_address_labels(network);
|
network_drop_invalid_address_labels(network);
|
||||||
@ -598,7 +598,7 @@ static Network *network_free(Network *network) {
|
|||||||
ordered_hashmap_free_with_destructor(network->addresses_by_section, address_free);
|
ordered_hashmap_free_with_destructor(network->addresses_by_section, address_free);
|
||||||
hashmap_free_with_destructor(network->routes_by_section, route_free);
|
hashmap_free_with_destructor(network->routes_by_section, route_free);
|
||||||
hashmap_free_with_destructor(network->nexthops_by_section, nexthop_free);
|
hashmap_free_with_destructor(network->nexthops_by_section, nexthop_free);
|
||||||
hashmap_free_with_destructor(network->fdb_entries_by_section, fdb_entry_free);
|
hashmap_free_with_destructor(network->bridge_fdb_entries_by_section, bridge_fdb_free);
|
||||||
hashmap_free_with_destructor(network->mdb_entries_by_section, mdb_entry_free);
|
hashmap_free_with_destructor(network->mdb_entries_by_section, mdb_entry_free);
|
||||||
hashmap_free_with_destructor(network->neighbors_by_section, neighbor_free);
|
hashmap_free_with_destructor(network->neighbors_by_section, neighbor_free);
|
||||||
hashmap_free_with_destructor(network->address_labels_by_section, address_label_free);
|
hashmap_free_with_destructor(network->address_labels_by_section, address_label_free);
|
||||||
@ -651,7 +651,7 @@ int network_get_by_name(Manager *manager, const char *name, Network **ret) {
|
|||||||
bool network_has_static_ipv6_configurations(Network *network) {
|
bool network_has_static_ipv6_configurations(Network *network) {
|
||||||
Address *address;
|
Address *address;
|
||||||
Route *route;
|
Route *route;
|
||||||
FdbEntry *fdb;
|
BridgeFDB *fdb;
|
||||||
MdbEntry *mdb;
|
MdbEntry *mdb;
|
||||||
Neighbor *neighbor;
|
Neighbor *neighbor;
|
||||||
|
|
||||||
@ -665,7 +665,7 @@ bool network_has_static_ipv6_configurations(Network *network) {
|
|||||||
if (route->family == AF_INET6)
|
if (route->family == AF_INET6)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
HASHMAP_FOREACH(fdb, network->fdb_entries_by_section)
|
HASHMAP_FOREACH(fdb, network->bridge_fdb_entries_by_section)
|
||||||
if (fdb->family == AF_INET6)
|
if (fdb->family == AF_INET6)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ struct Network {
|
|||||||
OrderedHashmap *addresses_by_section;
|
OrderedHashmap *addresses_by_section;
|
||||||
Hashmap *routes_by_section;
|
Hashmap *routes_by_section;
|
||||||
Hashmap *nexthops_by_section;
|
Hashmap *nexthops_by_section;
|
||||||
Hashmap *fdb_entries_by_section;
|
Hashmap *bridge_fdb_entries_by_section;
|
||||||
Hashmap *mdb_entries_by_section;
|
Hashmap *mdb_entries_by_section;
|
||||||
Hashmap *neighbors_by_section;
|
Hashmap *neighbors_by_section;
|
||||||
Hashmap *address_labels_by_section;
|
Hashmap *address_labels_by_section;
|
||||||
|
Loading…
Reference in New Issue
Block a user