1
0
mirror of https://github.com/systemd/systemd synced 2025-10-06 20:24:45 +02:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Oleg Popov
b204bdd4cc Extend characters set for PKCS11 URI
There are tokens with dots (and other symbols) in PKCS11 URI:

pkcs11:model=Rutoken%20ECP;manufacturer=Aktiv%20Co.;serial=3xxxxxxb;token=livelace
pkcs11:model=PRO;manufacturer=Aladdin%20R.D.;serial=CC62FB25;token=val%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00;id=%33%32%31%30%33%61%36%37%36%65%32%34%35%62%32%31;type=private
2021-04-10 20:24:18 +01:00
Yu Watanabe
5c078687dc network: refuse to configure NDISC twice 2021-04-10 20:16:11 +01:00
Lennart Poettering
1065501406 resolved: add RFC 8375 "home.arpa" to list of default NTA
RFC 8375 introduced "home.arpa" as special TLD for home networks. Let's
hence add it to our default list of NTAs.
2021-04-10 20:14:57 +01:00
Lennart Poettering
a8fd92b5a3 openssl: make RSA struct const
OpenSSL 3.0 broke API there, but it doesn't hurt to add the "const",
hence add it.

Fixes: #19267
2021-04-10 20:03:06 +01:00
Yu Watanabe
080e5c2fde sd-dhcp6-client: do not use IN_SET() macro when only one target value 2021-04-10 13:24:56 +01:00
Yu Watanabe
942cf4b8d1 network: adjust log message 2021-04-10 13:24:06 +01:00
Yu Watanabe
a78f938aaf network: drop unnecessary bitfield specifier
Manager is allocated only once. It is not necessary to optimize its
size.
2021-04-10 13:23:38 +01:00
8 changed files with 29 additions and 28 deletions

View File

@ -602,7 +602,7 @@ int dhcp6_option_parse_ia(sd_dhcp6_client *client, DHCP6Option *iaoption, DHCP6I
case SD_DHCP6_OPTION_IA_PD_PREFIX:
if (!IN_SET(ia->type, SD_DHCP6_OPTION_IA_PD))
if (ia->type != SD_DHCP6_OPTION_IA_PD)
return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EINVAL),
"IA PD Prefix option not in IA PD option");

View File

