Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1482665 > unrolled thread

[PATCH v3] net: ip, diag -- Add diag interface for raw sockets

Started byCyrill Gorcunov <gorcunov@gmail.com>
First post2016-09-13 19:30 +0200
Last post2016-09-16 21:40 +0200
Articles 2 on this page of 22 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-13 19:30 +0200
    Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Greg <gvrose8192@gmail.com> - 2016-09-13 20:40 +0200
      Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets "Rustad, Mark D" <mark.d.rustad@intel.com> - 2016-09-13 22:20 +0200
        Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Greg <gvrose8192@gmail.com> - 2016-09-13 22:40 +0200
    Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets David Ahern <dsa@cumulusnetworks.com> - 2016-09-15 22:00 +0200
      Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets David Ahern <dsa@cumulusnetworks.com> - 2016-09-15 22:30 +0200
        Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets David Ahern <dsa@cumulusnetworks.com> - 2016-09-15 22:40 +0200
        Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Eric Dumazet <eric.dumazet@gmail.com> - 2016-09-15 22:40 +0200
      Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-15 22:30 +0200
        Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets David Ahern <dsa@cumulusnetworks.com> - 2016-09-15 23:00 +0200
          Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-15 23:10 +0200
            Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Eric Dumazet <eric.dumazet@gmail.com> - 2016-09-16 00:50 +0200
              Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets David Ahern <dsa@cumulusnetworks.com> - 2016-09-16 01:50 +0200
                Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-16 09:10 +0200
                  Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-16 21:10 +0200
                    Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-16 21:40 +0200
                      Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets David Ahern <dsa@cumulusnetworks.com> - 2016-09-16 21:50 +0200
                        Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-16 22:00 +0200
                          Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets David Ahern <dsa@cumulusnetworks.com> - 2016-09-16 22:00 +0200
                            Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-16 22:10 +0200
                              Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets Cyrill Gorcunov <gorcunov@gmail.com> - 2016-09-20 23:20 +0200
                    Re: [PATCH v3] net: ip, diag -- Add diag interface for raw sockets David Ahern <dsa@cumulusnetworks.com> - 2016-09-16 21:40 +0200

Page 2 of 2 — ← Prev page 1 [2]


#1487643

FromCyrill Gorcunov <gorcunov@gmail.com>
Date2016-09-20 23:20 +0200
Message-ID<sjACl-8nb-19@gated-at.bofh.it>
In reply to#1485304
On Fri, Sep 16, 2016 at 11:07:22PM +0300, Cyrill Gorcunov wrote:
> > It may well be a ss bug / problem. As I mentioned I am always seeing 255 for the protocol which
> 
> It is rather not addressed in ss. I mean, look, when we send out a diag packet
> the kernel look ups for a handler, which for raw protocol we register as
> 
> static const struct inet_diag_handler raw_diag_handler = {
> 	.dump= raw_diag_dump,
> 	.dump_one= raw_diag_dump_one,
> 	.idiag_get_info= raw_diag_get_info,
> 	.idiag_type= IPPROTO_RAW,
> 	.idiag_info_size= 0,
> #ifdef CONFIG_INET_DIAG_DESTROY
> 	.destroy= raw_diag_destroy,
> #endif
> };
> 
> so if we patch ss and ask for IPPROTO_ICMP in netlink packet the
> kernel simply won't find anything. Thus I think we need (well, I need)
> to extend the patch and register IPPROTO_ICMP diag type, then
> extend ss as well. (If only I didn't miss somethin obvious).
> 
> > is odd since ss does a dump and takes the matches and invokes the kill.
> > Thanks for taking the time to do the kill piece.

Sorry for delay in reply (I got flu unexpectedly). You know, it eventually
become uneasy to implement handling for sock-raw because they are special.
They described as ipproto-ip in net/ipv4/af_inet.c, so it matches any
protocol specified with the socket call. In turn inet-diag module handled
predefined protocols only, in particular IPPROTO_RAW in our case. Thus
to fecth some real protocol sitting in raw sockets hashes we need some
kind of additional argument passed in the request. I guess we may
use @idiag_ext field for this sake? Or require @idiag_ext to have
INET_DIAG_PROTOCOL bit set and then fetch real protocol from
additional attribute? Sounds ok?

	Cyrill

[toc] | [prev] | [next] | [standalone]


#1485269

FromDavid Ahern <dsa@cumulusnetworks.com>
Date2016-09-16 21:40 +0200
Message-ID<si79n-BS-5@gated-at.bofh.it>
In reply to#1485248
On 9/16/16 1:00 PM, Cyrill Gorcunov wrote:
> I created veth pair and bound raw socket into it.
> 
> [root@pcs7 iproute2]# misc/ss -A raw
> State      Recv-Q Send-Q                                Local Address:Port                                                 Peer Address:Port                
> ESTAB      0      0                                         127.0.0.1:ipproto-255                                            127.0.0.10:ipproto-9090         
> UNCONN     0      0                                        127.0.0.10:ipproto-255                                                     *:*                    
> UNCONN     0      0                                                :::ipv6-icmp                                                      :::*                    
> UNCONN     0      0                                                :::ipv6-icmp                                                      :::*                    
> ESTAB      0      0                                               ::1:ipproto-255                                                   ::1:ipproto-9091         
> UNCONN     0      0                                           ::1%vm1:ipproto-255                                                    :::*                    
> [root@pcs7 iproute2]# 
> 
> [root@pcs7 iproute2]# misc/ss -aKw 'dev == vm1'
> State      Recv-Q Send-Q                                Local Address:Port                                                 Peer Address:Port                
> UNCONN     0      0                                           ::1%vm1:ipproto-255                                                    :::*                    
> 
> [root@pcs7 iproute2]# misc/ss -A raw
> State      Recv-Q Send-Q                                Local Address:Port                                                 Peer Address:Port                
> ESTAB      0      0                                         127.0.0.1:ipproto-255                                            127.0.0.10:ipproto-9090         
> UNCONN     0      0                                        127.0.0.10:ipproto-255                                                     *:*                    
> UNCONN     0      0                                                :::ipv6-icmp                                                      :::*                    
> UNCONN     0      0                                                :::ipv6-icmp                                                      :::*                    
> ESTAB      0      0                                               ::1:ipproto-255                                                   ::1:ipproto-9091         
> 
> so it get zapped out. Is there some other way to test it?
> 

I'm guessing you passed IPPROTO_RAW (255) as the protocol to socket(). If you pass something else (IPPROTO_ICMP for example) it won't work.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web