Changeset View
Changeset View
Standalone View
Standalone View
sbin/ifconfig/ifconfig.8
Show All 30 Lines | |||||
.Dd May 29, 2016 | .Dd May 29, 2016 | ||||
.Dt IFCONFIG 8 | .Dt IFCONFIG 8 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm ifconfig | .Nm ifconfig | ||||
.Nd configure network interface parameters | .Nd configure network interface parameters | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.Nm | .Nm | ||||
.Op Fl f Ar type:format Ns Op Ar ,type:format | .Op Fl f Ar type:format Ns Op Ar ,type:format | ||||
.Op Fl L | .Op Fl L | ||||
marcel: I fear I just fell victim to the over-engineering trap, but I have a comment -- treat it as… | |||||
Not Done Inline ActionsThis would likely make sense, and avoid using up all of the letters of the alphabet on one-off flags This would also solve the problem that, in this patch, the -s and -c flags only apply to 'inet', and not inet6 or anything else. I will have to look at how the options parsing framework works, as currently you register a flag like -c from inside af_inet.c so I am not sure how to make a -f apply to multiple modules, nor deal with the fact that some modes apply to multiple address families. I might play with this a bit more then allanjude: This would likely make sense, and avoid using up all of the letters of the alphabet on one-off… | |||||
.Op Fl k | .Op Fl k | ||||
.Op Fl m | .Op Fl m | ||||
.Op Fl n | .Op Fl n | ||||
.Ar interface | .Ar interface | ||||
.Op Cm create | .Op Cm create | ||||
.Ar address_family | .Ar address_family | ||||
.Oo | .Oo | ||||
.Ar address | .Ar address | ||||
▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | |||||
See the | See the | ||||
.Sx EXAMPLES | .Sx EXAMPLES | ||||
section for more information. | section for more information. | ||||
The | The | ||||
.Sy types | .Sy types | ||||
and their associated | and their associated | ||||
.Sy format | .Sy format | ||||
strings are: | strings are: | ||||
.Bl -tag -width scope | .Bl -tag -width ether | ||||
.It Sy addr | .It Sy addr | ||||
Adjust the display of inet and inet6 addresses | Adjust the display of inet and inet6 addresses | ||||
.Bl -tag -width default | .Bl -tag -width default | ||||
.It Sy default | .It Sy default | ||||
Display inet and inet6 addresses in the default format, | Display inet and inet6 addresses in the default format, | ||||
.Sy numeric | .Sy numeric | ||||
.It Sy fqdn | .It Sy fqdn | ||||
Display inet and inet6 addresses as fully qualified domain names | Display inet and inet6 addresses as fully qualified domain names | ||||
.Pq FQDN | .Pq FQDN | ||||
.It Sy full | |||||
Display inet6 addresses without suppressing zeroes. | |||||
Only applicable to inet6 | |||||
.It Sy host | .It Sy host | ||||
Display inet and inet6 addresses as unqualified hostnames | Display inet and inet6 addresses as unqualified hostnames | ||||
.It Sy numeric | .It Sy numeric | ||||
Display inet and inet6 addresses in numeric format | Display inet and inet6 addresses in numeric format | ||||
.El | .El | ||||
.It Sy ether | .It Sy ether | ||||
Adjust the display of link-level ethernet (MAC) addresses | Adjust the display of link-level ethernet (MAC) addresses | ||||
.Bl -tag -width default | .Bl -tag -width default | ||||
Show All 33 Lines | |||||
::1/128 or fe80::1%lo0/64 | ::1/128 or fe80::1%lo0/64 | ||||
.It Sy default | .It Sy default | ||||
Display subnet prefix in the default format | Display subnet prefix in the default format | ||||
.Sy numeric | .Sy numeric | ||||
.It Sy numeric | .It Sy numeric | ||||
Display subnet prefix in integer format, for example: | Display subnet prefix in integer format, for example: | ||||
.br | .br | ||||
prefixlen 64 | prefixlen 64 | ||||
.El | |||||
.It Sy scope | |||||
Controls the display of the interface scope as part of the address. | |||||
Only applicable to inet6 addresses. | |||||
.Bl -tag -width default | |||||
.It Sy default | |||||
The interface scope and scopeid are included in the address, for example: | |||||
.br | |||||
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x7 | |||||
.It Sy none | |||||
The interface scope and scopeid are not displayed, for example: | |||||
.br | |||||
inet6 fe80::1 prefixlen 64 | |||||
.El | .El | ||||
.El | .El | ||||
.Pp | .Pp | ||||
The following parameters may be set with | The following parameters may be set with | ||||
.Nm : | .Nm : | ||||
.Bl -tag -width indent | .Bl -tag -width indent | ||||
.It Cm add | .It Cm add | ||||
Another name for the | Another name for the | ||||
▲ Show 20 Lines • Show All 2,698 Lines • Show Last 20 Lines |
I fear I just fell victim to the over-engineering trap, but I have a comment -- treat it as inspirational more than a request for change:
I can't shake of this feeling that -c and -s are specific to IP (v4 and/or v6) and that different protocol families may want to change the output in some form or shape as well and that this therefore may create a flurry of "one-off" options. What if we have a single option, say -f, for format that takes an argument. The argument is a protocol-specific specifier for how to print addresses. For IP this could be "-f cidr" and "-f dotted" as the moral equivalent of "-c" and "-s" (resp).
Since we print addresses for different protocols at the same time, maybe even add a protocol prefix, like inet:dotted and allow -f to give us a list of specifiers so that we can tweak the output of multiple families at the same time.
Examples of different ways one may want to print an address:
ethernet: use dashes instead of colons between bytes, print as 3 groups of hex numbers with dots.
IPv6: don't suffix the scope, don't abbreviate, resolve to hostname, hex only, etc
IPv4: resolve to hostname, hex only, CIDR, dotted, etc
Again: this probably goes too far, but I feel is more future-proof.