A 3rd party might want to control the randomisation.
* 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;
}
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)
{
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)
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd November 25, 2020
+.Dd December 27, 2020
.Dt DHCPCD.CONF 5
.Os
.Sh NAME
.Xr fnmatch 3 .
.It Ic anonymous
Enables Anonymity Profiles for DHCP, RFC 7844.
-This implementation forces a hardware address randomisaton when
-the interface link is down and that ClientID's are only LL.
-Any DUID is ignored.
+Any DUID is ignored and ClientID is set to LL only.
All non essential options are then masked at this point,
but they could be unmasked by explicitly requesting the option
.Sy after
.Nm dhcpcd
will not try and reboot an old lease, it will go straight into
DISCOVER/SOLICIT.
+.It Ic randomise_hwaddr
+Forces a hardware address randomisation when the interface is brought up
+or when the carrier is lost.
+This is generally used in tandem with the anonymous option.
.It Ic arping Ar address Op address
.Nm dhcpcd
will arping each address in order before attempting DHCP.
{"ipv4only", no_argument, NULL, '4'},
{"ipv6only", no_argument, NULL, '6'},
{"anonymous", no_argument, NULL, O_ANONYMOUS},
+ {"randomise_hwaddr",no_argument, NULL, O_RANDOMISE_HWADDR},
{"arping", required_argument, NULL, O_ARPING},
{"destination", required_argument, NULL, O_DESTINATION},
{"fallback", required_argument, NULL, O_FALLBACK},
del_option_mask(ifo->nomask6, D6_OPTION_INF_MAX_RT);
#endif
+ break;
+ case O_RANDOMISE_HWADDR:
+ ifo->randomise_hwaddr = true;
break;
#ifdef INET
case O_ARPING:
#define O_MSUSERCLASS O_BASE + 49
#define O_CONFIGURE O_BASE + 50
#define O_NOCONFIGURE O_BASE + 51
+#define O_RANDOMISE_HWADDR O_BASE + 52
extern const struct option cf_options[];
uint32_t timeout;
uint32_t reboot;
unsigned long long options;
+ bool randomise_hwaddr;
struct in_addr req_addr;
struct in_addr req_mask;