static gboolean
ip4_process_dhclient_rfc3442_routes (const char *str,
                                     NMIP4Config *ip4_config,
                                     guint32 *gwaddr)
{
	char **octets, **o;
	gboolean have_routes = FALSE;
	NMIP4Route *route = NULL;

	o = octets = g_strsplit_set (str, " .", 0);
	if (g_strv_length (octets) < 5) {
		nm_log_warn (LOGD_DHCP4, "ignoring invalid classless static routes '%s'", str);
		goto out;
	}

	while (*o) {
		route = NULL;
		o = (char **) process_dhclient_rfc3442_route ((const char **) o, &route);
		if (!route) {
			nm_log_warn (LOGD_DHCP4, "ignoring invalid classless static routes");
			break;
		}

		have_routes = TRUE;
		if (nm_ip4_route_get_prefix (route) == 0) {
			/* gateway passed as classless static route */
			*gwaddr = nm_ip4_route_get_next_hop (route);
			nm_ip4_route_unref (route);
		} else {
			char addr[INET_ADDRSTRLEN + 1];
			char nh[INET_ADDRSTRLEN + 1];
			struct in_addr tmp;

			/* normal route */
			nm_ip4_config_take_route (ip4_config, route);

			tmp.s_addr = nm_ip4_route_get_dest (route);
			inet_ntop (AF_INET, &tmp, addr, sizeof (addr));
			tmp.s_addr = nm_ip4_route_get_next_hop (route);
			inet_ntop (AF_INET, &tmp, nh, sizeof (nh));
			nm_log_info (LOGD_DHCP4, "  classless static route %s/%d gw %s",
			             addr, nm_ip4_route_get_prefix (route), nh);
		}
	}

out:
	g_strfreev (octets);
	return have_routes;
}
static gboolean
ip4_process_dhclient_rfc3442_routes (const char *str,
                                     guint32 priority,
                                     NMIP4Config *ip4_config,
                                     guint32 *gwaddr)
{
	char **octets, **o;
	gboolean have_routes = FALSE;
	NMPlatformIP4Route route;
	gboolean success;

	o = octets = g_strsplit_set (str, " .", 0);
	if (g_strv_length (octets) < 5) {
		nm_log_warn (LOGD_DHCP4, "ignoring invalid classless static routes '%s'", str);
		goto out;
	}

	while (*o) {
		memset (&route, 0, sizeof (route));
		o = (char **) process_dhclient_rfc3442_route ((const char **) o, &route, &success);
		if (!success) {
			nm_log_warn (LOGD_DHCP4, "ignoring invalid classless static routes");
			break;
		}

		have_routes = TRUE;
		if (!route.plen) {
			/* gateway passed as classless static route */
			*gwaddr = route.gateway;
		} else {
			char addr[INET_ADDRSTRLEN];

			/* normal route */
			route.source = NM_IP_CONFIG_SOURCE_DHCP;
			route.metric = priority;
			nm_ip4_config_add_route (ip4_config, &route);

			nm_log_info (LOGD_DHCP4, "  classless static route %s/%d gw %s",
			             nm_utils_inet4_ntop (route.network, addr), route.plen,
			             nm_utils_inet4_ntop (route.gateway, NULL));
		}
	}

out:
	g_strfreev (octets);
	return have_routes;
}