FreeBSD Bugzilla – Attachment 177607 Details for
Bug 215008
[patch] jls(8) separate lists for IPv4 and IPv6 in verbose libxo output
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[Patch 1/2] Separate libxo lists for IPv4 and IPv6 addresses in verbose mode.
01_jls_ip_addr_leaf_lists.patch (text/plain), 4.04 KB, created by
Christian Schwarz
on 2016-12-02 16:25:23 UTC
(
hide
)
Description:
[Patch 1/2] Separate libxo lists for IPv4 and IPv6 addresses in verbose mode.
Filename:
MIME Type:
Creator:
Christian Schwarz
Created:
2016-12-02 16:25:23 UTC
Size:
4.04 KB
patch
obsolete
>commit 9016286455d8b21c1b91a601b720280692b25638 >Author: Christian Schwarz <me@cschwarz.com> >Date: Fri Dec 2 17:33:59 2016 +0100 > > Separate libxo leaf-lists for IPv4 and IPv6 addresses. > > 'jls -v --libxo text' does not change its output with this commit. > > 'jls -v --libxo json' and 'jls -v --libxo xml' however do: > > { { > "__version": "1", "__version": "1", > "jail-information": { "jail-information": { > "jail": [ "jail": [ > { { > "jid": 166, "jid": 166, > "hostname": "foo.com", "hostname": "foo.com", > "path": "/var/jail/foo", "path": "/var/jail/foo", > "name": "foo", "name": "foo", > "state": "ACTIVE", "state": "ACTIVE", > "cpusetid": 2, "cpusetid": 2, > "ipv4_addrs": [ "ipv4_addrs": [ > "10.1.1.1", "10.1.1.1", > "10.1.1.2", "10.1.1.2", > "10.1.1.3", | "10.1.1.3" > > ], > > "ipv6_addrs": [ > "fe80::1000:1", "fe80::1000:1", > "fe80::1000:2" "fe80::1000:2" > ] ] > } } > ] ] > } } > } } > >diff --git a/usr.sbin/jls/jls.8 b/usr.sbin/jls/jls.8 >index fff1051..3910346 100644 >--- a/usr.sbin/jls/jls.8 >+++ b/usr.sbin/jls/jls.8 >@@ -104,7 +104,11 @@ Extend the standard display with a multiple-line summary per jail, > containing the following parameters: > jail identifier (jid), hostname (host.hostname), path (path), > jail name (name), jail state (dying), cpuset ID (cpuset), >-IP address(es) (ip4.addr and ip6.addr). >+IP address(es) (ip4.addr and ip6.addr, one address per line). >+.Pp >+For encoding-styled >+.Sy --libxo >+output, IPv4 and IPv6 addresses emitted as separate lists. > .It Fl j Ar jail > The jid or name of the > .Ar jail >diff --git a/usr.sbin/jls/jls.c b/usr.sbin/jls/jls.c >index 9dd7641..85a7d4b 100644 >--- a/usr.sbin/jls/jls.c >+++ b/usr.sbin/jls/jls.c >@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); > #define JP_USER 0x01000000 > #define JP_OPT 0x02000000 > >-#define JLS_XO_VERSION "1" >+#define JLS_XO_VERSION "2" > > #define PRINT_DEFAULT 0x01 > #define PRINT_HEADER 0x02 >@@ -401,29 +401,36 @@ print_jail(int pflags, int jflags) > n = 6; > #ifdef INET > if (ip4_ok && !strcmp(params[n].jp_name, "ip4.addr")) { >+ xo_open_list("ipv4_addrs"); > count = params[n].jp_valuelen / sizeof(struct in_addr); >- for (ai = 0; ai < count; ai++) >+ for (ai = 0; ai < count; ai++) { > if (inet_ntop(AF_INET, > &((struct in_addr *)params[n].jp_value)[ai], >- ipbuf, sizeof(ipbuf)) == NULL) >+ ipbuf, sizeof(ipbuf)) == NULL) { > xo_err(1, "inet_ntop"); >- else { >- xo_emit("{P: }{l:ipv4_addrs}{P:\n}", ipbuf); >+ } else { >+ xo_emit("{P: }{ql:ipv4_addr}{P:\n}", ipbuf); > } >+ } >+ xo_close_list("ipv4_addrs"); > n++; > } > #endif > #ifdef INET6 > if (ip6_ok && !strcmp(params[n].jp_name, "ip6.addr")) { > count = params[n].jp_valuelen / sizeof(struct in6_addr); >- for (ai = 0; ai < count; ai++) >+ xo_open_list("ipv6_addrs"); >+ for (ai = 0; ai < count; ai++) { > if (inet_ntop(AF_INET6, > &((struct in6_addr *) > params[n].jp_value)[ai], >- ipbuf, sizeof(ipbuf)) == NULL) >+ ipbuf, sizeof(ipbuf)) == NULL) { > xo_err(1, "inet_ntop"); >- else >- xo_emit("{P: }{l:ipv6_addrs}{P:\n}", ipbuf); >+ } else { >+ xo_emit("{P: }{ql:ipv6_addr}{P:\n}", ipbuf); >+ } >+ } >+ xo_close_list("ipv6_addrs"); > n++; > } > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 215008
: 177607 |
177639