Commit 2b461bfa authored by Scott Shambarger's avatar Scott Shambarger Committed by Thomas Haller

core: set classful prefix length for DHCP4 static routes (bgo #721771)

Follow RFC 3442 to set network prefix based on address class.
However, still uses host routing if the target address is not a
network address (ie host part not zero).

https://bugzilla.gnome.org/show_bug.cgi?id=721771Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
parent 240c92dd
......@@ -1073,15 +1073,24 @@ process_classful_routes (GHashTable *options, NMIP4Config *ip4_config)
continue;
}
// FIXME: ensure the IP addresse and route are sane
// FIXME: ensure the IP address and route are sane
memset (&route, 0, sizeof (route));
route.network = rt_addr;
route.plen = 32;
/* RFC 2132, updated by RFC 3442:
The Static Routes option (option 33) does not provide a subnet mask
for each route - it is assumed that the subnet mask is implicit in
whatever network number is specified in each route entry */
route.plen = nm_utils_ip4_get_default_prefix (rt_addr);
if (rt_addr & ~nm_utils_ip4_prefix_to_netmask (route.plen)) {
/* RFC 943: target not "this network"; using host routing */
route.plen = 32;
}
route.gateway = rt_route;
nm_ip4_config_add_route (ip4_config, &route);
nm_log_info (LOGD_DHCP, " static route %s gw %s", *s, *(s + 1));
nm_log_info (LOGD_DHCP, " static route %s",
nm_platform_ip4_route_to_string (&route));
}
out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment