mirror of
https://github.com/systemd/systemd.git
synced 2025-01-27 18:04:05 +03:00
dhcp: make option names singular
This commit is contained in:
parent
0e0c4daea6
commit
f697ab358a
@ -51,17 +51,17 @@ bool dhcp6_option_can_request(uint16_t option) {
|
||||
return false;
|
||||
case SD_DHCP6_OPTION_SIP_SERVER_DOMAIN_NAME:
|
||||
case SD_DHCP6_OPTION_SIP_SERVER_ADDRESS:
|
||||
case SD_DHCP6_OPTION_DNS_SERVERS:
|
||||
case SD_DHCP6_OPTION_DOMAIN_LIST:
|
||||
case SD_DHCP6_OPTION_DNS_SERVER:
|
||||
case SD_DHCP6_OPTION_DOMAIN:
|
||||
return true;
|
||||
case SD_DHCP6_OPTION_IA_PD:
|
||||
case SD_DHCP6_OPTION_IA_PD_PREFIX:
|
||||
return false;
|
||||
case SD_DHCP6_OPTION_NIS_SERVERS:
|
||||
case SD_DHCP6_OPTION_NISP_SERVERS:
|
||||
case SD_DHCP6_OPTION_NIS_SERVER:
|
||||
case SD_DHCP6_OPTION_NISP_SERVER:
|
||||
case SD_DHCP6_OPTION_NIS_DOMAIN_NAME:
|
||||
case SD_DHCP6_OPTION_NISP_DOMAIN_NAME:
|
||||
case SD_DHCP6_OPTION_SNTP_SERVERS:
|
||||
case SD_DHCP6_OPTION_SNTP_SERVER:
|
||||
case SD_DHCP6_OPTION_INFORMATION_REFRESH_TIME:
|
||||
case SD_DHCP6_OPTION_BCMCS_SERVER_D:
|
||||
case SD_DHCP6_OPTION_BCMCS_SERVER_A:
|
||||
|
@ -29,10 +29,10 @@
|
||||
|
||||
/* Keep the list sorted. */
|
||||
static const uint16_t default_req_opts[] = {
|
||||
SD_DHCP6_OPTION_DNS_SERVERS, /* 23 */
|
||||
SD_DHCP6_OPTION_DOMAIN_LIST, /* 24 */
|
||||
SD_DHCP6_OPTION_SNTP_SERVERS, /* 31 */
|
||||
SD_DHCP6_OPTION_NTP_SERVER, /* 56 */
|
||||
SD_DHCP6_OPTION_DNS_SERVER, /* 23 */
|
||||
SD_DHCP6_OPTION_DOMAIN, /* 24 */
|
||||
SD_DHCP6_OPTION_SNTP_SERVER, /* 31 */
|
||||
SD_DHCP6_OPTION_NTP_SERVER, /* 56 */
|
||||
};
|
||||
|
||||
#define DHCP6_CLIENT_DONT_DESTROY(client) \
|
||||
|
@ -570,14 +570,14 @@ static int dhcp6_lease_parse_message(
|
||||
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_DNS_SERVERS:
|
||||
case SD_DHCP6_OPTION_DNS_SERVER:
|
||||
r = dhcp6_lease_add_dns(lease, optval, optlen);
|
||||
if (r < 0)
|
||||
log_dhcp6_client_errno(client, r, "Failed to parse DNS server option, ignoring: %m");
|
||||
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_DOMAIN_LIST:
|
||||
case SD_DHCP6_OPTION_DOMAIN:
|
||||
r = dhcp6_lease_add_domains(lease, optval, optlen);
|
||||
if (r < 0)
|
||||
log_dhcp6_client_errno(client, r, "Failed to parse domain list option, ignoring: %m");
|
||||
@ -591,7 +591,7 @@ static int dhcp6_lease_parse_message(
|
||||
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_SNTP_SERVERS:
|
||||
case SD_DHCP6_OPTION_SNTP_SERVER:
|
||||
r = dhcp6_lease_add_sntp(lease, optval, optlen);
|
||||
if (r < 0)
|
||||
log_dhcp6_client_errno(client, r, "Failed to parse SNTP server option, ignoring: %m");
|
||||
|
@ -97,15 +97,15 @@ TEST(client_basic) {
|
||||
assert_se(sd_dhcp6_client_set_fqdn(client, "~host.domain") == -EINVAL);
|
||||
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_CLIENTID) == -EINVAL);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_DNS_SERVERS) == -EEXIST);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_DNS_SERVER) == -EEXIST);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_NTP_SERVER) == -EEXIST);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_SNTP_SERVERS) == -EEXIST);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_DOMAIN_LIST) == -EEXIST);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_SNTP_SERVER) == -EEXIST);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_DOMAIN) == -EEXIST);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, 10) == -EINVAL);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_NIS_SERVERS) == 0);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_NISP_SERVERS) == 0);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_NIS_SERVERS) == -EEXIST);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_NISP_SERVERS) == -EEXIST);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_NIS_SERVER) == 0);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_NISP_SERVER) == 0);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_NIS_SERVER) == -EEXIST);
|
||||
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_NISP_SERVER) == -EEXIST);
|
||||
|
||||
assert_se(sd_dhcp6_client_set_information_request(client, 1) >= 0);
|
||||
v = 0;
|
||||
@ -403,7 +403,7 @@ TEST(client_parse_message_issue_22099) {
|
||||
0x00, SD_DHCP6_OPTION_PREFERENCE, 0x00, 0x01,
|
||||
0x00,
|
||||
/* DNS servers */
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVERS, 0x00, 0x10,
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVER, 0x00, 0x10,
|
||||
0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0x15, 0xc8, 0xff, 0xfe, 0xef, 0x1e, 0x4e,
|
||||
/* v6 pcp server */
|
||||
0x00, SD_DHCP6_OPTION_V6_PCP_SERVER, 0x00, 0x10,
|
||||
@ -451,9 +451,9 @@ static const uint8_t msg_information_request[] = {
|
||||
/* MUD URL */
|
||||
/* ORO */
|
||||
0x00, SD_DHCP6_OPTION_ORO, 0x00, 0x08,
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVERS,
|
||||
0x00, SD_DHCP6_OPTION_DOMAIN_LIST,
|
||||
0x00, SD_DHCP6_OPTION_SNTP_SERVERS,
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVER,
|
||||
0x00, SD_DHCP6_OPTION_DOMAIN,
|
||||
0x00, SD_DHCP6_OPTION_SNTP_SERVER,
|
||||
0x00, SD_DHCP6_OPTION_NTP_SERVER,
|
||||
/* Client ID */
|
||||
0x00, SD_DHCP6_OPTION_CLIENTID, 0x00, 0x0e,
|
||||
@ -491,9 +491,9 @@ static const uint8_t msg_solicit[] = {
|
||||
/* MUD URL */
|
||||
/* ORO */
|
||||
0x00, SD_DHCP6_OPTION_ORO, 0x00, 0x08,
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVERS,
|
||||
0x00, SD_DHCP6_OPTION_DOMAIN_LIST,
|
||||
0x00, SD_DHCP6_OPTION_SNTP_SERVERS,
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVER,
|
||||
0x00, SD_DHCP6_OPTION_DOMAIN,
|
||||
0x00, SD_DHCP6_OPTION_SNTP_SERVER,
|
||||
0x00, SD_DHCP6_OPTION_NTP_SERVER,
|
||||
/* Client ID */
|
||||
0x00, SD_DHCP6_OPTION_CLIENTID, 0x00, 0x0e,
|
||||
@ -554,9 +554,9 @@ static const uint8_t msg_request[] = {
|
||||
/* MUD URL */
|
||||
/* ORO */
|
||||
0x00, SD_DHCP6_OPTION_ORO, 0x00, 0x08,
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVERS,
|
||||
0x00, SD_DHCP6_OPTION_DOMAIN_LIST,
|
||||
0x00, SD_DHCP6_OPTION_SNTP_SERVERS,
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVER,
|
||||
0x00, SD_DHCP6_OPTION_DOMAIN,
|
||||
0x00, SD_DHCP6_OPTION_SNTP_SERVER,
|
||||
0x00, SD_DHCP6_OPTION_NTP_SERVER,
|
||||
/* Client ID */
|
||||
0x00, SD_DHCP6_OPTION_CLIENTID, 0x00, 0x0e,
|
||||
@ -619,11 +619,11 @@ static const uint8_t msg_reply[] = {
|
||||
0x40, /* prefixlen */
|
||||
IA_PD_PREFIX1_BYTES,
|
||||
/* DNS servers */
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVERS, 0x00, 0x20,
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVER, 0x00, 0x20,
|
||||
DNS1_BYTES,
|
||||
DNS2_BYTES,
|
||||
/* SNTP servers */
|
||||
0x00, SD_DHCP6_OPTION_SNTP_SERVERS, 0x00, 0x20,
|
||||
0x00, SD_DHCP6_OPTION_SNTP_SERVER, 0x00, 0x20,
|
||||
SNTP1_BYTES,
|
||||
SNTP2_BYTES,
|
||||
/* NTP servers */
|
||||
@ -638,7 +638,7 @@ static const uint8_t msg_reply[] = {
|
||||
0x00, DHCP6_NTP_SUBOPTION_SRV_FQDN, 0x00, 0x0b,
|
||||
0x03, 'n', 't', 'p', 0x05, 'i', 'n', 't', 'r', 'a', 0x00,
|
||||
/* Domain list */
|
||||
0x00, SD_DHCP6_OPTION_DOMAIN_LIST, 0x00, 0x0b,
|
||||
0x00, SD_DHCP6_OPTION_DOMAIN, 0x00, 0x0b,
|
||||
0x03, 'l', 'a', 'b', 0x05, 'i', 'n', 't', 'r', 'a', 0x00,
|
||||
/* Client FQDN */
|
||||
0x00, SD_DHCP6_OPTION_CLIENT_FQDN, 0x00, 0x12,
|
||||
@ -698,11 +698,11 @@ static const uint8_t msg_advertise[] = {
|
||||
0x40, /* prefixlen */
|
||||
IA_PD_PREFIX1_BYTES,
|
||||
/* DNS servers */
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVERS, 0x00, 0x20,
|
||||
0x00, SD_DHCP6_OPTION_DNS_SERVER, 0x00, 0x20,
|
||||
DNS1_BYTES,
|
||||
DNS2_BYTES,
|
||||
/* SNTP servers */
|
||||
0x00, SD_DHCP6_OPTION_SNTP_SERVERS, 0x00, 0x20,
|
||||
0x00, SD_DHCP6_OPTION_SNTP_SERVER, 0x00, 0x20,
|
||||
SNTP1_BYTES,
|
||||
SNTP2_BYTES,
|
||||
/* NTP servers */
|
||||
@ -717,7 +717,7 @@ static const uint8_t msg_advertise[] = {
|
||||
0x00, DHCP6_NTP_SUBOPTION_SRV_FQDN, 0x00, 0x0b,
|
||||
0x03, 'n', 't', 'p', 0x05, 'i', 'n', 't', 'r', 'a', 0x00,
|
||||
/* Domain list */
|
||||
0x00, SD_DHCP6_OPTION_DOMAIN_LIST, 0x00, 0x0b,
|
||||
0x00, SD_DHCP6_OPTION_DOMAIN, 0x00, 0x0b,
|
||||
0x03, 'l', 'a', 'b', 0x05, 'i', 'n', 't', 'r', 'a', 0x00,
|
||||
/* Client FQDN */
|
||||
0x00, SD_DHCP6_OPTION_CLIENT_FQDN, 0x00, 0x12,
|
||||
|
@ -134,7 +134,7 @@ enum {
|
||||
SD_DHCP_OPTION_NDS_SERVER = 85, /* [RFC2241] */
|
||||
SD_DHCP_OPTION_NDS_TREE_NAME = 86, /* [RFC2241] */
|
||||
SD_DHCP_OPTION_NDS_CONTEXT = 87, /* [RFC2241] */
|
||||
SD_DHCP_OPTION_BCMCS_CONTROLLER_DOMAIN_NAM = 88, /* [RFC4280] */
|
||||
SD_DHCP_OPTION_BCMCS_CONTROLLER_DOMAIN_NAME = 88, /* [RFC4280] */
|
||||
SD_DHCP_OPTION_BCMCS_CONTROLLER_ADDRESS = 89, /* [RFC4280] */
|
||||
SD_DHCP_OPTION_AUTHENTICATION = 90, /* [RFC3118] */
|
||||
SD_DHCP_OPTION_CLIENT_LAST_TRANSACTION_TIME = 91, /* [RFC4388] */
|
||||
@ -173,7 +173,7 @@ enum {
|
||||
SD_DHCP_OPTION_CAPWAP_AC_ADDRESS = 138, /* [RFC5417] */
|
||||
SD_DHCP_OPTION_MOS_ADDRESS = 139, /* [RFC5678] */
|
||||
SD_DHCP_OPTION_MOS_FQDN = 140, /* [RFC5678] */
|
||||
SD_DHCP_OPTION_SIP_SERVICE_DOMAINS = 141, /* [RFC6011] */
|
||||
SD_DHCP_OPTION_SIP_SERVICE_DOMAIN = 141, /* [RFC6011] */
|
||||
SD_DHCP_OPTION_ANDSF_ADDRESS = 142, /* [RFC6153] */
|
||||
SD_DHCP_OPTION_SZTP_REDIRECT = 143, /* [RFC8572] */
|
||||
SD_DHCP_OPTION_GEOLOC = 144, /* [RFC6225] */
|
||||
|
@ -63,15 +63,15 @@ enum {
|
||||
SD_DHCP6_OPTION_RECONF_ACCEPT = 20, /* RFC 8415 */
|
||||
SD_DHCP6_OPTION_SIP_SERVER_DOMAIN_NAME = 21, /* RFC 3319 */
|
||||
SD_DHCP6_OPTION_SIP_SERVER_ADDRESS = 22, /* RFC 3319 */
|
||||
SD_DHCP6_OPTION_DNS_SERVERS = 23, /* RFC 3646 */
|
||||
SD_DHCP6_OPTION_DOMAIN_LIST = 24, /* RFC 3646 */
|
||||
SD_DHCP6_OPTION_DNS_SERVER = 23, /* RFC 3646 */
|
||||
SD_DHCP6_OPTION_DOMAIN = 24, /* RFC 3646 */
|
||||
SD_DHCP6_OPTION_IA_PD = 25, /* RFC 3633, RFC 8415 */
|
||||
SD_DHCP6_OPTION_IA_PD_PREFIX = 26, /* RFC 3633, RFC 8415 */
|
||||
SD_DHCP6_OPTION_NIS_SERVERS = 27, /* RFC 3898 */
|
||||
SD_DHCP6_OPTION_NISP_SERVERS = 28, /* RFC 3898 */
|
||||
SD_DHCP6_OPTION_NIS_SERVER = 27, /* RFC 3898 */
|
||||
SD_DHCP6_OPTION_NISP_SERVER = 28, /* RFC 3898 */
|
||||
SD_DHCP6_OPTION_NIS_DOMAIN_NAME = 29, /* RFC 3898 */
|
||||
SD_DHCP6_OPTION_NISP_DOMAIN_NAME = 30, /* RFC 3898 */
|
||||
SD_DHCP6_OPTION_SNTP_SERVERS = 31, /* RFC 4075, deprecated */
|
||||
SD_DHCP6_OPTION_SNTP_SERVER = 31, /* RFC 4075, deprecated */
|
||||
SD_DHCP6_OPTION_INFORMATION_REFRESH_TIME = 32, /* RFC 4242, 8415, sec. 21.23 */
|
||||
SD_DHCP6_OPTION_BCMCS_SERVER_D = 33, /* RFC 4280 */
|
||||
SD_DHCP6_OPTION_BCMCS_SERVER_A = 34, /* RFC 4280 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user