Comment 3 for bug 2009186

Revision history for this message
Nobuto Murata (nobuto) wrote :

Confirmed with strace too.

$ snap list maas maas-cli
Name Version Rev Tracking Publisher Notes
maas 3.2.7-12037-g.c688dd446 26274 3.2/stable canonical✓ -
maas-cli 0.6.8 79 latest/stable canonical✓ -

$ maas list
admin http://192.168.12.19:80/MAAS/api/2.0/ <KEY>

^^^ port 80 is set

$ snap run --strace='-e network' maas admin version read -d

(...)

socket(AF_INET6, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_IP) = 3
bind(3, {sa_family=AF_INET6, sin6_port=htons(0), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_scope_id=0}, 28) = 0
/usr/bin/strace: Process 365068 attached
[pid 365068] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=365068, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 6
setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = 0
connect(6, {sa_family=AF_INET, sin_port=htons(5240), sin_addr=inet_addr("192.168.12.19")}, 16) = 0
sendto(6, "GET /MAAS/api/2.0/version/ HTTP/"..., 423, 0, NULL, 0) = 423
recvfrom(6, "HTTP/1.1 200 OK\r\nServer: nginx/1"..., 8192, 0, NULL, NULL) = 573
getsockname(6, {sa_family=AF_INET, sin_port=htons(33808), sin_addr=inet_addr("192.168.12.19")}, [16]) = 0
getpeername(6, {sa_family=AF_INET, sin_port=htons(5240), sin_addr=inet_addr("192.168.12.19")}, [16]) = 0
200 OK

        Connection: keep-alive
    Content-Length: 285
  Content-Location: http://192.168.12.19:5240/MAAS/api/2.0/version/
      Content-Type: application/json; charset=utf-8
              Date: Sat, 04 Mar 2023 00:03:22 GMT
            Server: nginx/1.18.0 (Ubuntu)
            Status: 200
              Vary: Authorization
   X-Frame-Options: SAMEORIGIN
   X-Maas-Api-Hash: 7b01cae71568bea2f250e94d09454b13888f04fb

Success.

^^^ initial connect() is to sin_port=htons(5240) instead of 80.