Blob Blame History Raw
--- ntp-4.2.4p2/include/ntpd.h.multilisten	2006-12-28 13:03:06.000000000 +0100
+++ ntp-4.2.4p2/include/ntpd.h	2007-06-21 10:31:38.000000000 +0200
@@ -79,6 +79,8 @@ extern  void	enable_broadcast P((struct 
 extern  void	enable_multicast_if P((struct interface *, struct sockaddr_storage *));
 extern	void	interface_dump	 P((struct interface *));
 
+extern  void    add_specific_interface P((const char *));
+extern  void    init_specific_interface P((void));
 extern  void    interface_update P((interface_receiver_t, void *));
 extern	void	init_io 	P((void));
 extern	void	input_handler	P((l_fp *));
--- ntp-4.2.4p2/ntpd/ntp_io.c.multilisten	2007-05-29 13:02:33.000000000 +0200
+++ ntp-4.2.4p2/ntpd/ntp_io.c	2007-06-21 10:33:58.000000000 +0200
@@ -66,7 +66,15 @@
 #endif  /* IPv6 Support */
 
 extern int listen_to_virtual_ips;
-extern const char *specific_interface;
+
+/* interface names to listen on */
+struct specific_interface {
+	const char *name;
+	ISC_LINK(struct specific_interface) link;
+};
+
+ISC_LIST(struct specific_interface) specific_interface_list;
+
 
 #if defined(SO_TIMESTAMP) && defined(SCM_TIMESTAMP)
 #if defined(CMSG_FIRSTHDR)
@@ -924,14 +932,15 @@ address_okay(struct interface *iface) {
 	/*
 	 * Check if the interface is specified
 	 */
-	if (specific_interface != NULL) {
-		if (strcasecmp(iface->name, specific_interface) == 0) {
-			DPRINTF(4, ("address_okay: specific interface name matched - OK\n"));
-			return (ISC_TRUE);
-		} else {
-			DPRINTF(4, ("address_okay: specific interface name NOT matched - FAIL\n"));
-			return (ISC_FALSE);
-		}
+ 	if (ISC_LIST_HEAD(specific_interface_list)) {
+ 		struct specific_interface *iface_;
+ 		for (iface_ = ISC_LIST_HEAD(specific_interface_list); iface_ != NULL; iface_ = ISC_LIST_NEXT(iface_, link))
+ 			if (strcasecmp(iface->name, iface_->name) == 0) {
+				DPRINTF(4, ("address_okay: specific interface name matched - OK\n"));
+ 				return (ISC_TRUE);
+			}
+		DPRINTF(4, ("address_okay: specific interface name NOT matched - FAIL\n"));
+ 		return (ISC_FALSE);
 	}
 	else {
 		if (listen_to_virtual_ips == 0  && 
@@ -1044,6 +1053,23 @@ refresh_interface(struct interface * int
 #endif /* !OS_MISSES_SPECIFIC_ROUTE_UPDATES */
 }
 
+void
+add_specific_interface (const char *if_name)
+{
+	struct specific_interface *iface;
+
+	iface = (struct specific_interface *)emalloc(sizeof(struct specific_interface));
+	iface->name = if_name;
+	ISC_LINK_INIT(iface, link);
+	ISC_LIST_APPEND(specific_interface_list, iface, link);
+}
+
+void
+init_specific_interface (void)
+{
+	ISC_LIST_INIT(specific_interface_list);
+}
+
 /*
  * interface_update - externally callable update function
  */
--- ntp-4.2.4p2/ntpd/cmd_args.c.multilisten	2006-12-28 13:03:26.000000000 +0100
+++ ntp-4.2.4p2/ntpd/cmd_args.c	2007-06-21 10:31:38.000000000 +0200
@@ -22,7 +22,6 @@
  * Definitions of things either imported from or exported to outside
  */
 extern char const *progname;
-extern const char *specific_interface;
 extern int default_ai_family;
 
 #ifdef HAVE_NETINFO
--- ntp-4.2.4p2/ntpd/ntpd.c.multilisten	2007-06-21 10:31:38.000000000 +0200
+++ ntp-4.2.4p2/ntpd/ntpd.c	2007-06-21 10:31:38.000000000 +0200
@@ -156,7 +156,6 @@ volatile int debug = 0;		/* No debugging
 #endif
 
 int	listen_to_virtual_ips = 1;
-const char *specific_interface = NULL;        /* interface name or IP address to bind to */
 
 /*
  * No-fork flag.  If set, we do not become a background daemon.
@@ -537,18 +536,14 @@ ntpdmain(
 	if (HAVE_OPT( NOVIRTUALIPS ))
 		listen_to_virtual_ips = 0;
 
+	init_specific_interface();
+
 	if (HAVE_OPT( INTERFACE )) {
-#if 0
 		int	ifacect = STACKCT_OPT( INTERFACE );
-		char**	ifaces  = STACKLST_OPT( INTERFACE );
+		const char** ifaces  = STACKLST_OPT( INTERFACE );
 
-		/* malloc space for the array of names */
-		while (ifacect-- > 0) {
-			next_iface = *ifaces++;
-		}
-#else
-		specific_interface = OPT_ARG( INTERFACE );
-#endif
+		while (ifacect-- > 0)
+			add_specific_interface(*ifaces++);
 	}
 
 	if (HAVE_OPT( NICE ))