@ -161,7 +161,7 @@ int sd_dhcp6_client_set_callback(
int sd_dhcp6_client_set_ifindex(sd_dhcp6_client *client, int ifindex) {
assert_return(client, -EINVAL);
assert_return(ifindex > 0, -EINVAL);
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY);
client->ifindex = ifindex;
return 0;
@ -191,8 +191,7 @@ int sd_dhcp6_client_set_local_address(
assert_return(client, -EINVAL);
assert_return(local_address, -EINVAL);
assert_return(in6_addr_is_link_local(local_address) > 0, -EINVAL);
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY);
client->local_address = *local_address;
@ -207,8 +206,7 @@ int sd_dhcp6_client_set_mac(
assert_return(client, -EINVAL);
assert_return(addr, -EINVAL);
assert_return(addr_len <= MAX_MAC_ADDR_LEN, -EINVAL);
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY);
if (arp_type == ARPHRD_ETHER)
assert_return(addr_len == ETH_ALEN, -EINVAL);
@ -238,8 +236,7 @@ int sd_dhcp6_client_set_prefix_delegation_hint(
assert_return(client, -EINVAL);
assert_return(pd_address, -EINVAL);
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY);
client->hint_pd_prefix.iapdprefix.address = *pd_address;
client->hint_pd_prefix.iapdprefix.prefixlen = prefixlen;
@ -284,7 +281,7 @@ static int dhcp6_client_set_duid_internal(
assert_return(client, -EINVAL);
assert_return(duid_len == 0 || duid != NULL, -EINVAL);
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY);
if (duid) {
r = dhcp_validate_duid_len(duid_type, duid_len, true);
@ -393,7 +390,7 @@ int sd_dhcp6_client_duid_as_string(
int sd_dhcp6_client_set_iaid(sd_dhcp6_client *client, uint32_t iaid) {
assert_return(client, -EINVAL);
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY);
client->ia_na.ia_na.id = htobe32(iaid);
client->ia_pd.ia_pd.id = htobe32(iaid);
@ -430,7 +427,7 @@ int sd_dhcp6_client_set_fqdn(
int sd_dhcp6_client_set_information_request(sd_dhcp6_client *client, int enabled) {
assert_return(client, -EINVAL);
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
assert_return(client->state == DHCP6_STATE_STOPPED, -EBUSY);
client->information_request = enabled;
@ -1705,7 +1702,7 @@ int sd_dhcp6_client_start(sd_dhcp6_client *client) {
assert_return(client->ifindex > 0, -EINVAL);
assert_return(in6_addr_is_link_local(&client->local_address) > 0, -EINVAL);
if (!IN_SET(client->state, DHCP6_STATE_STOPPED))
if (client->state != DHCP6_STATE_STOPPED)
return -EBUSY;
if (!client->information_request && !client->request)

View File

@ -2202,7 +2202,7 @@ static int link_reconfigure_internal(Link *link, sd_netlink_message *m, bool for
return r;
if (!IN_SET(link->state, LINK_STATE_UNMANAGED, LINK_STATE_PENDING, LINK_STATE_INITIALIZED)) {
log_link_debug(link, "State is %s, dropping config", link_state_to_string(link->state));
log_link_debug(link, "State is %s, dropping foreign config", link_state_to_string(link->state));
r = link_drop_foreign_config(link);
if (r < 0)
return r;
@ -2638,7 +2638,7 @@ static int link_carrier_lost(Link *link) {
return r;
if (!IN_SET(link->state, LINK_STATE_UNMANAGED, LINK_STATE_PENDING, LINK_STATE_INITIALIZED)) {
log_link_debug(link, "State is %s, dropping config", link_state_to_string(link->state));
log_link_debug(link, "State is %s, dropping foreign config", link_state_to_string(link->state));
r = link_drop_foreign_config(link);
if (r < 0)
return r;

View File

@ -28,9 +28,9 @@ struct Manager {
Hashmap *polkit_registry;
int ethtool_fd;
bool enumerating:1;
bool dirty:1;
bool restarting:1;
bool enumerating;
bool dirty;
bool restarting;
bool manage_foreign_routes;
Set *dirty_links;

View File

@ -1315,15 +1315,16 @@ int ndisc_configure(Link *link) {
if (!link_ipv6_accept_ra_enabled(link))
return 0;
if (!link->ndisc) {
r = sd_ndisc_new(&link->ndisc);
if (r < 0)
return r;
if (link->ndisc)
return 0; /* Already configured. */
r = sd_ndisc_attach_event(link->ndisc, link->manager->event, 0);
if (r < 0)
return r;
}
r = sd_ndisc_new(&link->ndisc);
if (r < 0)
return r;
r = sd_ndisc_attach_event(link->ndisc, link->manager->event, 0);
if (r < 0)
return r;
r = sd_ndisc_set_mac(link->ndisc, &link->hw_addr.addr.ether);
if (r < 0)

View File

@ -160,7 +160,10 @@ static int dns_trust_anchor_add_builtin_negative(DnsTrustAnchor *d) {
"lan\0"
"intranet\0"
"internal\0"
"private\0";
"private\0"
/* Defined by RFC 8375. The most official choice. */
"home.arpa\0";
const char *name;
int r;

View File

@ -46,7 +46,7 @@ int rsa_pkey_to_suitable_key_size(
size_t *ret_suitable_key_size) {
size_t suitable_key_size;
RSA *rsa;
const RSA *rsa;
int bits;
assert_se(pkey);

View File

@ -31,7 +31,7 @@ bool pkcs11_uri_valid(const char *uri) {
if (isempty(p))
return false;
if (!in_charset(p, ALPHANUMERICAL "-_?;&%="))
if (!in_charset(p, ALPHANUMERICAL ".~/-_?;&%="))
return false;
return true;