On Tuesday 25 September 2012 14:06, Florian Fainelli wrote:
> From: Felix Fietkau <n...@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 <n...@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);
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to