|
@ -1,7 +1,7 @@ |
|
|
From 63674f2828a535709805738711503c08efb0e7d4 Mon Sep 17 00:00:00 2001 |
|
|
|
|
|
|
|
|
From e476ea0fbf67062c3c63ea5393fb58e9c2f6a097 Mon Sep 17 00:00:00 2001 |
|
|
From: Brent Cook <busterb@gmail.com> |
|
|
From: Brent Cook <busterb@gmail.com> |
|
|
Date: Tue, 30 Dec 2014 09:05:46 -0600 |
|
|
Date: Tue, 30 Dec 2014 09:05:46 -0600 |
|
|
Subject: [PATCH 05/11] check if rdomain support is available. |
|
|
|
|
|
|
|
|
Subject: [PATCH 05/12] check if rdomain support is available. |
|
|
|
|
|
|
|
|
Handle FreeBSD's calling rdomain 'FIB'. |
|
|
Handle FreeBSD's calling rdomain 'FIB'. |
|
|
- from naddy@openbsd.org |
|
|
- from naddy@openbsd.org |
|
@ -9,8 +9,8 @@ Handle FreeBSD's calling rdomain 'FIB'. |
|
|
src/usr.sbin/ntpd/client.c | 4 ++++ |
|
|
src/usr.sbin/ntpd/client.c | 4 ++++ |
|
|
src/usr.sbin/ntpd/ntpd.h | 6 ++++++ |
|
|
src/usr.sbin/ntpd/ntpd.h | 6 ++++++ |
|
|
src/usr.sbin/ntpd/parse.y | 2 ++ |
|
|
src/usr.sbin/ntpd/parse.y | 2 ++ |
|
|
src/usr.sbin/ntpd/server.c | 11 ++++++++++- |
|
|
|
|
|
4 files changed, 22 insertions(+), 1 deletion(-) |
|
|
|
|
|
|
|
|
src/usr.sbin/ntpd/server.c | 15 ++++++++++++++- |
|
|
|
|
|
4 files changed, 26 insertions(+), 1 deletion(-) |
|
|
|
|
|
|
|
|
diff --git a/src/usr.sbin/ntpd/client.c b/src/usr.sbin/ntpd/client.c
|
|
|
diff --git a/src/usr.sbin/ntpd/client.c b/src/usr.sbin/ntpd/client.c
|
|
|
index e717d69..2be1f93 100644
|
|
|
index e717d69..2be1f93 100644
|
|
@ -43,7 +43,7 @@ index e717d69..2be1f93 100644 |
|
|
for (cmsg = CMSG_FIRSTHDR(&somsg); cmsg != NULL; |
|
|
for (cmsg = CMSG_FIRSTHDR(&somsg); cmsg != NULL; |
|
|
cmsg = CMSG_NXTHDR(&somsg, cmsg)) { |
|
|
cmsg = CMSG_NXTHDR(&somsg, cmsg)) { |
|
|
diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h
|
|
|
diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h
|
|
|
index f6e3acf..28ab1ba 100644
|
|
|
|
|
|
|
|
|
index de4cd84..1402d74 100644
|
|
|
--- a/src/usr.sbin/ntpd/ntpd.h
|
|
|
--- a/src/usr.sbin/ntpd/ntpd.h
|
|
|
+++ b/src/usr.sbin/ntpd/ntpd.h
|
|
|
+++ b/src/usr.sbin/ntpd/ntpd.h
|
|
|
@@ -41,6 +41,12 @@
|
|
|
@@ -41,6 +41,12 @@
|
|
@ -60,7 +60,7 @@ index f6e3acf..28ab1ba 100644 |
|
|
#define INTERVAL_QUERY_PATHETIC 60 |
|
|
#define INTERVAL_QUERY_PATHETIC 60 |
|
|
#define INTERVAL_QUERY_AGGRESSIVE 5 |
|
|
#define INTERVAL_QUERY_AGGRESSIVE 5 |
|
|
diff --git a/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y
|
|
|
diff --git a/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y
|
|
|
index 8faff66..ebf85ca 100644
|
|
|
|
|
|
|
|
|
index 4b9ef49..375f609 100644
|
|
|
--- a/src/usr.sbin/ntpd/parse.y
|
|
|
--- a/src/usr.sbin/ntpd/parse.y
|
|
|
+++ b/src/usr.sbin/ntpd/parse.y
|
|
|
+++ b/src/usr.sbin/ntpd/parse.y
|
|
|
@@ -412,11 +412,13 @@ weight : WEIGHT NUMBER {
|
|
|
@@ -412,11 +412,13 @@ weight : WEIGHT NUMBER {
|
|
@ -78,38 +78,48 @@ index 8faff66..ebf85ca 100644 |
|
|
} |
|
|
} |
|
|
; |
|
|
; |
|
|
diff --git a/src/usr.sbin/ntpd/server.c b/src/usr.sbin/ntpd/server.c
|
|
|
diff --git a/src/usr.sbin/ntpd/server.c b/src/usr.sbin/ntpd/server.c
|
|
|
index dc58b32..0c0d3dc 100644
|
|
|
|
|
|
|
|
|
index ef448d3..618cd8f 100644
|
|
|
--- a/src/usr.sbin/ntpd/server.c
|
|
|
--- a/src/usr.sbin/ntpd/server.c
|
|
|
+++ b/src/usr.sbin/ntpd/server.c
|
|
|
+++ b/src/usr.sbin/ntpd/server.c
|
|
|
@@ -39,7 +39,10 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
|
|
|
|
|
|
|
|
|
@@ -35,11 +35,16 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
|
|
|
|
|
|
struct listen_addr *la, *nla, *lap; |
|
|
|
|
|
struct ifaddrs *ifa, *ifap; |
|
|
|
|
|
struct sockaddr *sa; |
|
|
|
|
|
+#ifdef SO_RTABLE
|
|
|
|
|
|
struct if_data *ifd; |
|
|
|
|
|
+#endif
|
|
|
u_int8_t *a6; |
|
|
u_int8_t *a6; |
|
|
size_t sa6len = sizeof(struct in6_addr); |
|
|
size_t sa6len = sizeof(struct in6_addr); |
|
|
u_int new_cnt = 0; |
|
|
u_int new_cnt = 0; |
|
|
- int tos = IPTOS_LOWDELAY, rdomain, fd;
|
|
|
|
|
|
|
|
|
- int tos = IPTOS_LOWDELAY, rdomain = 0;
|
|
|
+ int tos = IPTOS_LOWDELAY;
|
|
|
+ int tos = IPTOS_LOWDELAY;
|
|
|
+#ifdef SO_RTABLE
|
|
|
+#ifdef SO_RTABLE
|
|
|
+ int rdomain, fd;
|
|
|
|
|
|
|
|
|
+ int rdomain = 0;
|
|
|
+#endif
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
TAILQ_FOREACH(lap, &lconf->listen_addrs, entry) { |
|
|
TAILQ_FOREACH(lap, &lconf->listen_addrs, entry) { |
|
|
switch (lap->sa.ss_family) { |
|
|
switch (lap->sa.ss_family) { |
|
|
@@ -59,6 +62,7 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
|
|
|
|
|
|
strlcpy(ifr.ifr_name, ifap->ifa_name, |
|
|
|
|
|
sizeof(ifr.ifr_name)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -51,15 +56,19 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
|
|
|
|
|
|
sa = ifap->ifa_addr; |
|
|
|
|
|
if (sa == NULL || SA_LEN(sa) == 0) |
|
|
|
|
|
continue; |
|
|
|
|
|
+#ifdef SO_RTABLE
|
|
|
|
|
|
if (sa->sa_family == AF_LINK) { |
|
|
|
|
|
ifd = ifap->ifa_data; |
|
|
|
|
|
rdomain = ifd->ifi_rdomain; |
|
|
|
|
|
} |
|
|
|
|
|
+#endif
|
|
|
|
|
|
if (sa->sa_family != AF_INET && |
|
|
|
|
|
sa->sa_family != AF_INET6) |
|
|
|
|
|
continue; |
|
|
+#ifdef SO_RTABLE
|
|
|
+#ifdef SO_RTABLE
|
|
|
fd = socket(AF_INET, SOCK_DGRAM, 0); |
|
|
|
|
|
if (ioctl(fd, SIOCGIFRDOMAIN, |
|
|
|
|
|
(caddr_t)&ifr) == -1) |
|
|
|
|
|
@@ -69,6 +73,7 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
|
|
|
|
|
|
|
|
|
|
|
|
if (lap->rtable != -1 && rdomain != lap->rtable) |
|
|
if (lap->rtable != -1 && rdomain != lap->rtable) |
|
|
continue; |
|
|
continue; |
|
|
+#endif
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
if (sa->sa_family == AF_INET && |
|
|
if (sa->sa_family == AF_INET && |
|
|
((struct sockaddr_in *)sa)->sin_addr.s_addr == |
|
|
((struct sockaddr_in *)sa)->sin_addr.s_addr == |
|
|
@@ -87,7 +92,9 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
|
|
|
|
|
|
|
|
|
@@ -78,7 +87,9 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
|
|
|
fatal("setup_listeners calloc"); |
|
|
fatal("setup_listeners calloc"); |
|
|
|
|
|
|
|
|
memcpy(&la->sa, sa, SA_LEN(sa)); |
|
|
memcpy(&la->sa, sa, SA_LEN(sa)); |
|
@ -119,7 +129,7 @@ index dc58b32..0c0d3dc 100644 |
|
|
|
|
|
|
|
|
TAILQ_INSERT_TAIL(&lconf->listen_addrs, la, entry); |
|
|
TAILQ_INSERT_TAIL(&lconf->listen_addrs, la, entry); |
|
|
} |
|
|
} |
|
|
@@ -132,10 +139,12 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
|
|
|
|
|
|
|
|
|
@@ -123,10 +134,12 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
|
|
|
IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) == -1) |
|
|
IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) == -1) |
|
|
log_warn("setsockopt IPTOS_LOWDELAY"); |
|
|
log_warn("setsockopt IPTOS_LOWDELAY"); |
|
|
|
|
|
|
|
@ -133,5 +143,5 @@ index dc58b32..0c0d3dc 100644 |
|
|
if (bind(la->fd, (struct sockaddr *)&la->sa, |
|
|
if (bind(la->fd, (struct sockaddr *)&la->sa, |
|
|
SA_LEN((struct sockaddr *)&la->sa)) == -1) { |
|
|
SA_LEN((struct sockaddr *)&la->sa)) == -1) { |
|
|
--
|
|
|
--
|
|
|
1.9.1 |
|
|
|
|
|
|
|
|
2.4.3.573.g4eafbef |
|
|
|
|
|
|