Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/dist/ntp deal with sin6_scope_id where necessary
details: https://anonhg.NetBSD.org/src/rev/f02404c4168b
branches: trunk
changeset: 555926:f02404c4168b
user: drochner <drochner%NetBSD.org@localhost>
date: Thu Dec 04 16:56:01 2003 +0000
description:
deal with sin6_scope_id where necessary
diffstat:
dist/ntp/include/ntp.h | 8 +++++---
dist/ntp/ntpd/ntp_io.c | 16 +++++++++++++---
2 files changed, 18 insertions(+), 6 deletions(-)
diffs (75 lines):
diff -r 2007464ed051 -r f02404c4168b dist/ntp/include/ntp.h
--- a/dist/ntp/include/ntp.h Thu Dec 04 16:52:28 2003 +0000
+++ b/dist/ntp/include/ntp.h Thu Dec 04 16:56:01 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ntp.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */
+/* $NetBSD: ntp.h,v 1.3 2003/12/04 16:56:01 drochner Exp $ */
/*
* ntp.h - NTP definitions for the masses
@@ -470,9 +470,11 @@
memcmp(&((struct sockaddr_in *)sock1)->sin_addr, \
&((struct sockaddr_in *)sock2)->sin_addr, \
sizeof(struct in_addr)) == 0 : \
- memcmp(&((struct sockaddr_in6 *)sock1)->sin6_addr, \
+ (memcmp(&((struct sockaddr_in6 *)sock1)->sin6_addr, \
&((struct sockaddr_in6 *)sock2)->sin6_addr, \
- sizeof(struct in6_addr)) == 0 : \
+ sizeof(struct in6_addr)) == 0) && \
+ (((struct sockaddr_in6 *)sock1)->sin6_scope_id == \
+ ((struct sockaddr_in6 *)sock2)->sin6_scope_id) : \
0)
#define SOCKNUL(sock1) \
diff -r 2007464ed051 -r f02404c4168b dist/ntp/ntpd/ntp_io.c
--- a/dist/ntp/ntpd/ntp_io.c Thu Dec 04 16:52:28 2003 +0000
+++ b/dist/ntp/ntpd/ntp_io.c Thu Dec 04 16:56:01 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ntp_io.c,v 1.8 2003/12/04 16:23:37 drochner Exp $ */
+/* $NetBSD: ntp_io.c,v 1.9 2003/12/04 16:56:01 drochner Exp $ */
/*
* ntp_io.c - input/output routines for ntpd. The socket-opening code
@@ -382,6 +382,8 @@
memcpy(&(((struct sockaddr_in6 *)&itf->sin)->sin6_addr),
&(isc_if->address.type.in6),
sizeof(struct in6_addr));
+ ((struct sockaddr_in6 *)&itf->sin)->sin6_scope_id =
+ isc_if->address.zone;
((struct sockaddr_in6 *)&itf->sin)->sin6_port = port;
itf->mask.ss_family = itf->sin.ss_family;
@@ -772,6 +774,8 @@
memset((char *)&mreq6, 0, sizeof(mreq6));
memset((char *)&inter_list[i], 0, sizeof(struct interface));
sin6p->sin6_family = AF_INET6;
+ sin6p->sin6_scope_id =
+ ((struct sockaddr_in6*)&addr)->sin6_scope_id;
sin6p->sin6_addr = iaddr6;
sin6p->sin6_port = htons(NTP_PORT);
@@ -812,7 +816,10 @@
* enable reception of multicast packets
*/
mreq6.ipv6mr_multiaddr = iaddr6;
- mreq6.ipv6mr_interface = 0;
+ if (IN6_IS_ADDR_MC_LINKLOCAL(&iaddr6))
+ mreq6.ipv6mr_interface = sin6p->sin6_scope_id;
+ else
+ mreq6.ipv6mr_interface = 0;
if(setsockopt(inter_list[i].fd, IPPROTO_IPV6, IPV6_JOIN_GROUP,
(char *)&mreq6, sizeof(mreq6)) == -1)
netsyslog(LOG_ERR,
@@ -1903,8 +1910,11 @@
saddr.ss_family = addr->ss_family;
if(addr->ss_family == AF_INET)
memcpy(&((struct sockaddr_in*)&saddr)->sin_addr, &((struct sockaddr_in*)addr)->sin_addr, sizeof(struct in_addr));
- else if(addr->ss_family == AF_INET6)
+ else if(addr->ss_family == AF_INET6) {
memcpy(&((struct sockaddr_in6*)&saddr)->sin6_addr, &((struct sockaddr_in6*)addr)->sin6_addr, sizeof(struct in6_addr));
+ ((struct sockaddr_in6*)&saddr)->sin6_scope_id =
+ ((struct sockaddr_in6*)addr)->sin6_scope_id;
+ }
((struct sockaddr_in*)&saddr)->sin_port = htons(2000);
s = socket(addr->ss_family, SOCK_DGRAM, 0);
if (s == INVALID_SOCKET)
Home |
Main Index |
Thread Index |
Old Index