Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 158867 | Differences between
and this patch

Collapse All | Expand All

(-)interface.c (-1 / +2 lines)
Lines 885-891 Link Here
885
	else {
885
	else {
886
		nlm.hdr.nlmsg_flags |= NLM_F_CREATE | NLM_F_EXCL;
886
		nlm.hdr.nlmsg_flags |= NLM_F_CREATE | NLM_F_EXCL;
887
		nlm.rt.rtm_protocol = RTPROT_BOOT;
887
		nlm.rt.rtm_protocol = RTPROT_BOOT;
888
		if (gateway.s_addr == INADDR_ANY)
888
		if (gateway.s_addr == INADDR_ANY ||
889
			gateway.s_addr == destination.s_addr)
889
			nlm.rt.rtm_scope = RT_SCOPE_LINK;
890
			nlm.rt.rtm_scope = RT_SCOPE_LINK;
890
		else
891
		else
891
			nlm.rt.rtm_scope = RT_SCOPE_UNIVERSE;
892
			nlm.rt.rtm_scope = RT_SCOPE_UNIVERSE;
(-)dhcp.c (-1 / +28 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
 * This IS different from the calculation used to calculate the netmask
497
 * for an interface address. */
498
static unsigned long route_netmask (unsigned long ip_in)
499
{
500
	unsigned long p = ntohl (ip_in);
501
	unsigned long t;
502
503
	if (IN_CLASSA (p))
504
		t = ~IN_CLASSA_NET;
505
	else {
506
		if (IN_CLASSB (p))
507
			t = ~IN_CLASSB_NET;
508
		else {
509
			if (IN_CLASSC (p))
510
				t = ~IN_CLASSC_NET;
511
			else
512
				t = 0;
513
		}
514
	}
515
516
	while (t & p)
517
		t >>= 1;
518
519
	return (htonl (~t));
520
}
521
495
int parse_dhcpmessage (dhcp_t *dhcp, const dhcpmessage_t *message)
522
int parse_dhcpmessage (dhcp_t *dhcp, const dhcpmessage_t *message)
496
{
523
{
497
	const unsigned char *p = message->options;
524
	const unsigned char *p = message->options;
Lines 705-711 Link Here
705
					memcpy (&static_routesp->destination.s_addr, p + i, 4);
732
					memcpy (&static_routesp->destination.s_addr, p + i, 4);
706
					memcpy (&static_routesp->gateway.s_addr, p + i + 4, 4);
733
					memcpy (&static_routesp->gateway.s_addr, p + i + 4, 4);
707
					static_routesp->netmask.s_addr =
734
					static_routesp->netmask.s_addr =
708
						get_netmask (static_routesp->destination.s_addr); 
735
						route_netmask (static_routesp->destination.s_addr); 
709
				}
736
				}
710
				break;
737
				break;
711
738

Return to bug 158867