[PATCH 08/19] udhcpc: refresh ifindex before sending data.
Denys Vlasenko
vda.linux at googlemail.com
Sat Sep 29 14:46:09 UTC 2012
On Tuesday 25 September 2012 14:06, Florian Fainelli wrote:
> From: Felix Fietkau <nbd at openwrt.org>
>
> When running on a bridge the ifindex may have changed (e.g. the member
> interface were added/removed or if the status of the bridge changed).
> Refresh the interface interface index before processing the next packet.
>
> Signed-off-by: Felix Fietkau <nbd at openwrt.org>
> ---
> networking/udhcp/dhcpc.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
> index f1013f4..7d38d9d 100644
> --- a/networking/udhcp/dhcpc.c
> +++ b/networking/udhcp/dhcpc.c
> @@ -1390,6 +1390,12 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
> /* silence "uninitialized!" warning */
> unsigned timestamp_before_wait = timestamp_before_wait;
>
> + /* When running on a bridge, the ifindex may have changed (e.g. if
> + * member interfaces were added/removed or if the status of the
> + * bridge changed).
> + * Workaround: refresh it here before processing the next packet */
> + udhcp_read_interface(client_config.interface, &client_config.ifindex, NULL, client_config.client_mac);
> +
> //bb_error_msg("sockfd:%d, listen_mode:%d", sockfd, listen_mode);
>
> /* Was opening raw or udp socket here
This is already done in current git:
networking/udhcp/dhcpc.c
/* If timeout dropped to zero, time to become active:
* resend discover/renew/whatever
*/
if (retval == 0) {
/* When running on a bridge, the ifindex may have changed
* (e.g. if member interfaces were added/removed
* or if the status of the bridge changed).
* Refresh ifindex and client_mac:
*/
if (udhcp_read_interface(client_config.interface,
&client_config.ifindex,
NULL,
client_config.client_mac)
) {
goto ret0; /* iface is gone? */
}
if (clientid_mac_ptr)
memcpy(clientid_mac_ptr, client_config.client_mac, 6);
More information about the busybox
mailing list