Revert "networkd: NetLabel integration"
This reverts PR #23269 and its follow-up commit. Especially,2299b1cae3(partially), and3cf63830ac. The PR was merged without final approval, and has several issues: - The NetLabel for static addresses are not assigned, as labels are stored in the Address objects managed by Network, instead of Link. - If NetLabel is specified for a static address, then the address section will be invalid and the address will not be configured, - It should be implemented with Request object, - There is no test about the feature.
This commit is contained in:
@@ -585,45 +585,6 @@ struct in_addr* in4_addr_prefixlen_to_netmask(struct in_addr *addr, unsigned cha
|
||||
return addr;
|
||||
}
|
||||
|
||||
struct in6_addr* in6_addr_prefixlen_to_netmask(struct in6_addr *addr, unsigned char prefixlen) {
|
||||
assert(addr);
|
||||
assert(prefixlen <= 128);
|
||||
|
||||
for (unsigned int i = 0; i < 16; i++) {
|
||||
uint8_t mask;
|
||||
|
||||
if (prefixlen >= 8) {
|
||||
mask = 0xFF;
|
||||
prefixlen -= 8;
|
||||
} else if (prefixlen > 0) {
|
||||
mask = 0xFF << (8 - prefixlen);
|
||||
prefixlen = 0;
|
||||
} else {
|
||||
assert(prefixlen == 0);
|
||||
mask = 0;
|
||||
}
|
||||
|
||||
addr->s6_addr[i] = mask;
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
int in_addr_prefixlen_to_netmask(int family, union in_addr_union *addr, unsigned char prefixlen) {
|
||||
assert(addr);
|
||||
|
||||
switch (family) {
|
||||
case AF_INET:
|
||||
in4_addr_prefixlen_to_netmask(&addr->in, prefixlen);
|
||||
return 0;
|
||||
case AF_INET6:
|
||||
in6_addr_prefixlen_to_netmask(&addr->in6, prefixlen);
|
||||
return 0;
|
||||
default:
|
||||
return -EAFNOSUPPORT;
|
||||
}
|
||||
}
|
||||
|
||||
int in4_addr_default_prefixlen(const struct in_addr *addr, unsigned char *prefixlen) {
|
||||
uint8_t msb_octet = *(uint8_t*) addr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user