Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 186385
Collapse All | Expand All

(-)dhcp.c (-1 / +26 lines)
Lines 492-497 Link Here
492
	return (sip);
492
	return (sip);
493
}
493
}
494
494
495
/* This calculates the netmask that we should use for static routes */
496
static unsigned long route_netmask (unsigned long ip_in)
497
{
498
	unsigned long p = ntohl (ip_in);
499
	unsigned long t;
500
501
	if (IN_CLASSA (p))
502
		t = ~IN_CLASSA_NET;
503
	else {
504
		if (IN_CLASSB (p))
505
			t = ~IN_CLASSB_NET;
506
		else {
507
			if (IN_CLASSC (p))
508
				t = ~IN_CLASSC_NET;
509
			else
510
				t = 0;
511
		}
512
	}
513
514
	while (t & p)
515
		t >>= 1;
516
517
	return (htonl (~t));
518
}
519
495
int parse_dhcpmessage (dhcp_t *dhcp, const dhcpmessage_t *message)
520
int parse_dhcpmessage (dhcp_t *dhcp, const dhcpmessage_t *message)
496
{
521
{
497
	const unsigned char *p = message->options;
522
	const unsigned char *p = message->options;
Lines 705-711 Link Here
705
					memcpy (&static_routesp->destination.s_addr, p + i, 4);
730
					memcpy (&static_routesp->destination.s_addr, p + i, 4);
706
					memcpy (&static_routesp->gateway.s_addr, p + i + 4, 4);
731
					memcpy (&static_routesp->gateway.s_addr, p + i + 4, 4);
707
					static_routesp->netmask.s_addr =
732
					static_routesp->netmask.s_addr =
708
						get_netmask (static_routesp->destination.s_addr); 
733
						route_netmask (static_routesp->destination.s_addr); 
709
				}
734
				}
710
				break;
735
				break;
711
736

Return to bug 186385