Re: [PATCH] usbredirserver: add support for bind specific address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




At 2017-11-17 16:06:13, "Marc-André Lureau" <marcandre.lureau@xxxxxxxxxx> wrote:
>Hi
>
>----- Original Message -----
>> From: Chen Hanxiao <chenhanxiao@xxxxxxxxx>
>> 
>> We bind our listen address to in6addr_any, which may be
>> unsecure with multi network cards that belong to
>> internal or external networks.
>> 
>> This patch introduces option -4 and -6 to bind a specific
>> address.
>> 
...
>> -        exit(1);
>> +        if (bind(server_fd, (struct sockaddr *)&serveraddr4,
>> +                 sizeof(serveraddr4))) {
>> +            fprintf(stderr, "Error binding port %d: %s\n", port,
>> strerror(errno));
>
>Why not perror() like the rest of the code?

Sure, will fix in v2.

Regards,
- Chen

>
>> +            exit(1);
>> +        }
>> +    } else {
>> +        memset(&serveraddr, 0, sizeof(serveraddr));
>> +        serveraddr.sin6_family = AF_INET6;
>> +        serveraddr.sin6_port   = htons(port);
>> +        if (ipv6_addr) {
>> +            if ((inet_pton(AF_INET6, ipv4_addr, &serveraddr.sin6_addr)) !=
>> 1) {
>> +                perror("Error convert ipv4 address");
>> +                exit(1);
>> +            }
>> +        } else {
>> +            serveraddr.sin6_addr   = in6addr_any;
>> +        }
>> +
>> +        if (bind(server_fd, (struct sockaddr *)&serveraddr,
>> +                 sizeof(serveraddr))) {
>> +            fprintf(stderr, "Error binding port %d: %s\n",
>> +                    port, strerror(errno));
>
>same here
>
>> +            exit(1);
>> +        }
>>      }
>>  
>>      if (listen(server_fd, 1)) {
>> --
>> 2.13.6
>
>Look good otherwise,
>
>> 
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
>> https://lists.freedesktop.org/mailman/listinfo/spice-devel
>> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]