summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2015-01-13 16:56:11 +0100
committerJiří Klimeš <jklimes@redhat.com>2015-01-13 16:56:11 +0100
commit612a615d11f577ef1b3387c6640afbebe905fee4 (patch)
tree44dcc73ecb25ede570a6363887e888b6ce1ce858
parent91fd36e166fcf5667e34e0016f7b6919ba931c3b (diff)
downloadNetworkManager-jk/dhcpv6-plen-rh1176518.tar.gz
dhcp: set prefix length for addresses from DHCPv6 (rh #1176518)jk/dhcpv6-plen-rh1176518
https://bugzilla.redhat.com/show_bug.cgi?id=1176518
-rw-r--r--src/dhcp-manager/nm-dhcp-utils.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/dhcp-manager/nm-dhcp-utils.c b/src/dhcp-manager/nm-dhcp-utils.c
index 5aa25ff0c4..c151423797 100644
--- a/src/dhcp-manager/nm-dhcp-utils.c
+++ b/src/dhcp-manager/nm-dhcp-utils.c
@@ -597,6 +597,7 @@ nm_dhcp_utils_ip6_config_from_options (const char *iface,
{
NMIP6Config *ip6_config = NULL;
struct in6_addr tmp_addr;
+ long int plen;
NMPlatformIP6Address address;
char *str = NULL;
GHashTableIter iter;
@@ -645,6 +646,20 @@ nm_dhcp_utils_ip6_config_from_options (const char *iface,
goto error;
}
+ str = g_hash_table_lookup (options, "ip6_prefixlen");
+ if (str) {
+ plen = strtol (str, NULL, 10);
+ if (plen < 0 || plen > 128) {
+ nm_log_warn (LOGD_DHCP6, "invalid ip6_prefixlen '%ld'", plen);
+ goto error;
+ }
+ nm_log_info (LOGD_DHCP6, " plen %d (%s)", (guint32) plen, str);
+ } else {
+ plen = 128; /* use 128 as default prefix length */
+ nm_log_info (LOGD_DHCP6, " plen %d (default)", (guint32) plen);
+ }
+ address.plen = (guint32) plen;
+
str = g_hash_table_lookup (options, "host_name");
if (str)
nm_log_info (LOGD_DHCP6, " hostname '%s'", str);