Modify

Opened 2 years ago

Last modified 2 years ago

#21655 new defect

usock doesn't support IPv6 link local addresses

Reported by: anonymous Owned by: developers
Priority: normal Milestone:
Component: packages Version: Trunk
Keywords: Cc:

Description

usock() doesn't support IPv6 link local addresses. The call to getaddrinfo in usock_inet passes in an addrinfo hints with ai_flags set to AI_ADDRCONFIG, which filters out IPv6 link local addresses. This prevents logd from logging to IPv6 link local hosts. Ideally, it should try the current method first and the the method without AI_ADDRCONFIG set.

From usocket.c:

Code highlighting:

89         struct addrinfo hints = {
90                 .ai_family = (type & USOCK_IPV6ONLY) ? AF_INET6 :
91                         (type & USOCK_IPV4ONLY) ? AF_INET : AF_UNSPEC,
92                 .ai_socktype = socktype,
93                 .ai_flags = AI_ADDRCONFIG
94                         | ((type & USOCK_SERVER) ? AI_PASSIVE : 0)
95                         | ((type & USOCK_NUMERIC) ? AI_NUMERICHOST : 0),
96         };
97         int sock = -1;  }}}

Attachments (0)

Change History (3)

comment:1 Changed 2 years ago by lexknuther

Here's the relevant man page section for getaddrinfo.

If hints.ai_flags includes the AI_ADDRCONFIG flag, then IPv4 addresses are returned in the list pointed to by result only if the local system has at least one IPv4 address configured, and IPv6 addresses are
       only returned if the local system has at least one IPv6 address configured

comment:2 Changed 2 years ago by lexknuther

Here's a StackOverflow post that might explain the problem: http://stackoverflow.com/questions/14443686/getaddrinfo-for-ipv6-link-local

Last edited 2 years ago by lexknuther (previous) (diff)

comment:3 Changed 2 years ago by lexknuther

After some more analysis, it seems that uci doesn't accept IPv6 addresses for the log_ip parameter in /etc/config/system. The cause is in /etc/init.d/log in the validate_log_section. It's checking for IPv4 addresses only with 'log_ip:ip_addr'.

Last edited 2 years ago by lexknuther (previous) (diff)

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.