On 2016-11-27 13:00, Christian Schwarz wrote:
Hi all,
jls(8) is generating inconsistent output regarding IPv4 & IPv6
addresses.
Below are some examples documenting the behavior.
- For readability, I use `--libxo json` and pipe the output through
jq.
However, the information is the same as without `--libxo`
- These are all jails spawned by ezjail(8), hence spawned using the
old rc.conf syntax.
Can anyone reproduce these inconsistencies on their system?
Possibly with the native jail.conf / other jail managers.
Furthermore: I would be willing to try fixing the behavior.
However, do you think changing/correcting the output at this point
will
break existing software?
Most of the output doesn't need fixing, just understanding why it is the
way it is. The no-option jls is the original format used when jails had
much less information in them, and has been kept in that format for just
the reason you mentioned (not breaking existing software). Later on,
jails got a little more complex, and the "-v" was added to show the
(then) complete jail information. I consider both of these options
(well, the one option and the one lack of options) to be back-compatible
behavior at this point.
For the modern jails with the more dynamic parameters you should either
specify the parameters you want on the command line, or use "all". The
"-n" doesn't matter if you're using libxo which needs to print names
anyway. This explains the difference in your examples, except the
weirdness of the -v output having both IPv4 and IPv6 addresses listed as
"ipv4_addrs". I guess that follows the non-libxo -v convention of
printing both kinds of addresses together, though the label "ipv4_addrs"
is incorrect and probably should be "ip_addrs" or the like. That may be
worth fixing, or may have the existing software problem at this point; I
don't know what software uses the libxo output, but I imagine something
does.
I can only give a similar "maybe" for your comment of the multiple
addresses being better presented as JSON arrays. That does seem
cleaner, as long as it doesn't break much.
On the point ip ip4 and ip6 being inconsistent: yes they are. I'm going
to have to look in to why they're showing as "disabled" when then should
be "new". This is a problem independent of whether the output is from
libxo.
- Jamie
jls --libxo json
IPv6 addresses are not printed at all
...
{
...
"ipv4": "10.123.234.6",
...
}
...
jls --libxo json -n all
Both address types are printed, but not particularly nicely (should
use JSON arrays)
Additionally, the ip(4|6) variables seem inconsistent.
...
{
"ip4": "disable",
"ip6": "disable",
...
"ip4.addr": "10.123.234.6",
"ip4.saddrsel": true,
"ip6.addr": "2001:ffff:ffff::b,2001:ffff:ffff::d",
"ip6.saddrsel": true
}
...
jls --libxo json -v
Attention: no -n specified
Prints IPv6-Addresses as IPv4 addresses.
...
{
...
"ipv4_addrs": [
"10.123.234.6",
"2001:ffff:ffff::b",
"2001:ffff:ffff::d"
]
}
...
_______________________________________________
freebsd-jail@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "freebsd-jail-unsubscr...@freebsd.org"