View | Details | Raw Unified
Collapse All | Expand All

(-) interface.c (-1 / +2 lines)
 Lines 885-891    Link Here 
	else {
	else {
		nlm.hdr.nlmsg_flags |= NLM_F_CREATE | NLM_F_EXCL;
		nlm.hdr.nlmsg_flags |= NLM_F_CREATE | NLM_F_EXCL;
		nlm.rt.rtm_protocol = RTPROT_BOOT;
		nlm.rt.rtm_protocol = RTPROT_BOOT;
		if (gateway.s_addr == INADDR_ANY)
		if (gateway.s_addr == INADDR_ANY ||
			gateway.s_addr == destination.s_addr)
			nlm.rt.rtm_scope = RT_SCOPE_LINK;
			nlm.rt.rtm_scope = RT_SCOPE_LINK;
		else
		else
			nlm.rt.rtm_scope = RT_SCOPE_UNIVERSE;
			nlm.rt.rtm_scope = RT_SCOPE_UNIVERSE;
(-) dhcp.c (-1 / +28 lines)
 Lines 492-497    Link Here 
	return (sip);
	return (sip);
}
}
/* This calculates the netmask that we should use for static routes.
 * This IS different from the calculation used to calculate the netmask
 * for an interface address. */
static unsigned long route_netmask (unsigned long ip_in)
{
	unsigned long p = ntohl (ip_in);
	unsigned long t;
	if (IN_CLASSA (p))
		t = ~IN_CLASSA_NET;
	else {
		if (IN_CLASSB (p))
			t = ~IN_CLASSB_NET;
		else {
			if (IN_CLASSC (p))
				t = ~IN_CLASSC_NET;
			else
				t = 0;
		}
	}
	while (t & p)
		t >>= 1;
	return (htonl (~t));
}
int parse_dhcpmessage (dhcp_t *dhcp, const dhcpmessage_t *message)
int parse_dhcpmessage (dhcp_t *dhcp, const dhcpmessage_t *message)
{
{
	const unsigned char *p = message->options;
	const unsigned char *p = message->options;
 Lines 705-711    Link Here 
					memcpy (&static_routesp->destination.s_addr, p + i, 4);
					memcpy (&static_routesp->destination.s_addr, p + i, 4);
					memcpy (&static_routesp->gateway.s_addr, p + i + 4, 4);
					memcpy (&static_routesp->gateway.s_addr, p + i + 4, 4);
					static_routesp->netmask.s_addr =
					static_routesp->netmask.s_addr =
						get_netmask (static_routesp->destination.s_addr); 
						route_netmask (static_routesp->destination.s_addr); 
				}
				}
				break;
				break;