[CRIU] [PATCHv2] remote: Fix incorrect port option

Dmitry Safonov 0x7f454c46 at gmail.com
Mon Jan 29 18:26:04 MSK 2018


2018-01-28 21:10 GMT+00:00 Radostin Stoyanov <rstoyanov1 at gmail.com>:
> The `port` option for image-cache and image-proxy is converted from
>  unsigned short integer to network byte order twice.
> - 1st when the argument is provided from the user (in crtools.c)
> - 2nd when the value is provided set to `sin_port` (in img-remote.c)
> Unfortunately the 2nd conversion reverses the 1st one.
>
> Example:
>
>         #include <stdio.h>
>         #include <arpa/inet.h>
>         #include <stdlib.h>
>
>         int main()
>         {
>             printf("%d\n", htons(atoi("1234"))); /* 53764 */
>             printf("%d\n", htons(htons(atoi("1234")))); /* 1234 */
>             return 0;
>         }
>
> Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>

I wonder if we should also fix setup_opts_from_req()..

-- 
             Dmitry


More information about the CRIU mailing list