[LTP] [PATCH v4 19/31] tst_netdevice: Add two more helper macros
Petr Vorel
pvorel@suse.cz
Thu Sep 3 18:43:57 CEST 2026
Hi Cyril,
> +++ b/include/tst_netdevice.h
> @@ -61,6 +61,26 @@ int tst_netdev_remove_address_inet(const char *file, const int lineno,
> #define NETDEV_REMOVE_ADDRESS_INET(ifname, address) \
> tst_netdev_remove_address_inet(__FILE__, __LINE__, 1, (ifname), \
> (address))
> +/*
> + * Change the link-layer (MAC) address of an existing network device. Most
> + * drivers require the device to be administratively down for this to
> + * succeed.
> + */
> +int tst_netdev_set_hwaddr(const char *file, const int lineno, int strict,
> + const char *ifname, const void *addr, size_t addrlen);
> +#define NETDEV_SET_HWADDR(ifname, addr, addrlen) \
> + tst_netdev_set_hwaddr(__FILE__, __LINE__, 1, (ifname), (addr), \
> + (addrlen))
> +
> +/*
> + * Enslave ifname to the master_ifname device, e.g. add it as a bridge or bond
> + * port. Pass NULL as master_ifname to release the device from its current
> + * master.
> + */
nit: It'd be nice to have this as kerneldoc, but that can be done after patchset
is merged.
Anyway, I know that most of other functions does not even have a documentation.
Martin did doc/old/C-Test-Network-API.asciidoc which was deleted without a
replacement during transition to the new docs in 4a72aada87 ("New LTP
documentation")
The code itself LGTM. Both functions are similar, but due different parameter
types (void vs char) there is no point trying to unify them.
Kind regards,
Petr
More information about the ltp
mailing list