Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Oct 2002 14:01:54 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Michael Palinski <mikep@mail.msen.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: ntp not working as expected
Message-ID:  <20021003190154.GB19343@dan.emsphone.com>
In-Reply-To: <20021003143642.E8504@staff.msen.com>
References:  <20021003143642.E8504@staff.msen.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Oct 03), Michael Palinski said:
> FreeBSD 4.5-RELEASE-p20
> 
> virtual web server offering ssl os addresses are configured on the
> loopback interface using lines in rc.conf like;
>    ifconfig_lo0_alias1="inet 148.59.66.1     netmask 255.255.255.255 "
> 
> The code around line 306 of ntp/ntpd/ntp_io.c tries to prevent ntpd
> from listening on these aliased interfaces but does not work.
> netstat -a shows ntp listening on each of these addresses.

It _looks_ like that code checks for two IPs in the same subnet, but it
only works if the netmask for both interfaces is the same.  This
basically causes the test to always fail, since alias IPs have a
netmask of 255.255.255.255.  I think it really should use the largest
of the two subnets:

                for (j=0; j < i; j++)
                {
                    unsigned int mask = MAX(inter_list[j].mask.sin_addr.s_addr,inter_list[i].mask.sin_addr.s_addr);
                    if (inter_list[j].sin.sin_addr.s_addr & mask ==
                        inter_list[i].sin.sin_addr.s_addr & mask )
                    {
                            if (inter_list[j].flags & INT_LOOPBACK)
                                inter_list[j] = inter_list[i];
                            break;
                    }
                }


-- 
	Dan Nelson
	dnelson@allantgroup.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021003190154.GB19343>