From a2284ddf17ec085b95f442fdbccc4f5ef088b1d8 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Fri, 9 Jun 2017 13:13:49 +0200 Subject: [PATCH 1/5] addrconf: split addrconf update flag parsing utility --- include/wicked/addrconf.h | 1 + src/names.c | 72 ++++++++++++++++++++++++++++----------- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/include/wicked/addrconf.h b/include/wicked/addrconf.h index f4da4f305..87f46bf9c 100644 --- a/include/wicked/addrconf.h +++ b/include/wicked/addrconf.h @@ -245,6 +245,7 @@ extern const char * ni_addrconf_flags_format(ni_stringbuf_t *, unsigned int, con extern const char * ni_addrconf_update_flag_to_name(unsigned int); extern ni_bool_t ni_addrconf_update_name_to_flag(const char *, unsigned int *); extern void ni_addrconf_update_set(unsigned int *, unsigned int, ni_bool_t); +extern ni_bool_t ni_addrconf_update_flags_parse_names(unsigned int *, const ni_string_array_t *); extern ni_bool_t ni_addrconf_update_flags_parse(unsigned int *, const char *, const char *); extern const char * ni_addrconf_update_flags_format(ni_stringbuf_t *, unsigned int, const char *); diff --git a/src/names.c b/src/names.c index f7ca3543d..b909a28a6 100644 --- a/src/names.c +++ b/src/names.c @@ -292,33 +292,67 @@ ni_addrconf_update_set(unsigned int *mask, unsigned int flag, ni_bool_t enable) } ni_bool_t -ni_addrconf_update_flags_parse(unsigned int *flags, const char *value, const char *sep) +ni_addrconf_update_flags_parse_names(unsigned int *flags, const ni_string_array_t *names) { - ni_string_array_t list = NI_STRING_ARRAY_INIT; + unsigned int mask = __NI_ADDRCONF_UPDATE_NONE; unsigned int flag, i; ni_bool_t ret = TRUE; + const char *name; - if (!flags || !value || ni_string_empty(sep)) + if (!flags || !names) return FALSE; - if (ni_string_empty(value) || ni_string_eq(value, "none")) { - *flags = __NI_ADDRCONF_UPDATE_NONE; - return TRUE; - } - if (ni_string_eq(value, "all")) { - *flags = -1U; - return TRUE; + for (i = 0; i < names->count; ++i) { + if (!(name = names->data[i])) + continue; + + if (ni_string_eq(name, "all")) { + mask = -1U; /* ~none */ + } else + if (ni_string_eq(name, "none")) { + mask = __NI_ADDRCONF_UPDATE_NONE; + } else + if (ni_string_eq(name, "default")) { + mask = *flags; + } else { + ni_bool_t set = TRUE; + + if (ni_string_startswith(name, "no-")) { + set = FALSE; + name += 3; + } else + if (ni_string_startswith(name, "-")) { + set = FALSE; + name += 1; + } + + if (ni_addrconf_update_name_to_flag(name, &flag)) { + ni_addrconf_update_set(&mask, flag, set); + } else { + ni_debug_readwrite("unknown addrconf update flag \"%s\"", + names->data[i]); + ret = FALSE; + } + } } - *flags = __NI_ADDRCONF_UPDATE_NONE; - ni_string_split(&list, value, sep, 0); - for (i = 0; ret && i < list.count; ++i) { - if (ni_addrconf_update_name_to_flag(list.data[i], &flag)) - ni_addrconf_update_set(flags, flag, TRUE); - else - ret = FALSE; - } - ni_string_array_destroy(&list); + *flags = mask; + return ret; +} + +ni_bool_t +ni_addrconf_update_flags_parse(unsigned int *flags, const char *value, const char *sep) +{ + ni_string_array_t names = NI_STRING_ARRAY_INIT; + ni_bool_t ret = FALSE; + + if (!flags || !value || ni_string_empty(sep)) + return FALSE; + + if (ni_string_split(&names, value, sep, 0)) + ret = ni_addrconf_update_flags_parse_names(flags, &names); + ni_string_array_destroy(&names); + return ret; } From 15b48f28753a447c28f156b9e394fbaa0bd277f9 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Fri, 9 Jun 2017 13:23:26 +0200 Subject: [PATCH 2/5] dhcp: cleanup configurable common allow-update flags --- client/compat.c | 6 +- include/wicked/addrconf.h | 4 + src/appconfig.h | 8 ++ src/auto6.c | 11 ++- src/config.c | 193 +++++++++++++++++++++++++++++++------- src/dhcp4/device.c | 60 +++++++++--- src/dhcp4/dhcp4.h | 12 +-- src/dhcp4/protocol.c | 4 +- src/dhcp6/device.c | 9 +- src/dhcp6/protocol.c | 56 ++++++----- src/names.c | 3 + 11 files changed, 280 insertions(+), 86 deletions(-) diff --git a/client/compat.c b/client/compat.c index 3788e8ff3..ce1d636ba 100644 --- a/client/compat.c +++ b/client/compat.c @@ -120,20 +120,20 @@ ni_compat_netdev_new(const char *ifname) compat->dev = ni_netdev_new(ifname, 0); /* Apply defaults */ - compat->dhcp4.update = ni_config_addrconf_update_mask(NI_ADDRCONF_DHCP, AF_INET); + compat->dhcp4.update = ni_config_addrconf_update(ifname, NI_ADDRCONF_DHCP, AF_INET); compat->dhcp4.recover_lease = TRUE; compat->dhcp4.release_lease = FALSE; compat->dhcp4.user_class.format = -1U; ni_dhcp_fqdn_init(&compat->dhcp4.fqdn); - compat->dhcp6.update = ni_config_addrconf_update_mask(NI_ADDRCONF_DHCP, AF_INET6); + compat->dhcp6.update = ni_config_addrconf_update(ifname, NI_ADDRCONF_DHCP, AF_INET6); compat->dhcp6.mode = NI_DHCP6_MODE_AUTO; compat->dhcp6.rapid_commit = TRUE; compat->dhcp6.recover_lease = TRUE; compat->dhcp6.release_lease = FALSE; ni_dhcp_fqdn_init(&compat->dhcp6.fqdn); - compat->auto6.update = ni_config_addrconf_update_mask(NI_ADDRCONF_AUTOCONF, AF_INET6); + compat->auto6.update = ni_config_addrconf_update(ifname, NI_ADDRCONF_AUTOCONF, AF_INET6); return compat; } diff --git a/include/wicked/addrconf.h b/include/wicked/addrconf.h index 87f46bf9c..0ef47e9b6 100644 --- a/include/wicked/addrconf.h +++ b/include/wicked/addrconf.h @@ -24,6 +24,10 @@ enum { NI_ADDRCONF_UPDATE_SLP, NI_ADDRCONF_UPDATE_LOG, NI_ADDRCONF_UPDATE_MTU, + NI_ADDRCONF_UPDATE_SIP, + NI_ADDRCONF_UPDATE_LPR, + NI_ADDRCONF_UPDATE_TZ, + NI_ADDRCONF_UPDATE_BOOT, __NI_ADDRCONF_UPDATE_NONE = 0, }; diff --git a/src/appconfig.h b/src/appconfig.h index fab6192e8..25a927634 100644 --- a/src/appconfig.h +++ b/src/appconfig.h @@ -95,11 +95,18 @@ typedef struct ni_config_teamd { ni_config_teamd_ctl_t ctl; } ni_config_teamd_t; +typedef enum { + NI_CONFIG_DHCP4_ROUTES_CSR, + NI_CONFIG_DHCP4_ROUTES_MSCSR, + NI_CONFIG_DHCP4_ROUTES_CLASS, +} ni_config_dhcp4_routes_t; + typedef struct ni_config_dhcp4 { struct ni_config_dhcp4 *next; char * device; unsigned int allow_update; + unsigned int routes_opts; char * vendor_class; unsigned int lease_time; ni_string_array_t ignore_servers; @@ -182,6 +189,7 @@ extern ni_config_t * ni_config_parse(const char *, ni_init_appdata_callback_t *, extern ni_extension_t * ni_config_find_extension(ni_config_t *, const char *); extern ni_extension_t * ni_config_find_system_updater(ni_config_t *, const char *); extern unsigned int ni_config_addrconf_update_mask(ni_addrconf_mode_t, unsigned int); +extern unsigned int ni_config_addrconf_update(const char *, ni_addrconf_mode_t, unsigned int); extern ni_bool_t ni_config_use_nanny(void); extern const ni_config_dhcp4_t * ni_config_dhcp4_find_device(const char *); diff --git a/src/auto6.c b/src/auto6.c index f6130a93a..73e4b725e 100644 --- a/src/auto6.c +++ b/src/auto6.c @@ -78,7 +78,7 @@ ni_auto6_request_init(ni_auto6_request_t *req) memset(req, 0, sizeof(*req)); req->enabled = FALSE; req->defer_timeout = NI_AUTO6_ACQUIRE_DEADLINE; - req->update = ni_config_addrconf_update_mask(NI_ADDRCONF_AUTOCONF, AF_INET6); + req->update = -1U; /* apply wicked-config(5) defaults later */ } } @@ -1007,8 +1007,13 @@ ni_auto6_acquire(ni_netdev_t *dev, const ni_auto6_request_t *req) lease->uuid = auto6->uuid; } - lease->update = req->update; - ni_tristate_set(&auto6->update, req->update); + if (req->update == -1U) { + lease->update = ni_config_addrconf_update(dev->name, NI_ADDRCONF_AUTOCONF, AF_INET6); + } else { + lease->update = req->update; + lease->update &= ni_config_addrconf_update_mask(NI_ADDRCONF_AUTOCONF, AF_INET6); + } + ni_tristate_set(&auto6->update, !!lease->update); auto6->acquire.deadline = req->defer_timeout; auto6->acquire.send_rs = NI_AUTO6_ACQUIRE_SEND_RS; diff --git a/src/config.c b/src/config.c index 7681af48f..e78a2ae5b 100644 --- a/src/config.c +++ b/src/config.c @@ -39,6 +39,7 @@ static ni_bool_t ni_config_parse_addrconf_dhcp4(ni_config_t *, xml_node_t *); static ni_bool_t ni_config_parse_addrconf_dhcp6(ni_config_t *, xml_node_t *); static ni_bool_t ni_config_parse_addrconf_auto6(ni_config_auto6_t *, xml_node_t *); static void ni_config_parse_update_targets(unsigned int *, const xml_node_t *); +static void ni_config_parse_update_dhcp4_routes(unsigned int *, const xml_node_t *); static void ni_config_parse_fslocation(ni_config_fslocation_t *, xml_node_t *); static ni_bool_t ni_config_parse_objectmodel_extension(ni_extension_t **, xml_node_t *); static ni_bool_t ni_config_parse_objectmodel_netif_ns(ni_extension_t **, xml_node_t *); @@ -56,6 +57,11 @@ static unsigned int ni_config_addrconf_update_mask_dhcp4(void); static unsigned int ni_config_addrconf_update_mask_dhcp6(void); static unsigned int ni_config_addrconf_update_mask_auto4(void); static unsigned int ni_config_addrconf_update_mask_auto6(void); +static unsigned int ni_config_addrconf_update_default(void); +static unsigned int ni_config_addrconf_update_dhcp4(void); +static unsigned int ni_config_addrconf_update_dhcp6(void); +static unsigned int ni_config_addrconf_update_auto4(void); +static unsigned int ni_config_addrconf_update_auto6(void); /* * Create an empty config object @@ -67,11 +73,12 @@ ni_config_new() conf = xcalloc(1, sizeof(*conf)); - conf->addrconf.default_allow_update = ni_config_addrconf_update_mask_all(); - conf->addrconf.dhcp4.allow_update = ni_config_addrconf_update_mask_dhcp4(); - conf->addrconf.dhcp6.allow_update = ni_config_addrconf_update_mask_dhcp6(); - conf->addrconf.auto4.allow_update = ni_config_addrconf_update_mask_auto4(); - conf->addrconf.auto6.allow_update = ni_config_addrconf_update_mask_auto6(); + conf->addrconf.default_allow_update = ni_config_addrconf_update_default(); + conf->addrconf.dhcp4.allow_update = ni_config_addrconf_update_dhcp4(); + conf->addrconf.dhcp6.allow_update = ni_config_addrconf_update_dhcp6(); + conf->addrconf.auto4.allow_update = ni_config_addrconf_update_auto4(); + conf->addrconf.auto6.allow_update = ni_config_addrconf_update_auto6(); + conf->addrconf.dhcp4.routes_opts = -1U; ni_config_fslocation_init(&conf->piddir, WICKED_PIDDIR, 0755); ni_config_fslocation_init(&conf->statedir, WICKED_STATEDIR, 0755); @@ -562,6 +569,9 @@ ni_config_parse_addrconf_dhcp4_nodes(ni_config_dhcp4_t *dhcp4, xml_node_t *node) ni_config_parse_update_targets(&dhcp4->allow_update, child); dhcp4->allow_update &= ni_config_addrconf_update_mask_dhcp4(); } else + if (!strcmp(child->name, "route-options")) { + ni_config_parse_update_dhcp4_routes(&dhcp4->routes_opts, child); + } else if (ni_string_eq(child->name, "define")) { ni_config_parse_dhcp4_definitions(dhcp4, child); } @@ -992,25 +1002,56 @@ ni_config_parse_addrconf_auto6(ni_config_auto6_t *auto6, xml_node_t *node) void ni_config_parse_update_targets(unsigned int *update_mask, const xml_node_t *node) { + ni_string_array_t targets = NI_STRING_ARRAY_INIT; const xml_node_t *child; + unsigned int mask; - *update_mask = __NI_ADDRCONF_UPDATE_NONE; - for (child = node->children; child; child = child->next) { - unsigned int target; + if (!update_mask || !node) + return; - if (!strcmp(child->name, "all")) { - *update_mask = ni_config_addrconf_update_mask_all(); - } else - if (!strcmp(child->name, "none")) { - *update_mask = __NI_ADDRCONF_UPDATE_NONE; - } else - if (ni_addrconf_update_name_to_flag(child->name, &target)) { - ni_addrconf_update_set(update_mask, target, TRUE); - } else { - ni_info("ignoring unknown addrconf update target \"%s\"", - child->name); - } + if (node->children) { + for (child = node->children; child; child = child->next) + ni_string_array_append(&targets, child->name); + } else { + ni_string_split(&targets, node->cdata, " \t,|", 0); + } + if (ni_addrconf_update_flags_parse_names(&mask, &targets)) + *update_mask = mask; + ni_string_array_destroy(&targets); +} + +void +ni_config_parse_update_dhcp4_routes(unsigned int *routes_opts, const xml_node_t *node) +{ + ni_string_array_t tags = NI_STRING_ARRAY_INIT; + const xml_node_t *child; + const char *tag; + unsigned int i; + + if (!routes_opts || !node) + return; + + if (node->children) { + for (child = node->children; child; child = child->next) + ni_string_array_append(&tags, child->name); + } else { + ni_string_split(&tags, node->cdata, " \t,|", 0); + } + + *routes_opts = 0; + for (i = 0; i < tags.count; ++i) { + tag = tags.data[i]; + + if (ni_string_eq(tag, "classless") || ni_string_eq(tag, "csr")) + *routes_opts |= NI_BIT(NI_CONFIG_DHCP4_ROUTES_CSR); + else + if (ni_string_eq(tag, "ms-classless") || ni_string_eq(tag, "mscsr")) + *routes_opts |= NI_BIT(NI_CONFIG_DHCP4_ROUTES_MSCSR); + else + if (ni_string_eq(tag, "static-routes") || ni_string_eq(tag, "class")) + *routes_opts |= NI_BIT(NI_CONFIG_DHCP4_ROUTES_CLASS); } + ni_string_array_destroy(&tags); } void @@ -1493,30 +1534,57 @@ ni_config_addrconf_update_mask_all(void) mask = ~mask; for (i = 0; i < 32; ++i) { if (!ni_addrconf_update_flag_to_name(i)) - mask &= ~(1 << i); + mask &= ~NI_BIT(i); } } return mask; } +static unsigned int +ni_config_addrconf_update_default(void) +{ + return ni_config_addrconf_update_mask_all(); +} + static unsigned int ni_config_addrconf_update_mask_dhcp4(void) { return ni_config_addrconf_update_mask_all(); } +static unsigned int +ni_config_addrconf_update_dhcp4(void) +{ + return NI_BIT(NI_ADDRCONF_UPDATE_DEFAULT_ROUTE)| + NI_BIT(NI_ADDRCONF_UPDATE_DNS) | + NI_BIT(NI_ADDRCONF_UPDATE_NTP) | + NI_BIT(NI_ADDRCONF_UPDATE_NIS) | + NI_BIT(NI_ADDRCONF_UPDATE_NDS) | + NI_BIT(NI_ADDRCONF_UPDATE_MTU) | + NI_BIT(NI_ADDRCONF_UPDATE_TZ) | + NI_BIT(NI_ADDRCONF_UPDATE_BOOT); +} + static unsigned int ni_config_addrconf_update_mask_dhcp6(void) { - unsigned int mask = __NI_ADDRCONF_UPDATE_NONE; - mask |= (1< IPv6 RA's job * - ypbind does not support ipv6 (DHCPv6 can it). */ - return mask; + return NI_BIT(NI_ADDRCONF_UPDATE_DNS) | + NI_BIT(NI_ADDRCONF_UPDATE_NTP) | + NI_BIT(NI_ADDRCONF_UPDATE_TZ) | + NI_BIT(NI_ADDRCONF_UPDATE_BOOT); } static unsigned int @@ -1525,17 +1593,72 @@ ni_config_addrconf_update_mask_auto4(void) return __NI_ADDRCONF_UPDATE_NONE; /* IP address only */ } +static unsigned int +ni_config_addrconf_update_auto4(void) +{ + return ni_config_addrconf_update_mask_auto4(); +} + static unsigned int ni_config_addrconf_update_mask_auto6(void) { return NI_BIT(NI_ADDRCONF_UPDATE_DNS); } +static unsigned int +ni_config_addrconf_update_auto6(void) +{ + return ni_config_addrconf_update_mask_auto6(); +} + unsigned int ni_config_addrconf_update_mask(ni_addrconf_mode_t type, unsigned int family) { unsigned int mask = __NI_ADDRCONF_UPDATE_NONE; - ni_config_t *conf = ni_global.config; + + switch (type) { + case NI_ADDRCONF_STATIC: + case NI_ADDRCONF_INTRINSIC: + /* for now we treat intrinsic just like static. We may want to differentiate + * a bit better in the future. Let's see if anyone needs it. */ + mask = ni_config_addrconf_update_mask_all(); + break; + + case NI_ADDRCONF_AUTOCONF: + switch (family) { + case AF_INET: + mask = ni_config_addrconf_update_mask_auto4(); + break; + case AF_INET6: + mask = ni_config_addrconf_update_mask_auto6(); + break; + default: ; + } + break; + + case NI_ADDRCONF_DHCP: + switch (family) { + case AF_INET: + mask = ni_config_addrconf_update_mask_dhcp4(); + break; + case AF_INET6: + mask = ni_config_addrconf_update_mask_dhcp6(); + break; + default: ; + } + break; + default: ; + } + return mask; +} + +unsigned int +ni_config_addrconf_update(const char *ifname, ni_addrconf_mode_t type, unsigned int family) +{ + unsigned int mask = __NI_ADDRCONF_UPDATE_NONE; + const ni_config_t *conf = ni_global.config; + const ni_config_dhcp4_t *dhcp4; + const ni_config_dhcp6_t *dhcp6; switch (type) { case NI_ADDRCONF_STATIC: @@ -1543,18 +1666,18 @@ ni_config_addrconf_update_mask(ni_addrconf_mode_t type, unsigned int family) /* for now we treat intrinsic just like static. We may want to differentiate * a bit better in the future. Let's see if anyone needs it. */ mask = conf ? conf->addrconf.default_allow_update : - ni_config_addrconf_update_mask_all(); + ni_config_addrconf_update_default(); break; case NI_ADDRCONF_AUTOCONF: switch (family) { case AF_INET: mask = conf ? conf->addrconf.auto4.allow_update : - ni_config_addrconf_update_mask_auto4(); + ni_config_addrconf_update_auto4(); break; case AF_INET6: mask = conf ? conf->addrconf.auto6.allow_update : - ni_config_addrconf_update_mask_auto6(); + ni_config_addrconf_update_auto6(); break; default: ; } @@ -1563,12 +1686,14 @@ ni_config_addrconf_update_mask(ni_addrconf_mode_t type, unsigned int family) case NI_ADDRCONF_DHCP: switch (family) { case AF_INET: - mask = conf ? conf->addrconf.dhcp4.allow_update : - ni_config_addrconf_update_mask_dhcp4(); + dhcp4 = ni_config_dhcp4_find_device(ifname); + mask = dhcp4 ? dhcp4->allow_update : + ni_config_addrconf_update_dhcp4(); break; case AF_INET6: - mask = conf ? conf->addrconf.dhcp6.allow_update : - ni_config_addrconf_update_mask_dhcp6(); + dhcp6 = ni_config_dhcp6_find_device(ifname); + mask = dhcp6 ? dhcp6->allow_update : + ni_config_addrconf_update_dhcp6(); break; default: ; } diff --git a/src/dhcp4/device.c b/src/dhcp4/device.c index 4ecb8f67f..eb04bbcf1 100644 --- a/src/dhcp4/device.c +++ b/src/dhcp4/device.c @@ -27,8 +27,8 @@ #include "dhcp.h" -static unsigned int ni_dhcp4_do_bits(unsigned int); -static const char * __ni_dhcp4_print_doflags(unsigned int); +static unsigned int ni_dhcp4_do_bits(const ni_config_dhcp4_t *, unsigned int); +static const char * ni_dhcp4_print_doflags(unsigned int); static void ni_dhcp4_config_set_request_options(const char *, ni_uint_array_t *, const ni_string_array_t *); ni_dhcp4_device_t * ni_dhcp4_active; @@ -277,7 +277,14 @@ ni_dhcp4_acquire(ni_dhcp4_device_t *dev, const ni_dhcp4_request_t *info) config->acquire_timeout = info->acquire_timeout; config->uuid = info->uuid; config->flags = info->flags; - config->update = info->update; + if (info->update == -1U) { + config->update = ni_config_addrconf_update(dev->ifname, NI_ADDRCONF_DHCP, AF_INET); + } else { + config->update = info->update; + config->update &= ni_config_addrconf_update_mask(NI_ADDRCONF_DHCP, AF_INET); + } + config->doflags = ni_dhcp4_do_bits(ni_config_dhcp4_find_device(dev->ifname), config->update); + config->route_priority = info->route_priority; config->recover_lease = info->recover_lease; config->release_lease = info->release_lease; @@ -327,9 +334,6 @@ ni_dhcp4_acquire(ni_dhcp4_device_t *dev, const ni_dhcp4_request_t *info) ni_string_array_copy(&config->user_class.class_id, &info->user_class.class_id); } - config->doflags = DHCP4_DO_DEFAULT; - config->doflags |= ni_dhcp4_do_bits(info->update); - if (ni_log_facility(NI_TRACE_DHCP)) { ni_trace("Received request:"); ni_trace(" acquire-timeout %u", config->acquire_timeout); @@ -352,7 +356,7 @@ ni_dhcp4_acquire(ni_dhcp4_device_t *dev, const ni_dhcp4_request_t *info) } ni_trace(" client-id %s", ni_print_hex(config->client_id.data, config->client_id.len)); ni_trace(" uuid %s", ni_uuid_print(&config->uuid)); - ni_trace(" update-flags %s", __ni_dhcp4_print_doflags(config->doflags)); + ni_trace(" update-flags %s", ni_dhcp4_print_doflags(config->doflags)); ni_trace(" recover_lease %s", config->recover_lease ? "true" : "false"); ni_trace(" release_lease %s", config->release_lease ? "true" : "false"); } @@ -406,7 +410,7 @@ ni_dhcp4_restart_leases(void) * DHCP4_DO_* masks */ static unsigned int -ni_dhcp4_do_bits(unsigned int update_flags) +ni_dhcp4_do_bits(const ni_config_dhcp4_t *conf, unsigned int update_flags) { static unsigned int do_mask[32] = { [NI_ADDRCONF_UPDATE_DEFAULT_ROUTE] = DHCP4_DO_GATEWAY, @@ -414,30 +418,60 @@ ni_dhcp4_do_bits(unsigned int update_flags) [NI_ADDRCONF_UPDATE_DNS] = DHCP4_DO_DNS, [NI_ADDRCONF_UPDATE_NIS] = DHCP4_DO_NIS, [NI_ADDRCONF_UPDATE_NTP] = DHCP4_DO_NTP, + [NI_ADDRCONF_UPDATE_NDS] = DHCP4_DO_NDS, + [NI_ADDRCONF_UPDATE_SMB] = DHCP4_DO_SMB, + [NI_ADDRCONF_UPDATE_SIP] = DHCP4_DO_SIP, + [NI_ADDRCONF_UPDATE_LPR] = DHCP4_DO_LPR, + [NI_ADDRCONF_UPDATE_LOG] = DHCP4_DO_LOG, [NI_ADDRCONF_UPDATE_MTU] = DHCP4_DO_MTU, + [NI_ADDRCONF_UPDATE_BOOT] = DHCP4_DO_ROOT, + [NI_ADDRCONF_UPDATE_TZ] = DHCP4_DO_POSIX_TZ, }; - unsigned int bit, result = 0; + unsigned int bit, result = DHCP4_DO_ARP | DHCP4_DO_CSR + | DHCP4_DO_STATIC_ROUTES; for (bit = 0; bit < 32; ++bit) { - if (update_flags & (1 << bit)) + if (update_flags & NI_BIT(bit)) result |= do_mask[bit]; + else + result &= ~do_mask[bit]; } + + if (conf && conf->routes_opts != -1U) { + result &= ~(DHCP4_DO_CSR|DHCP4_DO_STATIC_ROUTES); + + if (conf->routes_opts & NI_BIT(NI_CONFIG_DHCP4_ROUTES_CSR)) + result |= DHCP4_DO_CSR; + if (conf->routes_opts & NI_BIT(NI_CONFIG_DHCP4_ROUTES_MSCSR)) + result |= DHCP4_DO_MSCSR; + if (conf->routes_opts & NI_BIT(NI_CONFIG_DHCP4_ROUTES_CLASS)) + result |= DHCP4_DO_STATIC_ROUTES; + } + return result; } static const char * -__ni_dhcp4_print_doflags(unsigned int flags) +ni_dhcp4_print_doflags(unsigned int flags) { static ni_intmap_t flag_names[] = { { "arp", DHCP4_DO_ARP }, { "csr", DHCP4_DO_CSR }, { "mscsr", DHCP4_DO_MSCSR }, + { "static-routes", DHCP4_DO_STATIC_ROUTES }, { "gateway", DHCP4_DO_GATEWAY }, { "hostname", DHCP4_DO_HOSTNAME }, { "dns", DHCP4_DO_DNS }, { "nis", DHCP4_DO_NIS }, { "ntp", DHCP4_DO_NTP }, + { "nds", DHCP4_DO_NDS }, + { "smb", DHCP4_DO_SMB }, + { "sip", DHCP4_DO_SIP }, + { "lpr", DHCP4_DO_LPR }, + { "log", DHCP4_DO_LOG }, + { "tz", DHCP4_DO_POSIX_TZ }, { "mtu", DHCP4_DO_MTU }, + { "root", DHCP4_DO_ROOT }, { NULL } }; static char buffer[1024]; @@ -915,8 +949,8 @@ ni_dhcp4_request_new(void) req = xcalloc(1, sizeof(*req)); req->enabled = TRUE; /* used by wickedd */ - /* By default, we try to obtain all sorts of config from the server */ - req->update = ni_config_addrconf_update_mask(NI_ADDRCONF_DHCP, AF_INET); + /* By default, we try to obtain all sorts of settings from the server */ + req->update = -1U; /* apply wicked-config(5) defaults later */ /* default: enable + update mode depends on request hostname + dots */ ni_dhcp_fqdn_init(&req->fqdn); diff --git a/src/dhcp4/dhcp4.h b/src/dhcp4/dhcp4.h index d3b72c90d..46997a425 100644 --- a/src/dhcp4/dhcp4.h +++ b/src/dhcp4/dhcp4.h @@ -93,8 +93,11 @@ typedef struct ni_dhcp4_device { #define NI_DHCP4_REQUEST_TIMEOUT 60 /* seconds */ #define NI_DHCP4_ARP_TIMEOUT 200 /* msec */ +/* + * common NI_ADDRCONF_UPDATE_* + dhcp4 specific options + */ enum { - DHCP4_DO_ARP = 0x00000001, /* TODO: -> wickedd */ + DHCP4_DO_ARP = 0x00000001, DHCP4_DO_HOSTNAME = 0x00000002, DHCP4_DO_DNS = 0x00000004, DHCP4_DO_NIS = 0x00000008, @@ -110,14 +113,9 @@ enum { DHCP4_DO_LOG = 0x00002000, DHCP4_DO_POSIX_TZ = 0x00004000, DHCP4_DO_MTU = 0x00008000, - DHCP4_DO_DEFAULT = DHCP4_DO_ARP|DHCP4_DO_HOSTNAME|DHCP4_DO_DNS| - DHCP4_DO_NIS|DHCP4_DO_NTP|DHCP4_DO_CSR| - DHCP4_DO_GATEWAY|DHCP4_DO_ROOT| - DHCP4_DO_NDS|DHCP4_DO_SMB|DHCP4_DO_SIP| - DHCP4_DO_LPR|DHCP4_DO_LOG|DHCP4_DO_POSIX_TZ + DHCP4_DO_STATIC_ROUTES = 0x00010000, }; - /* * fsm (dry) run modes */ diff --git a/src/dhcp4/protocol.c b/src/dhcp4/protocol.c index f5a4c6310..553c16c9a 100644 --- a/src/dhcp4/protocol.c +++ b/src/dhcp4/protocol.c @@ -484,9 +484,11 @@ __ni_dhcp4_build_msg_put_option_request(const ni_dhcp4_device_t *dev, ni_uint_array_append(&oro, DHCP4_MSCSR); } if (options->doflags & DHCP4_DO_GATEWAY) { - ni_uint_array_append(&oro, DHCP4_STATICROUTE); ni_uint_array_append(&oro, DHCP4_ROUTERS); } + if (options->doflags & DHCP4_DO_STATIC_ROUTES) { + ni_uint_array_append(&oro, DHCP4_STATICROUTE); + } if (options->doflags & DHCP4_DO_HOSTNAME) { if (options->fqdn.enabled == NI_TRISTATE_DISABLE) { ni_uint_array_append(&oro, DHCP4_HOSTNAME); diff --git a/src/dhcp6/device.c b/src/dhcp6/device.c index df92cecad..d979b0ce8 100644 --- a/src/dhcp6/device.c +++ b/src/dhcp6/device.c @@ -943,7 +943,12 @@ ni_dhcp6_acquire(ni_dhcp6_device_t *dev, const ni_dhcp6_request_t *req, char **e config->uuid = req->uuid; config->mode = req->mode; config->flags= req->flags; - config->update = req->update; + if (req->update == -1U) { + config->update = ni_config_addrconf_update(dev->ifname, NI_ADDRCONF_DHCP, AF_INET6); + } else { + config->update = req->update; + config->update &= ni_config_addrconf_update_mask(NI_ADDRCONF_DHCP, AF_INET6); + } config->dry_run = req->dry_run; ni_timer_get_time(&dev->start_time); @@ -1508,7 +1513,7 @@ ni_dhcp6_request_new(void) req->rapid_commit = TRUE; /* By default, we try to obtain all sorts of config from the server */ - req->update = ni_config_addrconf_update_mask(NI_ADDRCONF_DHCP, AF_INET6); + req->update = -1U; /* apply wicked-config(5) defaults later */ /* default: enable + update mode depends on hostname settings in req */ ni_dhcp_fqdn_init(&req->fqdn); diff --git a/src/dhcp6/protocol.c b/src/dhcp6/protocol.c index 16b8a5a30..182e97cd4 100644 --- a/src/dhcp6/protocol.c +++ b/src/dhcp6/protocol.c @@ -1343,30 +1343,40 @@ __ni_dhcp6_build_oro_opts(ni_dhcp6_device_t *dev, ni_dhcp6_option_request_t *oro, const ni_addrconf_lease_t *lease) { - /* - * TODO: use config->update or something else - */ ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_PREFERENCE); - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_DNS_SERVERS); - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_DNS_DOMAINS); - /* TODO: linux nis currently does not support IPv6 - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_NIS_SERVERS); - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_NIS_DOMAIN_NAME); - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_NISP_SERVERS); - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_NISP_DOMAIN_NAME); - */ - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_POSIX_TZ_STRING); - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_POSIX_TZ_DBNAME); - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_BOOTFILE_URL); - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_BOOTFILE_PARAM); - /* - * TODO: ntp options envelope - AFAIR ISC dhcp does not support it yet. - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_NTP_SERVER); - */ - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_SNTP_SERVERS); - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_SIP_SERVER_D); - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_SIP_SERVER_A); - ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_FQDN); + if (dev->config->update & NI_BIT(NI_ADDRCONF_UPDATE_DNS)) { + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_DNS_SERVERS); + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_DNS_DOMAINS); + } + if (dev->config->update & NI_BIT(NI_ADDRCONF_UPDATE_NTP)) { + /* + * TODO: ntp options envelope - AFAIR ISC dhcp + * and other servers do not support/know it yet. + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_NTP_SERVER); + */ + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_SNTP_SERVERS); + } + if (dev->config->update & NI_BIT(NI_ADDRCONF_UPDATE_NIS)) { + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_NIS_SERVERS); + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_NIS_DOMAIN_NAME); + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_NISP_SERVERS); + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_NISP_DOMAIN_NAME); + } + if (dev->config->update & NI_BIT(NI_ADDRCONF_UPDATE_SIP)) { + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_SIP_SERVER_D); + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_SIP_SERVER_A); + } + if (dev->config->update & NI_BIT(NI_ADDRCONF_UPDATE_TZ)) { + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_POSIX_TZ_STRING); + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_POSIX_TZ_DBNAME); + } + if (dev->config->update & NI_BIT(NI_ADDRCONF_UPDATE_BOOT)) { + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_BOOTFILE_URL); + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_BOOTFILE_PARAM); + } + if (dev->config->update & NI_BIT(NI_ADDRCONF_UPDATE_HOSTNAME)) { + ni_dhcp6_option_request_append(oro, NI_DHCP6_OPTION_FQDN); + } if (dev->config) { unsigned int i, code; diff --git a/src/names.c b/src/names.c index b909a28a6..ed801d9b6 100644 --- a/src/names.c +++ b/src/names.c @@ -256,8 +256,11 @@ static const ni_intmap_t __addrconf_update_flags[] = { { "smb", NI_ADDRCONF_UPDATE_SMB }, { "nds", NI_ADDRCONF_UPDATE_NDS }, { "slp", NI_ADDRCONF_UPDATE_SLP }, + { "sip", NI_ADDRCONF_UPDATE_SIP }, { "log", NI_ADDRCONF_UPDATE_LOG }, { "mtu", NI_ADDRCONF_UPDATE_MTU }, + { "tz", NI_ADDRCONF_UPDATE_TZ }, + { "boot", NI_ADDRCONF_UPDATE_BOOT }, { NULL } }; From ff65de40a3dd30cc60689666911974ba4cff8dc7 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Fri, 9 Jun 2017 13:25:04 +0200 Subject: [PATCH 3/5] dhcp6: create iaid when the lease request arrives creating iaid while initialization may run into a not yet assigned device mac address, e.g. on xen. --- src/dhcp6/device.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/dhcp6/device.c b/src/dhcp6/device.c index d979b0ce8..8923c710b 100644 --- a/src/dhcp6/device.c +++ b/src/dhcp6/device.c @@ -108,9 +108,6 @@ ni_dhcp6_device_new(const char *ifname, const ni_linkinfo_t *link) ni_string_dup(&dev->ifname, ifname); dev->link.ifindex = link->ifindex; - /* FIXME: for now, we always generate one */ - ni_dhcp6_device_iaid(dev, &dev->iaid); - dev->fsm.state = NI_DHCP6_STATE_INIT; /* append to end of list */ @@ -985,6 +982,8 @@ ni_dhcp6_acquire(ni_dhcp6_device_t *dev, const ni_dhcp6_request_t *req, char **e * Make sure we have a DUID for client-id * Hmm... Should we fail back to req->uuid? */ + if (!dev->iaid) + ni_dhcp6_device_iaid(dev, &dev->iaid); if(!ni_dhcp6_config_init_duid(dev, config, req->clientid)) { size_t len; From 2b61590dcd80428d2290aae95ed9f05d908b2817 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Fri, 9 Jun 2017 15:02:22 +0200 Subject: [PATCH 4/5] ifcfg: add DHCLIENT and DHCLIENT6_UPDATE variables --- client/suse/compat-suse.c | 35 ++++++++++++++++++++---- client/suse/config/sysconfig.dhcp-wicked | 34 +++++++++++++++++++++++ 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/client/suse/compat-suse.c b/client/suse/compat-suse.c index 8c505834a..d3878d23e 100644 --- a/client/suse/compat-suse.c +++ b/client/suse/compat-suse.c @@ -5052,6 +5052,17 @@ __ni_suse_addrconf_dhcp4_options(const ni_sysconfig_t *sc, ni_compat_netdev_t *c ni_bool_t bvalue; ni_bool_t ret = TRUE; + if ((string = ni_sysconfig_get_value(sc, "DHCLIENT_UPDATE")) != NULL) { + if (ni_addrconf_update_flags_parse(&uint, string, " \t,")) { + uint &= ni_config_addrconf_update_mask(NI_ADDRCONF_DHCP, AF_INET); + compat->dhcp4.update = uint; + } else { + ni_warn("%s: Unknown flags in DHCLIENT_UPDATE='%s'", + ni_basename(sc->pathname), + ni_print_suspect(string, ni_string_len(string))); + } + } + if ((string = ni_sysconfig_get_value(sc, "DHCLIENT_FQDN_ENABLED")) != NULL) { if (ni_parse_boolean(string, &bvalue) == 0) ni_tristate_set(&compat->dhcp4.fqdn.enabled, bvalue); @@ -5173,6 +5184,18 @@ __ni_suse_addrconf_dhcp6_options(const ni_sysconfig_t *sc, ni_compat_netdev_t *c const char *string; ni_bool_t bvalue; + if ((string = ni_sysconfig_get_value(sc, "DHCLIENT6_UPDATE")) != NULL) { + if (ni_addrconf_update_flags_parse(&uint, string, " \t,")) { + uint &= ni_config_addrconf_update_mask(NI_ADDRCONF_DHCP, AF_INET6); + compat->dhcp6.update = uint; + } else { + ni_warn("%s: Unknown flags in DHCLIENT6_UPDATE='%s'", + ni_basename(sc->pathname), + ni_print_suspect(string, ni_string_len(string))); + ret = FALSE; + } + } + if ((string = ni_sysconfig_get_value(sc, "DHCLIENT6_MODE")) != NULL) { if (ni_dhcp6_mode_name_to_type(string, &compat->dhcp6.mode) != 0) { ni_warn("%s: Cannot parse DHCLIENT6_MODE='%s'", @@ -5404,13 +5427,15 @@ __ni_suse_addrconf_auto6(const ni_sysconfig_t *sc, ni_compat_netdev_t *compat) &compat->auto6.defer_timeout); if ((value = ni_sysconfig_get_value(merged, "AUTO6_UPDATE"))) { - unsigned int temp = __NI_ADDRCONF_UPDATE_NONE; + unsigned int temp; - if (ni_addrconf_update_flags_parse(&temp, value, " \t")) - compat->auto6.update &= temp; - else + if (ni_addrconf_update_flags_parse(&temp, value, " \t,")) { + temp &= ni_config_addrconf_update_mask(NI_ADDRCONF_AUTOCONF, AF_INET6); + compat->auto6.update = temp; + } else { ni_warn("ifcfg-%s: unknown flags in AUTO6_UPDATE='%s'", - dev->name, value); + dev->name, ni_print_suspect(value, ni_string_len(value))); + } } ni_sysconfig_destroy(merged); } diff --git a/client/suse/config/sysconfig.dhcp-wicked b/client/suse/config/sysconfig.dhcp-wicked index fc9270ebf..19b1adb79 100644 --- a/client/suse/config/sysconfig.dhcp-wicked +++ b/client/suse/config/sysconfig.dhcp-wicked @@ -39,6 +39,24 @@ DHCLIENT_FQDN_QUALIFY="yes" # DHCLIENT_FQDN_ENCODE="yes" +## Type: list(,default,none,all,dns,ntp,nis,tz,boot,smb,nds,slp,sip,log) +## Default: "" +# +# This variable permits to specify a space separated list of build-in +# facility names supported by the dhcp4 client modifying the default +# options used in requests and to update system settings (via netconfig). +# +# When empty, default settings configured in wicked-config(5) or built-in +# defaults are used. The special "default", "all", and "none" sets enable +# to request none, the built-in default set or all supported options, +# respectively. A "no-" or "-" in the front of a facility name permit to +# remove/disable it from the currently applied set, e.g. "default,-nis" +# disables request for nis options. +# More specific variables as DHCLIENT_SET_DEFAULT_ROUTE,_SET_HOSTNAME or +# the MTU option have higher precedence. +# +DHCLIENT_UPDATE="" + ## Type: list(enabled,disabled,default,) ## Default: "" # @@ -69,3 +87,19 @@ DHCLIENT6_FQDN_UPDATE="" # DHCLIENT6_FQDN_QUALIFY="yes" +## Type: list(,default,none,all,dns,ntp,tz,boot,nis,sip) +## Default: "" +# +# This variable permits to specify a space separated list of build-in +# facility names supported by the dhcp6 client modifying the default +# options used in requests and to update system settings (via netconfig). +# +# When empty, default settings configured in wicked-config(5) or built-in +# defaults are used. The special "default", "all", and "none" sets enable +# to request none, the built-in default set or all supported options, +# respectively. A "no-" or "-" in the front of a facility name permit to +# remove/disable it from the currently applied set, e.g. "default,-nis" +# disables request for nis options. +# The more specific variable DHCLIENT6_SET_HOSTNAME has higher precedence. +# +DHCLIENT6_UPDATE="" From 396e9895aa6ebdf9e26d85eb3d739a03e5e6df12 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Fri, 9 Jun 2017 15:03:02 +0200 Subject: [PATCH 5/5] man: updated wicked-config(5) and ifcfg-dhcp(5) --- man/ifcfg-dhcp.5.in | 35 +++++++++++-- man/wicked-config.5.in | 108 ++++++++++++++++++++++++++++++++++------- 2 files changed, 122 insertions(+), 21 deletions(-) diff --git a/man/ifcfg-dhcp.5.in b/man/ifcfg-dhcp.5.in index 80fa26655..dc02bd007 100644 --- a/man/ifcfg-dhcp.5.in +++ b/man/ifcfg-dhcp.5.in @@ -74,10 +74,10 @@ This option allows to set a metric/priority for DHCPv4 routes. Default is 0. .BR DHCLIENT_CLIENT_ID Specifies a client identifier string. By default an id derived from the hardware address of the network interface is sent as client identifier. -.TP -.BR DHCLIENT_VENDOR_CLASS_ID -Specifies the vendor class identifier string. The default is DHCP client -specific. +.\" .TP +.\" .BR DHCLIENT_VENDOR_CLASS_ID +.\" Specifies the vendor class identifier string. The default is DHCP client +.\" specific. .TP .BR DHCLIENT_USER_CLASS_FORMAT\ { string* | rfc3004 } Specifies the format of the DHCLIENT_USER_CLASS_ID variable. @@ -135,6 +135,20 @@ The DHCP client will stop processing / fail after this time when it does not get a reply from the DHCP server. Before you set this variable, take a look at DHCLIENT_WAIT_AT_BOOT allowing to continue in background instead. Default value is 0. +.TP +.BR DHCLIENT_UPDATE\ {default,none,all,dns,ntp,nis,tz,boot,smb,nds,slp,sip,log} +This variable permits to specify a space separated list of build-in +facility names supported by the dhcp4 client modifying the default +options used in requests and to update system settings (via netconfig). + +When empty, default settings configured in wicked-config(5) or built-in +defaults are used. The special "default", "all", and "none" sets enable +to request none, the built-in default set or all supported options, +respectively. A "no-" or "-" in the front of a facility name permit to +remove/disable it from the currently applied set, e.g. "default,-nis" +disables request for nis options. +More specific variables as DHCLIENT_SET_DEFAULT_ROUTE,DHCLIENT_SET_HOSTNAME +or the MTU option have higher precedence. .SH DHCPv6 Specific Variables .TP @@ -241,6 +255,19 @@ The DHCPv6 client will stop processing / fail after this time when it does not get a reply from the DHCPv6 server. Before you set this variable, take a look at DHCLIENT6_WAIT_AT_BOOT allowing to continue in background instead. .TP +.BR DHCLIENT6_UPDATE\ {default,none,all,dns,ntp,tz,boot,nis,sip} +This variable permits to specify a space separated list of build-in +facility names supported by the dhcp6 client modifying the default +options used in requests and to update system settings (via netconfig). + +When empty, default settings configured in wicked-config(5) or built-in +defaults are used. The special "default", "all", and "none" sets enable +to request none, the built-in default set or all supported options, +respectively. A "no-" or "-" in the front of a facility name permit to +remove/disable it from the currently applied set, e.g. "default,-nis" +disables request for nis options. +The more specific variable DHCLIENT6_SET_HOSTNAME has higher precedence. +.TP .SH COPYRIGHT Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. diff --git a/man/wicked-config.5.in b/man/wicked-config.5.in index cd0e86a49..7d4fe275a 100644 --- a/man/wicked-config.5.in +++ b/man/wicked-config.5.in @@ -224,18 +224,31 @@ information provided by address configuration to apply. Most dynamic address configuration protocols, including DHCP, do not just provide a list of addresses and routes to install for the managed network interface, but can be used to provide information such as a list of DNS servers, directory -information (for e.g. NIS), etc. A system receiving that information is free -to reconfigure some of its services based on this information. -For instance, it makes a lot of sense to configure the resolver library -to use the DNS servers specified by a DHCP server. On the other hand, -for security reasons you may want to ignore any NIS information received -via DHCP. -.IP -The \fB\fP element allows you to control which -system services \fBwicked\fP will consider to update. It contains a list -of empty XML elements naming system facilities to update. The special -elements \fB\fP and \fB\fP enable and disable any and all -updates, respectively. Other valid updaters are: +information (for e.g. NIS), etc. A system receiving that information is free to +reconfigure some of its services based on this information. +For instance, it makes a lot of sense to configure the resolver library to use +the DNS servers specified by a DHCP server. On the other hand, you may want to +ignore any NIS information received via DHCP. +.IP +The \fB\fP is applied to static and intrinsic leases, which +do not have an own, type and address family specific \fB\fP element +as available under the \fB\fP, \fB\fP, \fB\fP and \fB\fP +sub-elements, which support a sub-set of the possible facilities listed here. +The \fB\fP and the type specific \fB\fR elements +enable you to control which system services \fBwicked\fP will (request and) consider +to update in the system. +.IP +It contains a list of either empty XML elements e.g. () naming system +the facilities or alternatively, a space separated string list (dns ntp) with the +facility names. +The special elements \fBdefault\fR, \fBnone\fP and \fBall\fP enable and disable +the default, none and all updates, respectively. A \fBno-\fR or a \fB-\fR in the +front of a facility name permits to remove/disable a facility from the currently +applied set and enable further supported facilities, e.g. \fBdefault,-nis,slp\fR +is applying a modified \fBdefault\fR set with disabled \fBnis\fR and the optional +\fBslp\fR facility enabled additionally. +.IP +The following updater facilities are currently defined: .IP .TS box; @@ -248,9 +261,15 @@ hostname system hostname dns update resolv.conf or dns server (via netconfig) nis NIS client (via netconfig) ntp NTP servers (via netconfig) -smb SMB client (not implemented) -slp SLP client (not implemented) -log syslog servers (not implemented) +smb SMB settings (no netconfig module implemented) +nds NDS servers (no netconfig module implemented) +slp SLP client (no netconfig module implemented) +sip SIP client (no netconfig module implemented) +log syslog servers (no netconfig module implemented) +lpr print servers (no netconfig module implemented) +tz posix time zone (no netconfig module implemented) +mtu adjust iterface mtu (dhcp4) +boot root-path (dhcp4)/boot-url (dhcp6) used in the initrd .TE .IP @@ -265,6 +284,10 @@ supplicant. See below for a list of options. .B dhcp6 This element can be used to control the behavior of the DHCP6 supplicant. See below for a list of options. +.TP +.B auto6 +This element can be used to control the behavior of AUTO6 processing. +.TP .\" -------------------------------------------------------- .SH DHCP4 SUPPLICANT OPTIONS The DHCP4 client can be configured through the options listed below. @@ -294,6 +317,7 @@ or inside a device name context like: .B vendor-class Specifies the string to be used as the vendor-class option in the DHCP request. By default, no vendor-class option is sent. + .TP .B lease-time Specifies the lease time to request in the DHCP request, in seconds. This also @@ -304,6 +328,7 @@ lease time to one hour: .IP .B " 3600 .PP + .TP .B ignore-server Using the \fBip\fB attribute of this element, you can specify the @@ -312,6 +337,7 @@ server that should be ignored: .IP .B " .B " + .TP .B prefer-server Specify a preferred DHCP server, together with a numeric value indicating its @@ -337,11 +363,35 @@ The following example will ignore 192.168.8.1, always use the information from .B " .B " .fi + .TP .B allow-update Specify the list of system services that \fBwicked\fP will configure based on the DHCP lease received. For the syntax of this element, please refer -to the description of \fBdefault-allow-update\fP above. +to the description of \fBdefault-allow-update\fP above. \fBdhcp4\fR supports +all update facilities. +.TP +.B route-options +Specify a space separated list of routing options to request from dhcp4 server. +.IP +.TS +box; +l|l|l +lb|lb|lb. +Name Alias Description += +classless csr RFC 3442 classless static route option 121 +ms-classless mscsr MS classless static route option code 249 (pre RFC 3442) +static-routes class Obsolete option 33 requesting static class routes +.TE + +.IP +The RFC 3442 classless static route option provides all routes with a netmask, +includes the default routers and has priority over other routing options. +By default, wicked requests classless (121) as well as class static routes (33) +and the default routers option (3) (when enabled in allow-update) to be +compatible to old servers or servers not configured to provide classless, +but only a default router option. .TP .B define @@ -403,6 +453,7 @@ make sure to delete that file before restarting the DHCPv6 supplicant. .\" vendor-class .\" vendor-opts .\" + .TP .B lease-time Specifies the lease time to request in the DHCP request, in seconds. This also @@ -413,6 +464,7 @@ lease time to one hour: .IP .B " 3600 .PP + .TP .B ignore-server Using the \fBip\fB attribute of this element, you can specify the @@ -422,6 +474,7 @@ IP address of a faulty DHCP server that should be ignored: .\" are almost always link-local addrs, not the global unicast .\" address; thanks to relying on multicast exclusively). .\" + .TP .B prefer-server Specify a preferred DHCP server, together with a numeric value indicating its @@ -449,11 +502,32 @@ to the third if not: .B " .B " .fi + .TP .B allow-update Specify the list of system services that \fBwicked\fP will configure based on the DHCP lease received. For the syntax of this element, please refer -to the description of \fBdefault-allow-update\fP above. +to the description of \fBdefault-allow-update\fP above. \fBDHCPv6\fR allows +the following update facilities: +.IP +.TS +box; +l|l +lb|lb. +Name Description += +hostname system hostname (fqdn) +dns update resolv.conf or dns server (via netconfig) +ntp NTP servers (via netconfig) +sip SIP client (optional, no netconfig module implemented) +nis NIS client (optional, no netconfig module, not supported by ypbind) +tz posix time zone (no netconfig module implemented) +boot boot-url used in the initrd +.TE + +.IP +Note: \fBDHCPv6\fR protocol does not provide any options to request routing +settings, which are applied via a router advertisement (\fBIPv6 RA\fR). .TP .B define