> Dear all,
> 
> When l use ss command to display unix domain socket, the ss shows as below, 
> the local address port and peer address port may overflow which looks like 
> equal to the socket fd inode .
> 
> /**********
> # ss –apx
> Netid  State      Recv-Q Send-Q     Local Address:Port                        
>                                               Peer Address:Port
> u_str  ESTAB      0      0         /var/run/libvirt/libvirt-sock -1351067523  
>                                                   * -1351073721           
> users:(("libvirtd",pid=2295,fd=39))
> u_str  ESTAB      0      0         /var/run/libvirt/libvirt-sock -1351121518  
>                                                   * -1351223988           
> users:(("libvirtd",pid=2295,fd=21))
> u_str  ESTAB      0      0         /var/run/libvirt/libvirt-sock -1351245849  
>                                                   * -1351128250           
> users:(("libvirtd",pid=2295,fd=40))
> u_str  ESTAB      0      0         /var/run/libvirt/libvirt-sock -1351042552  
>                                                   * -1351050742           
> users:(("libvirtd",pid=2295,fd=51))
> 
> #ll /proc/2295/fd/51
> lrwx------ 1 root root 64 Oct 10 10:34 51 -> socket:[2943924744]
> 
> **********/
> 
> When I read the iproute source code., I find that the ‘lport’ and 
> ‘rport’ was defined as type ‘int’ in ‘struct sockstat’, which I think 
> should be ‘unsigned int’, also the ‘fd’ in ‘struct user_ent’ should 
> be.  And,
> 
> when printing the port, In function ‘static const char 
> *resolve_service(int port)’ uses “%u” to print tcp port, however, in 
> function ‘static void unix_stats_print(struct sockstat *s, struct 
> filter *f)’ uses “%d” to
> 
> print port when showing unix info, what is the problem I think.
> 
> Can you tell me if there are some reasons by using the type ‘int’ to define 
> the port? Or is it a bug? Can I use “%u” to print the port when showing the 
> unix socket info?
> 
> /**********
> static void unix_stats_print(struct sockstat *s, struct filter *f) {
>          char port_name[30] = {};
> 
>          sock_state_print(s);
> 
>          sock_addr_print(s->name ?: "*", " ",
>                             int_to_str(s->lport, port_name), NULL);
>          sock_addr_print(s->peer_name ?: "*", " ",
>                             int_to_str(s->rport, port_name), NULL);
> 
>          proc_ctx_print(s);
> }
> **********/
> 
> 
> Best regards,
> SangXu

Please  report problems to netdev@vger.kernel.org.
Yes, it looks like a bug.

Attachment: 0001-ss-Use-u-to-print-port-when-show-unix-socket.patch
Description: 0001-ss-Use-u-to-print-port-when-show-unix-socket.patch

Reply via email to