[PATCH 1/9] wpa_supplicant: use getaddrinfo() when UDP ctrl interface

Janusz Dziedzic janusz.dziedzic
Sun Oct 4 22:14:04 PDT 2015


On 4 October 2015 at 18:00, Jouni Malinen <j at w1.fi> wrote:
> On Wed, Sep 23, 2015 at 02:04:11PM +0200, Janusz Dziedzic wrote:
>> Kill not needed #ifdefs and make code common
>> for IPv4/IPv6 when registering UDP server for
>> ctrl interface.
>
>> @@ -560,20 +556,6 @@ static void wpa_supplicant_global_ctrl_iface_receive(int sock, void *eloop_ctx,
>>               return;
>>       }
>>
>> -#ifndef CONFIG_CTRL_IFACE_UDP_REMOTE
>> -     if (from.sin_addr.s_addr != htonl((127 << 24) | 1)) {
>> -             /*
>> -              * The OS networking stack is expected to drop this kind of
>> -              * frames since the socket is bound to only localhost address.
>> -              * Just in case, drop the frame if it is coming from any other
>> -              * address.
>> -              */
>> -             wpa_printf(MSG_DEBUG, "CTRL: Drop packet from unexpected "
>> -                        "source %s", inet_ntoa(from.sin_addr));
>> -             return;
>> -     }
>> -#endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
>> -
>
> Huh? Why was this removed? Same applies for patch 2/9
> wpa_supplicant_ctrl_iface_receive() changes.
>
> This can be a critical check on some platforms to protect the interface
> from remote connection and as such, it must not be removed without very
> good justification and certainly not in a patch that claims to be just
> cleanup..
>

I am not sure this is really required while we will listen only on
127.0.0.1 and will not accept remote connection. I suspect IP stack
already will care about it.
Even without this check I wasn't able to connect to such UDP port from
remote machine - seems IP stack handle this correctly (hints.ai_flags
= AI_PASSIVE works fine).

udp        0      0 127.0.0.1:9877          0.0.0.0:*
udp        0      0 127.0.0.1:9878          0.0.0.0:*

I suspect this check wasn't needed, or I miss something?

BR
Janusz



More information about the Hostap mailing list