*/
extern char const *progname;
int listen_to_virtual_ips = 1;
+char *specific_interface = NULL; /* interface name or IP address to bind to */
-static const char *ntp_options = "aAbB:c:C:dD:f:gi:k:l:LnNO:p:P:qr:s:S:t:T:W:u:v:V:xY:Z:-:";
+static const char *ntp_options = "aAbB:c:C:dD:f:gi:k:l:L:nNO:p:P:qr:s:S:t:T:W:u:v:V:xY:Z:-:";
#ifdef HAVE_NETINFO
extern int check_netinfo;
#endif
case 'L':
listen_to_virtual_ips = 0;
+ if(ntp_optarg)
+ specific_interface = ntp_optarg;
break;
case 'l':
{
(void) fprintf(stderr, "\t\t[ -f freq_file ] [ -k key_file ] [ -l log_file ]\n");
(void) fprintf(stderr, "\t\t[ -p pid_file ] [ -r broad_delay ] [ -s statdir ]\n");
(void) fprintf(stderr, "\t\t[ -t trust_key ] [ -v sys_var ] [ -V default_sysvar ]\n");
+ (void) fprintf(stderr, "\t\t[ -L interface ]\n");
#if defined(HAVE_SCHED_SETSCHEDULER)
(void) fprintf(stderr, "\t\t[ -P fixed_process_priority ]\n");
#endif
(void) fprintf(stderr, "\t\t[ -f freq_file ] [ -k key_file ] [ -l log_file ]\n");
(void) fprintf(stderr, "\t\t[ -p pid_file ] [ -r broad_delay ] [ -s statdir ]\n");
(void) fprintf(stderr, "\t\t[ -t trust_key ] [ -v sys_var ] [ -V default_sysvar ]\n");
+ (void) fprintf(stderr, "\t\t[ -L interface ]\n");
#if defined(HAVE_SCHED_SETSCHEDULER)
(void) fprintf(stderr, "\t\t[ -P fixed_process_priority ]\n");
#endif
*/
extern int listen_to_virtual_ips;
+extern const char *specific_interface;
#if defined(SYS_WINNT)
#include <transmitbuff.h>
printf("address_okay: listen Virtual: %d, IF name: %s, Up Flag: %d\n",
listen_to_virtual_ips, isc_if->name, (isc_if->flags & INTERFACE_F_UP));
#endif
+ /*
+ * Always allow the loopback
+ */
+ if((isc_if->flags & INTERFACE_F_LOOPBACK) != 0)
+ return (ISC_TRUE);
- if (listen_to_virtual_ips == 0 && (strchr(isc_if->name, (int)':') != NULL))
- return (ISC_FALSE);
+ /*
+ * Check if the interface is specified
+ */
+ if (specific_interface != NULL) {
+ if (stricmp(isc_if->name, specific_interface) == 0)
+ return (ISC_TRUE);
+ }
+ else {
+ if (listen_to_virtual_ips == 0 &&
+ (strchr(isc_if->name, (int)':') != NULL))
+ return (ISC_FALSE);
+ }
/* XXXPDM This should be fixed later, but since we may not have set
* the UP flag, we at least get to use the interface.
netsyslog(LOG_ERR, "no IPv4 interfaces found");
#endif
#ifdef UDP_WILDCARD_DELIVERY
- nwilds = create_wildcards(port);
- idx = nwilds;
+ if (specific_interface == NULL) {
+ nwilds = create_wildcards(port);
+ idx = nwilds;
+ }
#endif
result = isc_interfaceiter_create(mctx, &iter);