summaryrefslogtreecommitdiffstats
path: root/src/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-12-28 00:02:26 +0000
committerRoy Marples <roy@marples.name>2020-12-28 00:02:26 +0000
commit2bd74fa2acd005e68b6fcdd6d3132ab034440515 (patch)
tree6890c84bbadf199c2c22c4777a6ac5fc28988f83 /src/dhcpcd.c
parent486ad9aaf6cb3621761a4f9cdf2316ad228f9b45 (diff)
downloaddhcpcd-2bd74fa2acd005e68b6fcdd6d3132ab034440515.tar.xz
DHCP: Split hardware address randomisation out of anonymous option
A 3rd party might want to control the randomisation.
Diffstat (limited to 'src/dhcpcd.c')
-rw-r--r--src/dhcpcd.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/dhcpcd.c b/src/dhcpcd.c
index 13480b48..97417e25 100644
--- a/src/dhcpcd.c
+++ b/src/dhcpcd.c
@@ -734,9 +734,7 @@ dhcpcd_handlecarrier(struct interface *ifp, int carrier, unsigned int flags)
* Preserve the network state until we either disconnect
* or re-connect.
*/
- if (!(ifp->options->options & DHCPCD_ANONYMOUS) &&
- if_roaming(ifp))
- {
+ if (!ifp->options->randomise_hwaddr && if_roaming(ifp)) {
dhcpcd_nocarrier_roaming(ifp);
return;
}
@@ -745,7 +743,7 @@ dhcpcd_handlecarrier(struct interface *ifp, int carrier, unsigned int flags)
script_runreason(ifp, "NOCARRIER");
dhcpcd_drop(ifp, 0);
- if (ifp->options->options & DHCPCD_ANONYMOUS) {
+ if (ifp->options->randomise_hwaddr) {
bool is_up = ifp->flags & IFF_UP;
if (is_up)
@@ -971,22 +969,22 @@ dhcpcd_prestartinterface(void *arg)
{
struct interface *ifp = arg;
struct dhcpcd_ctx *ctx = ifp->ctx;
- bool anondown;
+ bool randmac_down;
if (ifp->carrier <= LINK_DOWN &&
- ifp->options->options & DHCPCD_ANONYMOUS &&
+ ifp->options->randomise_hwaddr &&
ifp->flags & IFF_UP)
{
if_down(ifp);
- anondown = true;
+ randmac_down = true;
} else
- anondown = false;
+ randmac_down = false;
if ((!(ctx->options & DHCPCD_MASTER) ||
- ifp->options->options & DHCPCD_IF_UP || anondown) &&
+ ifp->options->options & DHCPCD_IF_UP || randmac_down) &&
!(ifp->flags & IFF_UP))
{
- if (ifp->options->options & DHCPCD_ANONYMOUS &&
+ if (ifp->options->randomise_hwaddr &&
if_randomisemac(ifp) == -1)
logerr(__func__);
if (if_up(ifp) == -1)