1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-31 14:50:15 +03:00

Merge pull request #22626 from yuwata/network-assorted-cleanups

network: assorted cleanups
This commit is contained in:
Yu Watanabe 2022-02-26 23:57:08 +09:00 committed by GitHub
commit 04386f56b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 10 deletions

View File

@ -210,7 +210,7 @@ const NetDevVTable batadv_vtable = {
.sections = NETDEV_COMMON_SECTIONS "BatmanAdvanced\0",
.fill_message_create = netdev_batadv_fill_message_create,
.post_create = netdev_batadv_post_create,
.create_type = NETDEV_CREATE_MASTER,
.create_type = NETDEV_CREATE_INDEPENDENT,
.iftype = ARPHRD_ETHER,
.generate_mac = true,
};

View File

@ -451,7 +451,7 @@ const NetDevVTable bond_vtable = {
.done = bond_done,
.sections = NETDEV_COMMON_SECTIONS "Bond\0",
.fill_message_create = netdev_bond_fill_message_create,
.create_type = NETDEV_CREATE_MASTER,
.create_type = NETDEV_CREATE_INDEPENDENT,
.iftype = ARPHRD_ETHER,
.generate_mac = true,
};

View File

@ -284,7 +284,7 @@ const NetDevVTable bridge_vtable = {
.init = bridge_init,
.sections = NETDEV_COMMON_SECTIONS "Bridge\0",
.post_create = netdev_bridge_post_create,
.create_type = NETDEV_CREATE_MASTER,
.create_type = NETDEV_CREATE_INDEPENDENT,
.iftype = ARPHRD_ETHER,
.generate_mac = true,
};

View File

@ -51,8 +51,11 @@ int link_get_local_address(
assert_not_reached();
}
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
return -EBUSY;
SET_FOREACH(a, link->addresses) {
if (!address_exists(a))
if (!address_is_ready(a))
continue;
if (a->family != family)

View File

@ -764,8 +764,7 @@ static int netdev_request_to_create(NetDev *netdev) {
assert(netdev);
if (!IN_SET(netdev_get_create_type(netdev), NETDEV_CREATE_MASTER, NETDEV_CREATE_INDEPENDENT) &&
!netdev_is_stacked_and_independent(netdev))
if (netdev_is_stacked(netdev))
return 0;
r = netdev_is_ready_to_create(netdev, NULL);

View File

@ -102,7 +102,6 @@ typedef enum NetDevState {
typedef enum NetDevCreateType {
NETDEV_CREATE_INDEPENDENT,
NETDEV_CREATE_MASTER,
NETDEV_CREATE_STACKED,
NETDEV_CREATE_AFTER_CONFIGURED,
_NETDEV_CREATE_MAX,

View File

@ -29,7 +29,7 @@ const NetDevVTable vrf_vtable = {
.object_size = sizeof(Vrf),
.sections = NETDEV_COMMON_SECTIONS "VRF\0",
.fill_message_create = netdev_vrf_fill_message_create,
.create_type = NETDEV_CREATE_MASTER,
.create_type = NETDEV_CREATE_INDEPENDENT,
.iftype = ARPHRD_ETHER,
.generate_mac = true,
};

View File

@ -121,7 +121,6 @@ static int bridge_mdb_configure(BridgeMDB *mdb, Link *link, link_netlink_message
assert(mdb);
assert(link);
assert(link->network);
assert(link->manager);
assert(callback);

View File

@ -433,11 +433,12 @@ static int nexthop_configure(
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
int r;
assert(nexthop);
assert(IN_SET(nexthop->family, AF_UNSPEC, AF_INET, AF_INET6));
assert(link);
assert(link->manager);
assert(link->manager->rtnl);
assert(link->ifindex > 0);
assert(IN_SET(nexthop->family, AF_UNSPEC, AF_INET, AF_INET6));
assert(callback);
log_nexthop_debug(nexthop, "Configuring", link);