]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
If auth is disabled, then disable FORCERENEW and RECONFIGURE_ACCEPT
authorRoy Marples <roy@marples.name>
Sun, 2 Apr 2017 09:55:52 +0000 (10:55 +0100)
committerRoy Marples <roy@marples.name>
Sun, 2 Apr 2017 09:55:52 +0000 (10:55 +0100)
entirely.

src/dhcp.c
src/dhcp6.c

index 0e32665e0fcfbe65b08af3479347bd6cdebb19e8..0761caa8e17093ca1da6d30bd980f3fd0db38a7f 100644 (file)
@@ -2741,8 +2741,8 @@ dhcp_handledhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len,
        unsigned int i;
        char *msg;
        bool bootp_copied;
-       const uint8_t *auth;
 #ifdef AUTH
+       const uint8_t *auth;
        size_t auth_len;
 #endif
 #ifdef IN_IFF_DUPLICATED
@@ -2812,8 +2812,6 @@ dhcp_handledhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len,
                }
                LOGDHCP0(LOG_WARNING, "no authentication");
        }
-#else
-       auth = NULL;
 #endif
 
        /* RFC 3203 */
@@ -2824,8 +2822,9 @@ dhcp_handledhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len,
                        LOGDHCP(LOG_ERR, "discarding Force Renew");
                        return;
                }
+#ifdef AUTH
                if (auth == NULL) {
-                       LOGDHCP(LOG_ERR, "unauthenticated Force Renew");
+                       LOGDHCP(LOG_ERR, "unauthenticated force renew");
                        if (ifo->auth.options & DHCPCD_AUTH_REQUIRE)
                                return;
                }
@@ -2843,6 +2842,9 @@ dhcp_handledhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len,
                            send_inform, ifp);
                        dhcp_inform(ifp);
                }
+#else
+               LOGDHCP(LOG_ERR, "unauthenticated force renew");
+#endif
                return;
        }
 
index bda1347b6bf8e118b85d7f6e88303845a1c42a84..94b1cd5baf64ee38412727385aeffc2167a204eb 100644 (file)
@@ -635,9 +635,11 @@ dhcp6_makemessage(struct interface *ifp)
                if (ifo->mudurl[0])
                        len += sizeof(o) + ifo->mudurl[0];
 
+#ifdef AUTH
                if ((ifo->auth.options & DHCPCD_AUTH_SENDREQUIRE) !=
                    DHCPCD_AUTH_SENDREQUIRE)
                        len += sizeof(o); /* Reconfigure Accept */
+#endif
        }
 
        len += sizeof(*state->send);
@@ -906,11 +908,12 @@ dhcp6_makemessage(struct interface *ifp)
                if (ifo->mudurl[0])
                        COPYIN(D6_OPTION_MUDURL,
                            ifo->mudurl + 1, ifo->mudurl[0]);
-               
 
+#ifdef AUTH
                if ((ifo->auth.options & DHCPCD_AUTH_SENDREQUIRE) !=
                    DHCPCD_AUTH_SENDREQUIRE)
                        COPYIN1(D6_OPTION_RECONF_ACCEPT, 0);
+#endif
 
                if (n_options) {
                        o_lenp = NEXTLEN;
@@ -2885,8 +2888,6 @@ dhcp6_handledata(void *arg)
                syslog(LOG_WARNING, "%s: no authentication from %s",
                    ifp->name, ctx->sfrom);
        }
-#else
-       auth = NULL;
 #endif
 
        op = dhcp6_get_op(r->type);
@@ -2996,11 +2997,14 @@ dhcp6_handledata(void *arg)
                        return;
                break;
        case DHCP6_RECONFIGURE:
+#ifdef AUTH
                if (auth == NULL) {
+#endif
                        syslog(LOG_ERR, "%s: unauthenticated %s from %s",
                            ifp->name, op, ctx->sfrom);
                        if (ifo->auth.options & DHCPCD_AUTH_REQUIRE)
                                return;
+#ifdef AUTH
                }
                syslog(LOG_INFO, "%s: %s from %s",
                    ifp->name, op, ctx->sfrom);
@@ -3041,6 +3045,7 @@ dhcp6_handledata(void *arg)
                        break;
                }
                return;
+#endif
        default:
                syslog(LOG_ERR, "%s: invalid DHCP6 type %s (%d)",
                    ifp->name, op, r->type);