diff mbox

[net-next,v2] nlmon: use standard rtnetlink link api for add/del devices

Message ID 1561418.Jq9drZzso6@lx-vladimir
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Vladimir Kondratiev July 16, 2013, 3:59 p.m. UTC
On Tuesday, July 16, 2013 04:49:53 PM Daniel Borkmann wrote:
> On 07/16/2013 04:08 PM, Vladimir Kondratiev wrote:
> > Jiri Pirko <jiri <at> resnulli.us> writes:
> >
> >> It is not nice when netdev is created right after module load and with
> >> some implicit name. So rather change nlmon to use standard rtnl link API.
> >
> > Could you please elaborate a bit - how to capture netlink skb's after your
> > patch? Before, it was netdev that may be used with tcpdump. Now, there is
> > no such netdev. How to create it?
> 
> modprobe nlmon
> ip link add type nlmon
> ip link set nlmon0 up
> 
> tcpdump -i nlmon0 ....
> 
> ip link set nlmon0 down
> ip link del dev nlmon0
> rmmod nlmon

Thanks a lot! I guess it is worth to have this mentioned somewhere.
It will save lots of questions. For example, in Kconfig:

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Daniel Borkmann July 16, 2013, 4:10 p.m. UTC | #1
On 07/16/2013 05:59 PM, Vladimir Kondratiev wrote:
> On Tuesday, July 16, 2013 04:49:53 PM Daniel Borkmann wrote:
>> On 07/16/2013 04:08 PM, Vladimir Kondratiev wrote:
>>> Jiri Pirko <jiri <at> resnulli.us> writes:
>>>
>>>> It is not nice when netdev is created right after module load and with
>>>> some implicit name. So rather change nlmon to use standard rtnl link API.
>>>
>>> Could you please elaborate a bit - how to capture netlink skb's after your
>>> patch? Before, it was netdev that may be used with tcpdump. Now, there is
>>> no such netdev. How to create it?
>>
>> modprobe nlmon
>> ip link add type nlmon
>> ip link set nlmon0 up
>>
>> tcpdump -i nlmon0 ....
>>
>> ip link set nlmon0 down
>> ip link del dev nlmon0
>> rmmod nlmon
>
> Thanks a lot! I guess it is worth to have this mentioned somewhere.
> It will save lots of questions. For example, in Kconfig:

Ok, I don't have a strong opinion on the below patch, I'm fine either way.

But, given that for such devices it is *common* to use the standard rtnl
link API (Jiri is right that this is a better/cleaner approach), I'm not
sure if this needs to be documented then ...

> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index b45b240..13acea2 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -247,8 +247,18 @@ config NLMON
>            purpose of this is to analyze netlink messages with packet sockets.
>            Thus applications like tcpdump will be able to see local netlink
>            messages if they tap into the netlink device, record pcaps for further
> -         diagnostics, etc. This is mostly intended for developers or support
> -         to debug netlink issues. If unsure, say N.
> +         diagnostics, etc. Typical flow is:
> +
> +           modprobe nlmon
> +           ip link add type nlmon
> +           ip link set nlmon0 up
> +           tcpdump -i nlmon0 ....
> +           ip link set nlmon0 down
> +           ip link del dev nlmon0
> +           rmmod nlmon
> +
> +         This is mostly intended for developers or support to debug netlink
> +         issues. If unsure, say N.
>
>   endif # NET_CORE
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Pirko July 16, 2013, 4:41 p.m. UTC | #2
Tue, Jul 16, 2013 at 06:10:03PM CEST, dborkman@redhat.com wrote:
>On 07/16/2013 05:59 PM, Vladimir Kondratiev wrote:
>>On Tuesday, July 16, 2013 04:49:53 PM Daniel Borkmann wrote:
>>>On 07/16/2013 04:08 PM, Vladimir Kondratiev wrote:
>>>>Jiri Pirko <jiri <at> resnulli.us> writes:
>>>>
>>>>>It is not nice when netdev is created right after module load and with
>>>>>some implicit name. So rather change nlmon to use standard rtnl link API.
>>>>
>>>>Could you please elaborate a bit - how to capture netlink skb's after your
>>>>patch? Before, it was netdev that may be used with tcpdump. Now, there is
>>>>no such netdev. How to create it?
>>>
>>>modprobe nlmon
>>>ip link add type nlmon
>>>ip link set nlmon0 up
>>>
>>>tcpdump -i nlmon0 ....
>>>
>>>ip link set nlmon0 down
>>>ip link del dev nlmon0
>>>rmmod nlmon
>>
>>Thanks a lot! I guess it is worth to have this mentioned somewhere.
>>It will save lots of questions. For example, in Kconfig:
>
>Ok, I don't have a strong opinion on the below patch, I'm fine either way.
>
>But, given that for such devices it is *common* to use the standard rtnl
>link API (Jiri is right that this is a better/cleaner approach), I'm not
>sure if this needs to be documented then ...

I believe that this does not need any further documentation. RTNL (ip
link add ..) is a standard api to add devices...


>
>>diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
>>index b45b240..13acea2 100644
>>--- a/drivers/net/Kconfig
>>+++ b/drivers/net/Kconfig
>>@@ -247,8 +247,18 @@ config NLMON
>>           purpose of this is to analyze netlink messages with packet sockets.
>>           Thus applications like tcpdump will be able to see local netlink
>>           messages if they tap into the netlink device, record pcaps for further
>>-         diagnostics, etc. This is mostly intended for developers or support
>>-         to debug netlink issues. If unsure, say N.
>>+         diagnostics, etc. Typical flow is:
>>+
>>+           modprobe nlmon
>>+           ip link add type nlmon
>>+           ip link set nlmon0 up
>>+           tcpdump -i nlmon0 ....
>>+           ip link set nlmon0 down
>>+           ip link del dev nlmon0
>>+           rmmod nlmon
>>+
>>+         This is mostly intended for developers or support to debug netlink
>>+         issues. If unsure, say N.
>>
>>  endif # NET_CORE
>>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index b45b240..13acea2 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -247,8 +247,18 @@  config NLMON
          purpose of this is to analyze netlink messages with packet sockets.
          Thus applications like tcpdump will be able to see local netlink
          messages if they tap into the netlink device, record pcaps for further
-         diagnostics, etc. This is mostly intended for developers or support
-         to debug netlink issues. If unsure, say N.
+         diagnostics, etc. Typical flow is:
+
+           modprobe nlmon
+           ip link add type nlmon
+           ip link set nlmon0 up
+           tcpdump -i nlmon0 ....
+           ip link set nlmon0 down
+           ip link del dev nlmon0
+           rmmod nlmon
+
+         This is mostly intended for developers or support to debug netlink
+         issues. If unsure, say N.
 
 endif # NET_CORE