[Devel] [RFC patch crash 0/2] namespace support for net command

Dave Anderson anderson at redhat.com
Wed Dec 3 08:02:29 PST 2014



----- Original Message -----
> Dear Dave,
> I would like to ask you to take a look and comment this patch set.
> 
> I would like to add namespace support to net command.
> Currently crash already have ipcs and mount commands that supports namespaces,
> however it still had no command to look at list network devices and IP addresses,
> related to non-default network namespace. In OpenVZ we have separate network
> namespaces for each containers, and we would like to have ability to quickly
> get list of netdevices and IPs in container related to crashed process.
> Also I believe it should be useful for LXC/Docker containers too.
> 
> Mount and ipcs have used -n key to point at according namespace,
> however this key was in use in net command. With some doubts I've decided to move
> existing -n command to -N, and use -n key as namespace pointer, as in other commands.
> Please let me know if it is unacceptable or you have some better ideas.

Typically I prefer to keep traditional option letters in place, but
in this case, I agree with you.

> 
> Vasily Averin (2):
>   net -n option renamed to -N
>   namespace support for net command
> 
>  defs.h    |  1 +
>  help.c    |  9 ++++++---
>  net.c     | 48 ++++++++++++++++++++++++++++++++++--------------
>  symbols.c |  2 ++
>  4 files changed, 43 insertions(+), 17 deletions(-)

I guess this version hasn't been built/tested:

  $ make warn
  ... [ cut ] ...
  cc -c -g -DX86_64 -DLZO -DSNAPPY -DGDB_7_6  net.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector -Wformat-security
  net.c: In function 'show_net_devices_v3':
  net.c:541:135: error: 'nsproxy_p' undeclared (first use in this function)
  net.c:541:135: note: each undeclared identifier is reported only once for each function it appears in
  net.c:543:135: error: 'net_ns_p' undeclared (first use in this function)
  make[4]: *** [net.o] Error 1
  make[3]: *** [gdb] Error 2
  make[2]: *** [rebuild] Error 2
  make[1]: *** [gdb_merge] Error 2
  make: *** [warn] Error 2
  $

But I have no problem with the concept, it's definitely a good idea.

A couple other points/suggestions:

(1) When adding items to the offset_table[], please append them to 
    the end of the list.  This maintains compatibility with extension
    modules that were built with an older version of defs.h.
(2) While the location of the new offset_table[] entry is not adjacent
    to nsproxy_ipc_ns, it make sense to display them together in 
    dump_offset_table() as you have done.  And thanks for remembering 
    to put it there, as most patch-posters forget to do so.
(3) The help page is confusing.  Since the existing [pid | task] options 
    are unique and unrelated to -n, it should be something like:

 net [-a] [[-s | -S [-xd]] [-R ref] [pid | taskp] [-n pid | taskp]] [-N addr]
   
Thanks,
  Dave




More information about the Devel mailing list