[vlc-devel] [PATCH] upnp: add basic network interface discovery for iOS and tvOS

Felix Paul Kühne fkuehne at videolan.org
Mon Jul 6 11:59:36 CEST 2020


Hello,

Thanks for the review.

> On 6. Jul 2020, at 11:37, Alexandre Janniaux <ajanni at videolabs.io> wrote:
> 
>> +    unsigned int flags = anInterface->ifa_flags;
>> +    if( (flags & IFF_UP) && (flags & IFF_RUNNING) && !(flags & IFF_LOOPBACK) && !(flags & IFF_POINTOPOINT) ) {
> 
> Do you also need IFF_MULTICAST?

I see why you ask, but this is not a requirement.

> 
>> +        return true;
>> +    }
>> +    return false;
>> +}
>> +
>> +inline char *getPreferedAdapter()
>> +{
>> +    struct ifaddrs *listOfInterfaces = NULL;
>> +    struct ifaddrs *anInterface = NULL;
> 
> Could be left uninitialized in order to warn if it gets
> used without calling the correct function/assignation in
> future refactoring.

OK.

> 
>> +    int ret = getifaddrs(&listOfInterfaces);
>> +    char *adapterName = NULL;
>> +
>> +    if (ret == 0) {
> 
> Could be changed into
> 
>    if (ret != 0)
>        return NULL
> 
> Especially to avoid calling freeifaddr on NULL or
> uninitialized memory, and remove an indentation level.

Euh, sure.

The patch targets the 3.0 branch indeed but also needs to be applied to master for 4.0.

Best regards,

Felix



More information about the vlc-devel mailing list