View | Details | Raw Unified
Collapse All | Expand All

(-) dhcp.c (-1 / +26 lines)
 Lines 492-497    Link Here 
	return (sip);
	return (sip);
}
}
/* This calculates the netmask that we should use for static routes */
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;