Commit 1e08aedf authored by Antonin Décimo's avatar Antonin Décimo Committed by Juliusz Chroboczek

Change no_hmac_verify to hmac-verify.

It wasn't consistent with the naming of other option. The option is
phrased positively to match the Information Model (babel-mac-verify).

Thanks to Julien Muchembled for finding a bug in a previous version of
this commit.
parent c7ad3875
...@@ -469,10 +469,10 @@ otherwise. ...@@ -469,10 +469,10 @@ otherwise.
Enable HMAC security on this interface, and use the key Enable HMAC security on this interface, and use the key
.IR id . .IR id .
.TP .TP
.BR no_hmac_verify " {" true | false } .BR hmac-verify " {" true | false }
Do not check packet signatures, accept unsigned or incorrectly signed packets Check packet signatures, reject unsigned or incorrectly signed
even if one or more keys are configured on the interface. The default is packets. The default is
.BR false . .BR true .
.TP .TP
.SS Filtering rules .SS Filtering rules
A filtering rule is defined by a single line with the following format: A filtering rule is defined by a single line with the following format:
......
...@@ -610,12 +610,6 @@ parse_anonymous_ifconf(int c, gnc_t gnc, void *closure, ...@@ -610,12 +610,6 @@ parse_anonymous_ifconf(int c, gnc_t gnc, void *closure,
if(c < -1) if(c < -1)
goto error; goto error;
if_conf->unicast = v; if_conf->unicast = v;
} else if(strcmp(token, "no_hmac_verify") == 0) {
int v;
c = getbool(c, &v, gnc, closure);
if(c < -1)
goto error;
if_conf->no_hmac_verify = v;
} else if(strcmp(token, "link-quality") == 0) { } else if(strcmp(token, "link-quality") == 0) {
int v; int v;
c = getbool(c, &v, gnc, closure); c = getbool(c, &v, gnc, closure);
...@@ -700,6 +694,12 @@ parse_anonymous_ifconf(int c, gnc_t gnc, void *closure, ...@@ -700,6 +694,12 @@ parse_anonymous_ifconf(int c, gnc_t gnc, void *closure,
} }
if_conf->key = key; if_conf->key = key;
free(key_id); free(key_id);
} else if(strcmp(token, "hmac-verify") == 0) {
int v;
c = getbool(c, &v, gnc, closure);
if(c < -1)
goto error;
if_conf->hmac_verify = v;
} else { } else {
goto error; goto error;
} }
...@@ -892,7 +892,7 @@ merge_ifconf(struct interface_conf *dest, ...@@ -892,7 +892,7 @@ merge_ifconf(struct interface_conf *dest,
MERGE(lq); MERGE(lq);
MERGE(faraway); MERGE(faraway);
MERGE(unicast); MERGE(unicast);
MERGE(no_hmac_verify); MERGE(hmac_verify);
MERGE(channel); MERGE(channel);
MERGE(enable_timestamps); MERGE(enable_timestamps);
MERGE(rfc6126); MERGE(rfc6126);
......
...@@ -398,8 +398,11 @@ interface_updown(struct interface *ifp, int up) ...@@ -398,8 +398,11 @@ interface_updown(struct interface *ifp, int up)
if(IF_CONF(ifp, unicast) == CONFIG_YES) if(IF_CONF(ifp, unicast) == CONFIG_YES)
ifp->flags |= IF_UNICAST; ifp->flags |= IF_UNICAST;
if(IF_CONF(ifp, no_hmac_verify) == CONFIG_YES) if(IF_CONF(ifp, hmac_verify) == CONFIG_YES ||
ifp->flags |= IF_NO_HMAC_VERIFY; IF_CONF(ifp, hmac_verify) == CONFIG_DEFAULT)
ifp->flags |= IF_HMAC_VERIFY;
else if(IF_CONF(ifp, hmac_verify) == CONFIG_NO)
ifp->flags &= ~IF_HMAC_VERIFY;
if(IF_CONF(ifp, hello_interval) > 0) if(IF_CONF(ifp, hello_interval) > 0)
ifp->hello_interval = IF_CONF(ifp, hello_interval); ifp->hello_interval = IF_CONF(ifp, hello_interval);
else if(type == IF_TYPE_WIRELESS) else if(type == IF_TYPE_WIRELESS)
......
...@@ -55,7 +55,7 @@ struct interface_conf { ...@@ -55,7 +55,7 @@ struct interface_conf {
char unicast; char unicast;
char enable_timestamps; char enable_timestamps;
char rfc6126; char rfc6126;
char no_hmac_verify; char hmac_verify;
int channel; int channel;
unsigned int rtt_decay; unsigned int rtt_decay;
unsigned int rtt_min; unsigned int rtt_min;
...@@ -85,8 +85,8 @@ struct interface_conf { ...@@ -85,8 +85,8 @@ struct interface_conf {
#define IF_TIMESTAMPS (1 << 6) #define IF_TIMESTAMPS (1 << 6)
/* Remain compatible with RFC 6126. */ /* Remain compatible with RFC 6126. */
#define IF_RFC6126 (1 << 7) #define IF_RFC6126 (1 << 7)
/* Packets with a wrong or empty packet trailer are accepted */ /* Incoming packets are required to have a valid MAC hash. */
#define IF_NO_HMAC_VERIFY (1 << 8) #define IF_HMAC_VERIFY (1 << 8)
/* Use Babel over DTLS on this interface. */ /* Use Babel over DTLS on this interface. */
#define IF_DTLS (1 << 9) #define IF_DTLS (1 << 9)
......
...@@ -611,7 +611,7 @@ parse_packet(const unsigned char *from, struct interface *ifp, ...@@ -611,7 +611,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
if(ifp->key != NULL) { if(ifp->key != NULL) {
switch(check_hmac(packet, packetlen, bodylen, from, to, ifp)) { switch(check_hmac(packet, packetlen, bodylen, from, to, ifp)) {
case -1: /* no mac trailer */ case -1: /* no mac trailer */
if(ifp->flags & IF_NO_HMAC_VERIFY) if(!(ifp->flags & IF_HMAC_VERIFY))
break; break;
/* fallthrough */ /* fallthrough */
case 0: case 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment