]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ntp_io.c:
authorFrank Kardel <kardel@ntp.org>
Sun, 30 Sep 2007 16:05:00 +0000 (16:05 +0000)
committerFrank Kardel <kardel@ntp.org>
Sun, 30 Sep 2007 16:05:00 +0000 (16:05 +0000)
  Bug 912: detect conflicting enable/disable configuration on interfaces sharing an IP address
ChangeLog:
  [Bug 912] detect conflicting enable/disable configuration on interfaces sharing an IP address

bk: 46ffc92cInDxBxi75cWEuhUgRDcVoQ

ChangeLog
ntpd/ntp_io.c

index cc40f91e8354c8f765ab0b2abe3db4daa426e489..dc0d12526c77d3a2b621e80245c96bcaa8681289 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 912] detect conflicting enable/disable configuration on interfaces sharing an IP address
 * [Bug 771] compare scopeid if available for IPv6 addresses
 * [Bug 899] Only show -i/--jaildir -u/--user options if we HAVE_DROPROOT.
 * [Bug 916] 'cryptosw' is undefined if built without OpenSSL.
index 8544a1ec12fb338a27376eaf80b22c9f9aed2e6a..545b421825959d6473648b1fb2ec2ccc85afe85a 100644 (file)
@@ -603,7 +603,7 @@ print_interface(struct interface *iface, char *pfx, char *sfx)
               iface->flags,
               iface->scopeid,
               iface->ifindex);
-       /* Leave these as three printf calls. */
+       /* Leave these as three printf calls (stoa() static buffer). */
        printf(", sin=%s",
               stoa((&iface->sin)));
        if (iface->flags & INT_BROADCAST)
@@ -1275,9 +1275,46 @@ update_interfaces(
                        /*
                         * found existing and up to date interface - mark present
                         */
+                       if (iface->phase != sys_interphase)
+                       {
+                               /*
+                                * on a new round we reset the name so the interface name
+                                * shows up again if this address is not shared any more
+                                * same reasoning goes for the enable flag
+                                */
+                               strcpy(iface->name, interface.name);
+                               iface->ignore_packets = interface.ignore_packets;
+                       } else {
+                               /*
+                                * name collision - rename interface name to "*multiple*"
+                                */
+                               strcpy(iface->name, "*multiple*");
+                       }
 
-                       iface->phase = sys_interphase;
                        DPRINT_INTERFACE(4, (iface, "updating ", " present\n"));
+
+                       if (iface->ignore_packets != interface.ignore_packets)
+                       {
+                               /*
+                                * We have conflicting configurations for the interface address.
+                                * This is caused by using -I <interfacename> for an interface
+                                * that shares it address with other interfaces. We cannot disambiguate
+                                * incoming pakets being delivered to this socket without extra
+                                * syscalls/features. These are not (commonly) available.
+                                * Note is is a more unusual configuration where several interfaces
+                                * share an address but filtering via interface name is attempted.
+                                * We resolve the configuration conflict by disabling the reception
+                                * of pakets. This leads to a basically non-functional service on the
+                                * interface address where the conflict occurs.
+                                */
+                               msyslog(LOG_ERR, "WARNING: conflicting enable configuration for interfaces %s and %s for address %s - unsupported configuration - address DISABLED",
+                                       interface.name, iface->name, stoa(&interface.sin));
+
+                               iface->ignore_packets = ISC_TRUE;                               
+                       }
+
+                       iface->phase = sys_interphase;
+
                        ifi.action = IFS_EXISTS;
                        ifi.interface = iface;
                        if (receiver)