summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-11-18 13:51:50 +0000
committerRoy Marples <roy@marples.name>2016-11-18 13:51:50 +0000
commit2de9a84057ca252345ef74982608291f0a879e47 (patch)
treef3dd131343069c24955d10dd3e259896105c1e96
parent37940841bd17e9ec7d7bd98478cdbdce7ec2aae5 (diff)
parentc2603990c437fe70a5cf01c274c6e19c9aedb7a6 (diff)
downloaddhcpcd-2de9a84057ca252345ef74982608291f0a879e47.tar.xz
Merge fixes from dhcpcd-6 for authentication token algo.
-rw-r--r--auth.c1
-rw-r--r--auth.h1
-rw-r--r--dhcpcd.conf.5.in5
-rw-r--r--if-options.c5
4 files changed, 9 insertions, 3 deletions
diff --git a/auth.c b/auth.c
index 45418dd9..dc8f0274 100644
--- a/auth.c
+++ b/auth.c
@@ -520,6 +520,7 @@ dhcp_auth_encode(struct auth *auth, const struct token *t,
}
switch(auth->algorithm) {
+ case AUTH_ALG_NONE:
case AUTH_ALG_HMAC_MD5:
break;
default:
diff --git a/auth.h b/auth.h
index 21c1664f..699ed51a 100644
--- a/auth.h
+++ b/auth.h
@@ -45,6 +45,7 @@
#define AUTH_PROTO_DELAYEDREALM 2
#define AUTH_PROTO_RECONFKEY 3
+#define AUTH_ALG_NONE 0
#define AUTH_ALG_HMAC_MD5 1
#define AUTH_RDM_MONOTONIC 0
diff --git a/dhcpcd.conf.5.in b/dhcpcd.conf.5.in
index 1a2ef421..4c8d30c0 100644
--- a/dhcpcd.conf.5.in
+++ b/dhcpcd.conf.5.in
@@ -79,9 +79,10 @@ Authenticate DHCP messages.
See the Supported Authentication Protocols section.
.It Ic authtoken Ar secretid Ar realm Ar expire Ar key
Define a shared key for use in authentication.
-.Ar realm can be "" to for use with the
+.Ar realm
+can be "" to for use with the
.Ar delayed
-prptocol.
+protocol.
.Ar expire
is the date the token expires and should be formatted "yyy-mm-dd HH:MM".
You can use the keyword
diff --git a/if-options.c b/if-options.c
index c282adde..1ecf1cab 100644
--- a/if-options.c
+++ b/if-options.c
@@ -1902,7 +1902,10 @@ err_sla:
fp = strwhite(arg);
if (arg == NULL) {
ifo->auth.options |= DHCPCD_AUTH_SEND;
- ifo->auth.algorithm = AUTH_ALG_HMAC_MD5;
+ if (ifo->auth.protocol == AUTH_PROTO_TOKEN)
+ ifo->auth.protocol = AUTH_ALG_NONE;
+ else
+ ifo->auth.algorithm = AUTH_ALG_HMAC_MD5;
ifo->auth.rdm = AUTH_RDM_MONOTONIC;
break;
}