History log of /freebsd-current/sbin/ifconfig/ifconfig.c
Revision Date Author Comments
# a68e4f7a 31-May-2024 Gordon Tetlow <gordon@FreeBSD.org>

Migrate from printb to print_bits for locally defined bit fields.

Reviewed by: emaste
Event: Kitchener-Waterloo Hackathon 202406
Differential Revision: https://reviews.freebsd.org/D45441


# c3e94237 31-May-2024 Gordon Tetlow <gordon@FreeBSD.org>

Move print_bits to ifconfig.c and make available to other src files.

Reviewed by: emaste
Event: Kitchener-Waterloo Hackathon 202406
Differential Revision: https://reviews.freebsd.org/D45441


# 847ef59d 14-May-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

ifconfig: Add format shortcuts.

MFC after: 1 week
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D45166


# cd201c09 28-Nov-2023 Mike Karels <karels@FreeBSD.org>

ifconfig: add -D option to print driver name for interface

Add -D option to add the drivername and unit number to ifconfig output
for normal display, including -a. Use ifconfig_get_orig_name() from
libifconfig to fetch the name. Note that this is the original name
for many drivers, but not for some exceptions like epair (which appends
'a' or 'b' to the unit number). epair interface pairs both display
as "epair0", etc. Make -v imply -D; might as well be fully verbose.

MFC after: 1 week
Reviewed by: zlei, kp
Differential Revision: https://reviews.freebsd.org/D42721


# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# 51e16cb8 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sbin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# eba230af 25-Sep-2023 John Baldwin <jhb@FreeBSD.org>

Purge more stray embedded $FreeBSD$ strings

These do not use __FBSDID but instead use bare char arrays.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41957


# 24a81a96 25-Aug-2023 Gleb Smirnoff <glebius@FreeBSD.org>

ifconfig: fix logical error in interface matching for '-l ether'

This affects only ifconfig(8) compiled WITHOUT_NETLINK_SUPPORT, which
is not the default.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D41584
Fixes: d1cd0344f7b7d81beda04c3cb8cfee99351c3eb8


# 21c32ceb 27-Jun-2023 Alfonso Gregory <gfunni234@gmail.com>

ifconfig: skip calling fnmatch once the result no longer matters

Because fnmatch has no side effects, we can safely avoid calling fnmatch
if the end result does not matter anyway (the compiler cannot see this,
so it calls fnmatch in the event it has side-effects).

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/747


# 08992b20 19-Jun-2023 John Baldwin <jhb@FreeBSD.org>

ifconfig: Avoid issues with trying to negate unsigned values.

The if_flags and if_cap fields hold a bitmask of flags. If a flag is
the MSB of the field, then the logic in setifflags and setifcap which
uses a < 0 check does the wrong thing (it tries to clear the flag
rather than setting it). Also, trying to use -<FOO> doesn't actually
work as the result is a nop. To fix, stop overloading setifcap and
setifflags and instead add new dedicated action functions clearifcap
and clearifflags for clearing a flag. The value passed in the
argument to the command is now always the raw flag.

This was reported by a GCC warning after raising WARNS:

sbin/ifconfig/ifconfig.c:2061:33: error: integer overflow in expression '-2147483648' of type 'int' results in '-2147483648' [-Werror=overflow]
2061 | DEF_CMD("-txtlsrtlmt", -IFCAP_TXTLS_RTLMT, setifcap),
| ^

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40608


# e77b2ea4 19-Jun-2023 Ed Maste <emaste@FreeBSD.org>

ifconfig: set boolean to true rather than incrementing

GCC warns about "increment of a boolean expression."

Reported by: amd64-gcc12 Cirrus-CI run
Sponsored by: The FreeBSD Foundation


# c344eff9 16-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

netlink: dump interface capabilities with other interface data.

This change exports interface capabilities using the standard
Netlink attribute type, bitset, and switches `ifconfig(8)` to use
it when displaying interface data.
Bitset comes in two representations. The first one is "compact",
where the bits are exported via two arrays - "mask" listing the
"valid" bits and "values, providing the values for those bits.
The second one is more verbose, listing each bit as a separate item,
with its name, id and value. The latter option is handy when submitting
update requests.

The support for setting capabilities will be added in the upcoming diffs.

Differential Revision: https://reviews.freebsd.org/D40331


# a3930cd4 14-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: use default (more rigid) WARNS level.

It helps catch more errors at compile time.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40536
MFC after: 2 weeks


# f414f37e 14-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: remove global 'ifr' usage from ifmedia.c & remove 'ifr'.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40535
MFC after: 2 weeks


# 7fa282e6 14-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: remove (most of) the usages of global 'struct ifreq ifr'.

It is hard to reason about the contents of 'ifr' at any given time
as nearly every function sets random fields or pointers in this
structure.
Use local on-stack clean 'struct ifreq' for each function instead.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40534
MFC after: 2 weeks


# 52ff8883 14-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: fix ifconfig crash when compiled w/WITHOUT_NETLINK.

Properly update the recently-introduced `ctx->ifname` when iterating
over interfaces.

Reported by: Gary Jennejohn <garyj@gmx.de>
MFC after: 2 weeks


# 3927d0fb 14-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: fix -Wunused warnings

MFC after: 2 weeks


# a6094f84 14-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: remove 'newaddr' global variable

Differential Revision: https://reviews.freebsd.org/D40441
MFC after: 2 weeks


# bbad5525 14-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: start ifconfig context from main()

Differential Revision: https://reviews.freebsd.org/D40440
MFC after: 2 weeks


# ea73ff97 13-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: remove global_args variable.

This variable was temporarily introduced in the beginning of the
code cleanup. Use on-stack instance in main() instead.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40439
MFC after: 2 weeks


# 85e0016a 13-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: remove global 'name' variable.

Consistenly use newly-added 'ctx->ifname' as the name of the current
target interface.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40438
MFC after: 2 weeks


# c6f0602f 13-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: pass if_ctx instead of socket to the tunnel handlers.

This is a pre-requisite for the global 'name' variable removal.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40432
MFC after: 2 weeks


# 4106282e 13-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: remove global 'printifname' variable.

This variable was used to print the created interface name in the
atexit(3) handler. The interface name was calculated in the
ifclonecreate() by matching old & new names.

This change alter the implementation the following way:
1) the function responsible for the interface creation (ifcreate_ioctl)
updates all necessary state internally. This removes the need for the
name manipulation hack in wlan_create().
2) As atexit(3) handler does not accept any parameters, explicitly store
the name to print in the ifname_to_print variable read by the atexit(3)
handler.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40431
MFC after: 2 weeks


# c6885dbd 13-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: eliminate global 'verbose' and 'printkey' variables

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40427
MFC after: 2 weeks


# 74b42611 13-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: add if_ctx argument to the generic and ifclone callbacks.

This is the continuation of the ifconfig cleanup work. This change is
a pre-requsite for the next changes removing some of the global variables.
It will also help in implementing functionality via Netlink instead of ioctl.
No functional changes intended.
* vxlan_cb() was removed as it contained no code
* ioctl_ifcreate() was renamed to ifcreate_ioctl() to follow the other
netlink/ioctl function naming. Netlink and ioctl provide _different_
interfaces and it's not possible to have a unified interface object
that can be filled by either netlink or ioctl implementations. With that
in mind, I'm leaning more to the function_<nl|ioctl> postfix pattern,
than doing ioctl_ or netlink_ prefix.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D40426
MFC after: 2 weeks


# 0c2beef7 01-Jun-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: fix warnings #2

Fix all -Wparameter-unused and cast alignment

Differential Revision: https://reviews.freebsd.org/D40303
MFC after: 2 weeks


# 6d204407 25-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: fix ifconfig IFX inet[6] ADDR -alias

Internally, inet and inet6 family handlers store state for
address addition and deletion separately, as, for example,
"ifconfig lo0 inet 127.0.0.2/32" triggers a) deletion of the
first interface address and b) addition of a new one.
The current logic behind handling "-alias" being the last argument
is to copy the address from "addition" state to the "deletion"
state. It is done by the generic ifconfig code, which explicitly
typecasts opaque handler state pointers to "struct ifreq", which
doesn't work in the Netlink case.

Fix this by introducing family-specific "af_copyaddr" handler,
which removes the peeking & typecasting logic from the generic code.

Reported by: otis
Tested by: otis


# 4bf44dd7 20-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: switch IPv4/IPv6 address manipulations to Netlink.

Differential Revision: https://reviews.freebsd.org/D40182


# 6e3a9d7f 23-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: introduce `ifconfig_context` to store current global state.

The structure consists of all current context - arguments,
open sockets, current family and so on.

Pass this structure as a first argument to most of the af_ menthods.
This allows to propagate and update shared data without using
global variables.

The diff is pretty large, but de-facto mechanical. All changes
except the structure setup in ifconfig[_netlink].c are one-line
mechanical changes.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40239
MFC after: 2 weeks


# 44cd85d4 23-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: cleanup warnings #1

Cleanup compiler warnings in preparation to set Wextra and remove WARNS?=2

Differential Revision: https://reviews.freebsd.org/D40238
MFC after: 2 weeks


# 7e49aa86 23-May-2023 Yan Ka Chiu <nyan@myuji.xyz>

ifconfig(8): Teach ifconfig to attach and run itself in a jail

Add -j <jail> flag to ifconfig to allow ifconfig to attach and run inside a
jail. This allow parent to configure network interfaces of its children
even if ifconfig is not available in child's tree (e.g. Linux Jails)

Reviewed by: emaste, khng, melifaro
Event: Kitchener-Waterloo Hackathon 202305
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40213


# 26056fa8 22-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

Revert "ifconfig: switch IPv4/IPv6 address manipulations to Netlink"

Revert the change as 2 non-expected issues have been reported.

This reverts commit 54418f79fd292e14abf121f87a3c790a17447971.


# 54418f79 20-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: switch IPv4/IPv6 address manipulations to Netlink

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D40182


# 63ad5ce7 20-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: simplify ifconfig() by factoring out ifa add/del logic

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40180


# 197bff38 20-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: split argument parsing

Simplify main() by factoring out argument parsing code.

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40179


# 2e6756b7 17-May-2023 Bjoern A. Zeeb <bz@FreeBSD.org>

ifconfig: improve trimming off interface number at end

When trying to auto-load a module, we trim the interface number off
the end. Currently we stop at the first digit. For interfaces which
have numbers in the driver name this does not work well.
In the current example ifconfig ath10k0 would load ath(4) instead of
ath10k(4). For module/interface names like rtw88[0] we never guess
correctly.
To improve for the case we can, start trimming off digits from the
end rather than the front.

Sponsored by: The FreeBSD Foundation
Reported by: thierry
MFC after: 20 days
Reviewed by: melifaro, thierry
Differential Revision: https://reviews.freebsd.org/D40137


# 4c91a5df 10-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: make interface and address listing use Netlink as transport

Differential Revision: https://reviews.freebsd.org/D40044


# d1cd0344 14-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: split printing functions into smaller per-type chunks.

This change is a prerequisite for netlink conversion.
No functional changes intended.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40033
MFC after: 2 weeks


# 444b9aa7 09-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: fix family selection after 982cd5ae8ef6


# a3cb80bc 09-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: fix interface selection after 982cd5ae8ef6.


# 982cd5ae 10-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: split argument parsing and actual execution logic

Reduce the amount of global variables by creating the dedicated
ifconfig_args structure and use it as a context-passing variable.
Simplify the code by moving all argument preparation code a
separate function.

Reviewed by: kp (previous version)
Differential Revision: https://reviews.freebsd.org/D39932
MFC after: 2 weeks


# 52059088 20-Jan-2023 Alan Somers <asomers@FreeBSD.org>

Revert "ifconfig: abort if loading a module fails other than for ENOENT"

This reverts commit 2c24ad3377a6f584e484656db8390e4eb7cfc119.

This change causes some commands to fail, for example when working with
renamed interfaces or when trying to list a nonexistent interface by
name.

PR: 269042
Reported by: dbaio, Michael Paepcke <bugs.fbsd@paepcke.de>
MFC with: 2c24ad3377a6f584e484656db8390e4eb7cfc119


# 2c24ad33 25-Dec-2022 Alan Somers <asomers@FreeBSD.org>

ifconfig: abort if loading a module fails other than for ENOENT

If "ifconfig create" tries to load a kernel module, and the module
exists but can't be loaded, fail the command with a useful error
message. This is helpful, for example, when trying to create a cloned
interface in a vnet jail. But ignore ENOENT, because sometimes ifconfig
can't correctly guess the name of the required kernel module.

MFC after: 2 weeks
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D37873


# ac606903 06-Sep-2022 Bjoern A. Zeeb <bz@FreeBSD.org>

ifconfig: print interface name on SIOCIFCREATE2 error

We have repeatedly gotten reports of unclassified SIOCIFCREATE2 errors
(usually "Device not configured"). This can happen if there is
configuration for interfaces in rc.conf which do not (yet) exist and
we try to configure. I can, e.g., provoke this by configuring wlan
interfaces with their physical interface not installed.
In order to cut support (guesswork) down print the name of the
interface to be configured with the error message.
Hopefully this will help us in the future to improve other configuration
or driver problems.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days


# c9a5c48a 27-May-2022 Konrad Sewiłło-Jopek <kjopek@gmail.com>

arp: Implement sticky ARP mode for interfaces.

Provide sticky ARP flag for network interface which marks it as the
"sticky" one similarly to what we have for bridges. Once interface is
marked sticky, any address resolved using the ARP will be saved as a
static one in the ARP table. Such functionality may be used to prevent
ARP spoofing or to decrease latencies in Ethernet networks.

The drawbacks include potential limitations in usage of ARP-based
load-balancers and high-availability solutions such as carp(4).

The implemented option is disabled by default, therefore should not
impact the default behaviour of the networking stack.

Sponsored by: Conclusive Engineering sp. z o.o.
Reviewed By: melifaro, pauamma_gundo.com
Differential Revision: https://reviews.freebsd.org/D35314
MFC after: 2 weeks


# d72ea9fb 14-Dec-2021 Konstantin Belousov <kib@FreeBSD.org>

ifconfig: Use SIOCGIFCAPNV if supported

Reviewed by: hselasky, jhb, kp (previous version)
Sponsored by: NVIDIA Networking
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D32551


# 277b9588 14-Dec-2021 Konstantin Belousov <kib@FreeBSD.org>

ifconfig: add rxtls and -rxtls commands

Reviewed by: hselasky, jhb, kp
Sponsored by: NVIDIA Networking
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D32551


# 6ca418e4 14-Dec-2021 Konstantin Belousov <kib@FreeBSD.org>

ifconfig: add setifcapnv()

which uses SIOCSIFCAPNV to set arbitrary string-named interface
capability.

Reviewed by: hselasky, jhb, kp
Sponsored by: NVIDIA Networking
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D32551


# 42d5cb09 14-Dec-2021 Konstantin Belousov <kib@FreeBSD.org>

ifconfig: add glue for specifying functions taking static string parameter

Reviewed by: hselasky, jhb, kp
Sponsored by: NVIDIA Networking
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D32551


# ad8f078f 09-Nov-2021 Hans Petter Selasky <hselasky@FreeBSD.org>

ifconfig(8): Don't set network interface capabilities when there is no change.

A quick grep through the kernel code shows network drivers compute the
changed bits of network capabilities after a SIOCSIFCAP IOCTL(2) by
using the bitwise exclusive or operation. When the set capabilities
are equal to the already read capabilities, no action will be taken.

Let ifconfig(8) predict this case and skip the SIOCSIFCAP IOCTL(2)
system call.

Discussed with: kib@ (revert change in case of issues)
MFC after: 1 week
Sponsored by: NVIDIA Networking


# d8237b95 28-Oct-2021 Mike Karels <karels@FreeBSD.org>

ifconfig: warn if setting an Internet address without mask

Add a postproc function for af_inet, and add interface flags as a
parameter. Check there if setting an address without a mask unless
the interface is loopback or point-to-point, where mask is not really
meaningful; warn if so. This will hopefully be an error in the future.

MFC after: 1 month
Reviewd by: bz
Differential Revision: https://reviews.freebsd.org/D32709


# 88832d59 27-Feb-2021 Ryan Moeller <freqlabs@FreeBSD.org>

sbin/ifconfig: Minor housekeeping

Coalesce adjacent lint ifdefs.
Fix spelling of nitems.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29022


# 8b222425 28-Feb-2021 Ryan Moeller <freqlabs@FreeBSD.org>

sbin/ifconfig: Use a global libifconfig handle

This should eventually replace the socket passed to the various
handlers. In the meantime, making it global avoids repeatedly opening
and closing handles.

Reported by: kp
Reviewed by: kp (earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28990


# 3f43ada9 28-Jan-2021 Gleb Smirnoff <glebius@FreeBSD.org>

Catch up with 6edfd179c86: mechanically rename IFCAP_NOMAP to IFCAP_MEXTPG.

Originally IFCAP_NOMAP meant that the mbuf has external storage pointer
that points to unmapped address. Then, this was extended to array of
such pointers. Then, such mbufs were augmented with header/trailer.
Basically, extended mbufs are extended, and set of features is subject
to change. The new name should be generic enough to avoid further
renaming.


# 94ac312a 19-Jan-2021 Alex Richardson <arichardson@FreeBSD.org>

ifconfig: fix UBSan signed shift error

Use 1u since UBSan complains about 1 << 31.


# 05952067 26-Nov-2020 Hans Petter Selasky <hselasky@FreeBSD.org>

Ensure consistent error messages from ifconfig(8).

If multiple threads are invoking "ifconfig XXX create" a race may occur
which can lead to two different error messages for the same error.

a) ifconfig: SIOCIFCREATE2: File exists
b) ifconfig: interface XXX already exists

This patch ensures ifconfig prints the same error code
for the same case.

Reviewed by: imp@ and kib@
Differential Revision: https://reviews.freebsd.org/D27380
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking


# 521eac97 28-Oct-2020 John Baldwin <jhb@FreeBSD.org>

Support hardware rate limiting (pacing) with TLS offload.

- Add a new send tag type for a send tag that supports both rate
limiting (packet pacing) and TLS offload (mostly similar to D22669
but adds a separate structure when allocating the new tag type).

- When allocating a send tag for TLS offload, check to see if the
connection already has a pacing rate. If so, allocate a tag that
supports both rate limiting and TLS offload rather than a plain TLS
offload tag.

- When setting an initial rate on an existing ifnet KTLS connection,
set the rate in the TCP control block inp and then reset the TLS
send tag (via ktls_output_eagain) to reallocate a TLS + ratelimit
send tag. This allocates the TLS send tag asynchronously from a
task queue, so the TLS rate limit tag alloc is always sleepable.

- When modifying a rate on a connection using KTLS, look for a TLS
send tag. If the send tag is only a plain TLS send tag, assume we
failed to allocate a TLS ratelimit tag (either during the
TCP_TXTLS_ENABLE socket option, or during the send tag reset
triggered by ktls_output_eagain) and ignore the new rate. If the
send tag is a ratelimit TLS send tag, change the rate on the TLS tag
and leave the inp tag alone.

- Lock the inp lock when setting sb_tls_info for a socket send buffer
so that the routines in tcp_ratelimit can safely dereference the
pointer without needing to grab the socket buffer lock.

- Add an IFCAP_TXTLS_RTLMT capability flag and associated
administrative controls in ifconfig(8). TLS rate limit tags are
only allocated if this capability is enabled. Note that TLS offload
(whether unlimited or rate limited) always requires IFCAP_TXTLS[46].

Reviewed by: gallatin, hselasky
Relnotes: yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26691


# 830edb45 17-Sep-2020 Navdeep Parhar <np@FreeBSD.org>

Add two new ifnet capabilities for hw checksumming and TSO for VXLAN traffic.

These are similar to the existing VLAN capabilities.

Reviewed by: kib@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25873


# cf518995 13-Aug-2020 Eugene Grosbein <eugen@FreeBSD.org>

ifconfig(8): plug memory leak after r361790 by me.

MFC after: 3 days


# 8e725dac 04-Jun-2020 Eugene Grosbein <eugen@FreeBSD.org>

ifconfig(8): make it possible to filter output by interface group.

Now options -g/-G allow to select/unselect interfaces by groups
in the "ifconfig -a" output just like already existing -d/-u.

Examples:

to exclude loopback from the list: ifconfig -a -G lo
to show vlan interfaces only: ifconfig -a -g vlan
to show tap interfaces that are up: ifconfig -aug tap

Arguments to -g/-G may be shell patterns and both may be specified.
Later options -g/-G override previous ones.

MFC after: 2 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D25029


# b2e60773 26-Aug-2019 John Baldwin <jhb@FreeBSD.org>

Add kernel-side support for in-kernel TLS.

KTLS adds support for in-kernel framing and encryption of Transport
Layer Security (1.0-1.2) data on TCP sockets. KTLS only supports
offload of TLS for transmitted data. Key negotation must still be
performed in userland. Once completed, transmit session keys for a
connection are provided to the kernel via a new TCP_TXTLS_ENABLE
socket option. All subsequent data transmitted on the socket is
placed into TLS frames and encrypted using the supplied keys.

Any data written to a KTLS-enabled socket via write(2), aio_write(2),
or sendfile(2) is assumed to be application data and is encoded in TLS
frames with an application data type. Individual records can be sent
with a custom type (e.g. handshake messages) via sendmsg(2) with a new
control message (TLS_SET_RECORD_TYPE) specifying the record type.

At present, rekeying is not supported though the in-kernel framework
should support rekeying.

KTLS makes use of the recently added unmapped mbufs to store TLS
frames in the socket buffer. Each TLS frame is described by a single
ext_pgs mbuf. The ext_pgs structure contains the header of the TLS
record (and trailer for encrypted records) as well as references to
the associated TLS session.

KTLS supports two primary methods of encrypting TLS frames: software
TLS and ifnet TLS.

Software TLS marks mbufs holding socket data as not ready via
M_NOTREADY similar to sendfile(2) when TLS framing information is
added to an unmapped mbuf in ktls_frame(). ktls_enqueue() is then
called to schedule TLS frames for encryption. In the case of
sendfile_iodone() calls ktls_enqueue() instead of pru_ready() leaving
the mbufs marked M_NOTREADY until encryption is completed. For other
writes (vn_sendfile when pages are available, write(2), etc.), the
PRUS_NOTREADY is set when invoking pru_send() along with invoking
ktls_enqueue().

A pool of worker threads (the "KTLS" kernel process) encrypts TLS
frames queued via ktls_enqueue(). Each TLS frame is temporarily
mapped using the direct map and passed to a software encryption
backend to perform the actual encryption.

(Note: The use of PHYS_TO_DMAP could be replaced with sf_bufs if
someone wished to make this work on architectures without a direct
map.)

KTLS supports pluggable software encryption backends. Internally,
Netflix uses proprietary pure-software backends. This commit includes
a simple backend in a new ktls_ocf.ko module that uses the kernel's
OpenCrypto framework to provide AES-GCM encryption of TLS frames. As
a result, software TLS is now a bit of a misnomer as it can make use
of hardware crypto accelerators.

Once software encryption has finished, the TLS frame mbufs are marked
ready via pru_ready(). At this point, the encrypted data appears as
regular payload to the TCP stack stored in unmapped mbufs.

ifnet TLS permits a NIC to offload the TLS encryption and TCP
segmentation. In this mode, a new send tag type (IF_SND_TAG_TYPE_TLS)
is allocated on the interface a socket is routed over and associated
with a TLS session. TLS records for a TLS session using ifnet TLS are
not marked M_NOTREADY but are passed down the stack unencrypted. The
ip_output_send() and ip6_output_send() helper functions that apply
send tags to outbound IP packets verify that the send tag of the TLS
record matches the outbound interface. If so, the packet is tagged
with the TLS send tag and sent to the interface. The NIC device
driver must recognize packets with the TLS send tag and schedule them
for TLS encryption and TCP segmentation. If the the outbound
interface does not match the interface in the TLS send tag, the packet
is dropped. In addition, a task is scheduled to refresh the TLS send
tag for the TLS session. If a new TLS send tag cannot be allocated,
the connection is dropped. If a new TLS send tag is allocated,
however, subsequent packets will be tagged with the correct TLS send
tag. (This latter case has been tested by configuring both ports of a
Chelsio T6 in a lagg and failing over from one port to another. As
the connections migrated to the new port, new TLS send tags were
allocated for the new port and connections resumed without being
dropped.)

ifnet TLS can be enabled and disabled on supported network interfaces
via new '[-]txtls[46]' options to ifconfig(8). ifnet TLS is supported
across both vlan devices and lagg interfaces using failover, lacp with
flowid enabled, or lacp with flowid enabled.

Applications may request the current KTLS mode of a connection via a
new TCP_TXTLS_MODE socket option. They can also use this socket
option to toggle between software and ifnet TLS modes.

In addition, a testing tool is available in tools/tools/switch_tls.
This is modeled on tcpdrop and uses similar syntax. However, instead
of dropping connections, -s is used to force KTLS connections to
switch to software TLS and -i is used to switch to ifnet TLS.

Various sysctls and counters are available under the kern.ipc.tls
sysctl node. The kern.ipc.tls.enable node must be set to true to
enable KTLS (it is off by default). The use of unmapped mbufs must
also be enabled via kern.ipc.mb_use_ext_pgs to enable KTLS.

KTLS is enabled via the KERN_TLS kernel option.

This patch is the culmination of years of work by several folks
including Scott Long and Randall Stewart for the original design and
implementation; Drew Gallatin for several optimizations including the
use of ext_pgs mbufs, the M_NOTREADY mechanism for TLS records
awaiting software encryption, and pluggable software crypto backends;
and John Baldwin for modifications to support hardware TLS offload.

Reviewed by: gallatin, hselasky, rrs
Obtained from: Netflix
Sponsored by: Netflix, Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D21277


# 82334850 28-Jun-2019 John Baldwin <jhb@FreeBSD.org>

Add an external mbuf buffer type that holds multiple unmapped pages.

Unmapped mbufs allow sendfile to carry multiple pages of data in a
single mbuf, without mapping those pages. It is a requirement for
Netflix's in-kernel TLS, and provides a 5-10% CPU savings on heavy web
serving workloads when used by sendfile, due to effectively
compressing socket buffers by an order of magnitude, and hence
reducing cache misses.

For this new external mbuf buffer type (EXT_PGS), the ext_buf pointer
now points to a struct mbuf_ext_pgs structure instead of a data
buffer. This structure contains an array of physical addresses (this
reduces cache misses compared to an earlier version that stored an
array of vm_page_t pointers). It also stores additional fields needed
for in-kernel TLS such as the TLS header and trailer data that are
currently unused. To more easily detect these mbufs, the M_NOMAP flag
is set in m_flags in addition to M_EXT.

Various functions like m_copydata() have been updated to safely access
packet contents (using uiomove_fromphys()), to make things like BPF
safe.

NIC drivers advertise support for unmapped mbufs on transmit via a new
IFCAP_NOMAP capability. This capability can be toggled via the new
'nomap' and '-nomap' ifconfig(8) commands. For NIC drivers that only
transmit packet contents via DMA and use bus_dma, adding the
capability to if_capabilities and if_capenable should be all that is
required.

If a NIC does not support unmapped mbufs, they are converted to a
chain of mapped mbufs (using sf_bufs to provide the mapping) in
ip_output or ip6_output. If an unmapped mbuf requires software
checksums, it is also converted to a chain of mapped mbufs before
computing the checksum.

Submitted by: gallatin (earlier version)
Reviewed by: gallatin, hselasky, rrs
Discussed with: ae, kp (firewalls)
Relnotes: yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20616


# 6a68e95d 10-May-2019 Kyle Evans <kevans@FreeBSD.org>

ifconfig(8): Add kld mappings for ipsec/enc

Additionally, providing mappings makes the comparison for already loaded
modules a little more strict. This should have been done at initial
introduction, but there was no real reason- however, it proves necessary for
enc which has a standard enc -> if_enc mapping but there also exists an
'enc' module that's actually CAM. The mapping lets us unambiguously
determine the correct module.

Discussed with: ae
MFC after: 4 days


# 56f76a10 08-May-2019 Kyle Evans <kevans@FreeBSD.org>

ifconfig(8): Partial revert of r347241

r347241 introduced an ifname <-> kld mapping table, mostly so tun/tap/vmnet
can autoload the correct module on use. It also inadvertently made bogus
some previously valid uses of sizeof().

Revert back to ifkind on the stack for simplicity sake. This reduces the
diff from the previous version of ifmaybeload for easiser auditing.


# 251a32b5 07-May-2019 Kyle Evans <kevans@FreeBSD.org>

tun/tap: merge and rename to `tuntap`

tun(4) and tap(4) share the same general management interface and have a lot
in common. Bugs exist in tap(4) that have been fixed in tun(4), and
vice-versa. Let's reduce the maintenance requirements by merging them
together and using flags to differentiate between the three interface types
(tun, tap, vmnet).

This fixes a couple of tap(4)/vmnet(4) issues right out of the gate:
- tap devices may no longer be destroyed while they're open [0]
- VIMAGE issues already addressed in tun by kp

[0] emaste had removed an easy-panic-button in r240938 due to devdrn
blocking. A naive glance over this leads me to believe that this isn't quite
complete -- destroy_devl will only block while executing d_* functions, but
doesn't block the device from being destroyed while a process has it open.
The latter is the intent of the condvar in tun, so this is "fixed" (for
certain definitions of the word -- it wasn't really broken in tap, it just
wasn't quite ideal).

ifconfig(8) also grew the ability to map an interface name to a kld, so
that `ifconfig {tun,tap}0` can continue to autoload the correct module, and
`ifconfig vmnet0 create` will now autoload the correct module. This is a
low overhead addition.

(MFC commentary)

This may get MFC'd if many bugs in tun(4)/tap(4) are discovered after this,
and how critical they are. Changes after this are likely easily MFC'd
without taking this merge, but the merge will be easier.

I have no plans to do this MFC as of now.

Reviewed by: bcr (manpages), tuexen (testing, syzkaller/packetdrill)
Input also from: melifaro
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D20044


# d309dcbc 25-Feb-2019 Alan Somers <asomers@FreeBSD.org>

ifconfig: eliminate trailing whitespace

Eliminate trailing whitespace on inet, inet6, and groups lines. I think the
"list txpower" command will still show some, but I'm not able to test that.

PR: 153731
Reported-by: Nikolay Denev <ndenev@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19004


# cd851487 25-Feb-2019 Alan Somers <asomers@FreeBSD.org>

Create a project branch for fuse(4) work.

The branch will be used for a new test suite, bug fixes, and various other
enhancements to fuse.

Sponsored by: The FreeBSD Foundation


# 80e72d52 28-Jan-2019 Patrick Kelsey <pkelsey@FreeBSD.org>

Speed up non-status operations applied to a single interface

When performing a non-status operation on a single interface, it is
not necessary for ifconfig to build a list of all addresses in the
system, sort them, then iterate through them looking for the entry for
the single interface of interest. Doing so becomes increasingly
expensive as the number of interfaces in the system grows (e.g., in a
system with 1000+ vlan(4) interfaces).

Reviewed by: ae, kp
MFC after: 1 week
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18919


# edcc0753 21-Oct-2018 Andrey V. Elsukov <ae@FreeBSD.org>

Fix grammar.

Reported by: yuripv
MFC after: 3 weeks


# 5c88595e 21-Oct-2018 Andrey V. Elsukov <ae@FreeBSD.org>

Do not allow use `create` keyword as hostname when ifconfig(8) is invoked
for already existing interface.

It appeared, that ifconfig(8) assumes `create` keyword as hostname and
tries to resolve it, when `ifconfig ifname create` invoked for already
existing interface. This can produce some unexpected results, when hostname
resolving has successfully happened. This patch adds check for such case.
When an interface is already exists, and create is only one argument,
return error message. But when there are some other arguments, just remove
create keyword from the arguments list.

Obtained from: Yandex LLC
MFC after: 3 weeks
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D17171


# 38225654 07-Aug-2018 Mark Johnston <markj@FreeBSD.org>

ifconfig: Fix use of _Noreturn.

The _Noreturn is a function-specifier (like inline) which must preceed
the declarator.

Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after: 1 week


# 7a07dfbc 17-May-2018 Andrey V. Elsukov <ae@FreeBSD.org>

Make the name of option that toggles IFCAP_HWRXTSTMP capability to
match the name of this capability. It was added recently and is not merged
to stable branch, so I hope it is not too late to change the name.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D15475


# 47528c67 16-Apr-2018 Andrew Gallatin <gallatin@FreeBSD.org>

Make lagg creation more fault tolerant

- Warn, don't exit, when SIOCSLAGGPORT returns an error.

When we exit with an error during lagg creation, a single
failed NIC (which no longer attaches) can prevent lagg
creation and other configuration, such as adding an IPv4
address, and thus leave a machine unreachable.

- Preserve non-EEXISTS errors for exit status from SIOCSLAGGPORT,
in case scripts are looking for it. Hopefully this can be
extended if other parts of ifconfig can allow a "soft" failure.

- Improve the warning message to mention what lagg and what
member are problematic.

Reviewed by: jtl, glebius
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D15046


# f1379734 27-Mar-2018 Konstantin Belousov <kib@FreeBSD.org>

Allow to specify PCP on packets not belonging to any VLAN.

According to 802.1Q-2014, VLAN tagged packets with VLAN id 0 should be
considered as untagged, and only PCP and DEI values from the VLAN tag
are meaningful. See for instance
https://www.cisco.com/c/en/us/td/docs/switches/connectedgrid/cg-switch-sw-master/software/configuration/guide/vlan0/b_vlan_0.html.

Make it possible to specify PCP value for outgoing packets on an
ethernet interface. When PCP is supplied, the tag is appended, VLAN
id set to 0, and PCP is filled by the supplied value. The code to do
VLAN tag encapsulation is refactored from the if_vlan.c and moved into
if_ethersubr.c.

Drivers might have issues with filtering VID 0 packets on
receive. This bug should be fixed for each driver.

Reviewed by: ae (previous version), hselasky, melifaro
Sponsored by: Mellanox Technologies
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D14702


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# 3cf8254f 07-Nov-2017 Konstantin Belousov <kib@FreeBSD.org>

Add a place for a driver to report rx timestamps in nanoseconds from
boot for the received packets.

The rcv_tstmp field overlaps the place of Ln header length indicators,
not used by received packets. The basic pkthdr rearrangement change
in sys/mbuf.h was provided by gallatin.

There are two accompanying M_ flags: M_TSTMP means that there is the
timestamp (and it was generated by hardware).

Another flag M_TSTMP_HPREC indicates that the timestamp is
high-precision. Practically M_TSTMP_HPREC means that hardware
provided additional precision comparing with the stamps when the flag
is not set. E.g., for ConnectX all packets are stamped by hardware
when PCIe transaction to write out the completion descriptor is
performed, but PTP packet are stamped on port. For Intel cards, when
PTP assist is enabled, only PTP packets are stamped in the limited
number of registers, so if Intel cards ever start support this
mechanism, they would always set M_TSTMP | M_TSTMP_HPREC if hardware
timestamp is present for the given packet.

Add IFCAP_HWRXTSTMP interface capability to indicate the support for
hardware rx timestamping, and ifconfig(8) command to toggle it.

Based on the patch by: gallatin
Reviewed by: gallatin (previous version), hselasky
Sponsored by: Mellanox Technologies
MFC after: 2 weeks (? mbuf KBI issue)
X-Differential revision: https://reviews.freebsd.org/D12638


# af717998 08-Aug-2017 Renato Botelho <garga@FreeBSD.org>

Add missing parenthesis on error message

Approved by: loos
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)


# f24faa98 03-May-2017 Alan Somers <asomers@FreeBSD.org>

Unbreak ifconfig for mlx4en(4) after r317755

ifconfig doesn't correctly infer mlx interfaces' module names, so it will
attempt to load the mlx(4) module even when not necessary.

Reported by: rstone
MFC after: 3 weeks
X-MFC-With: 317755
Sponsored by: Spectra Logic Corp


# 6223cc33 03-May-2017 Alan Somers <asomers@FreeBSD.org>

Various Coverity fixes in ifconfig(8)

* Exit early if kldload(2) fails (1011259). This is the only change that
affects ifconfig's behavior.
* Close memory and resource leaks (1305624, 1305205, 1007100)
* Mark usage() as _Noreturn (1305806, 1305750)
* Fix some dereference after null checks (1011474, 270774)

Reported by: Coverity
CID: 1305624, 1305205, 1007100, 1305806, 1305750, 1011474,
CID: 270774, 1011259
Reviewed by: cem
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10587


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# f3e7afe2 18-Jan-2017 Hans Petter Selasky <hselasky@FreeBSD.org>

Implement kernel support for hardware rate limited sockets.

- Add RATELIMIT kernel configuration keyword which must be set to
enable the new functionality.

- Add support for hardware driven, Receive Side Scaling, RSS aware, rate
limited sendqueues and expose the functionality through the already
established SO_MAX_PACING_RATE setsockopt(). The API support rates in
the range from 1 to 4Gbytes/s which are suitable for regular TCP and
UDP streams. The setsockopt(2) manual page has been updated.

- Add rate limit function callback API to "struct ifnet" which supports
the following operations: if_snd_tag_alloc(), if_snd_tag_modify(),
if_snd_tag_query() and if_snd_tag_free().

- Add support to ifconfig to view, set and clear the IFCAP_TXRTLMT
flag, which tells if a network driver supports rate limiting or not.

- This patch also adds support for rate limiting through VLAN and LAGG
intermediate network devices.

- How rate limiting works:

1) The userspace application calls setsockopt() after accepting or
making a new connection to set the rate which is then stored in the
socket structure in the kernel. Later on when packets are transmitted
a check is made in the transmit path for rate changes. A rate change
implies a non-blocking ifp->if_snd_tag_alloc() call will be made to the
destination network interface, which then sets up a custom sendqueue
with the given rate limitation parameter. A "struct m_snd_tag" pointer is
returned which serves as a "snd_tag" hint in the m_pkthdr for the
subsequently transmitted mbufs.

2) When the network driver sees the "m->m_pkthdr.snd_tag" different
from NULL, it will move the packets into a designated rate limited sendqueue
given by the snd_tag pointer. It is up to the individual drivers how the rate
limited traffic will be rate limited.

3) Route changes are detected by the NIC drivers in the ifp->if_transmit()
routine when the ifnet pointer in the incoming snd_tag mismatches the
one of the network interface. The network adapter frees the mbuf and
returns EAGAIN which causes the ip_output() to release and clear the send
tag. Upon next ip_output() a new "snd_tag" will be tried allocated.

4) When the PCB is detached the custom sendqueue will be released by a
non-blocking ifp->if_snd_tag_free() call to the currently bound network
interface.

Reviewed by: wblock (manpages), adrian, gallatin, scottl (network)
Differential Revision: https://reviews.freebsd.org/D3687
Sponsored by: Mellanox Technologies
MFC after: 3 months


# 776db16a 01-Jun-2016 Allan Jude <allanjude@FreeBSD.org>

Address feedback from hrs@ re: r301059 (ifconfig subnet mask)

- Use NI_MAXHOST to size buffers for getnameinfo()
- remove non-standard 'full' inet6 address printing
- remove 'no scope' option
- use strchr(3) to optimize replacing separator character in lladdrs

Reviewed by: gnn, jhb
Differential Revision: https://reviews.freebsd.org/D2856


# 7c2aa744 31-May-2016 Allan Jude <allanjude@FreeBSD.org>

ifconfig(8) now supports some output formatting options

specified by the -f flag or IFCONFIG_FORMAT environment variable, the user
can request that inet4 subnet masks be printed in CIDR or dotted-quad
notation, in addition to the traditional hex output.
inet6 prefixes can be printed in CIDR as well.

For more documentation see the ifconfig(8) man page.

PR: 169072
Requested by: seanc, marcel, brd, many others
Reviewed by: gnn, jhb (earlier version)
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D2856


# c8711749 15-May-2016 Don Lewis <truckman@FreeBSD.org>

Use strlcpy() instead of strncpy() when copying ifname to ensure
that it is NUL terminated. Additional NUL padding is not required
for short names.

Use sizeof(destination) in a few places instead of IFNAMSIZ.

Cast afp->af_ridreq and afp->af_addreq to make the intent of
the code more obvious.

Reported by: Coverity
CID: 1009628, 1009630, 1009631, 1009632, 1009633, 1009635, 1009638
CID: 1009639, 1009640, 1009641, 1009642, 1009643, 1009644, 1009645
CID: 1009646, 1009647, 1010049, 1010050, 1010051, 1010052, 1010053
CID: 1010054, 1011293, 1011294, 1011295, 1011296, 1011297, 1011298
CID: 1011299, 1305821, 1351720, 1351721
MFC after: 1 week


# 6fe2e176 20-Feb-2016 Kristof Provost <kp@FreeBSD.org>

ifconfig(8): can't use 'name' or 'description' when creating interface with auto numbering

If one does 'ifconfig tap create name blah', it will return error because the
'name' command doesn't properly populate the request sent to ioctl(...). The
'description' command has the same bug, and is also fixed with this patch.

If one does 'ifconfig tap create mtu 9000 name blah', it DOES work, but 'tap0'
(or other sequence number) is echoed, instead of the expected 'blah'. (assuming
the name change actually succeeded)

Submitted by: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D5341


# abd71050 27-Sep-2015 Enji Cooper <ngie@FreeBSD.org>

Replace N #defines with nitems to simplify ifconfig code slightly

MFC after: 1 week


# cc59771c 15-Sep-2015 Allan Jude <allanjude@FreeBSD.org>

Make ifconfig always exit with an error code if an important ioctl fails

PR: 203062
Arm Twisting by: Kristof Provost
Reviewed by: kp
Approved by: bapt (mentor)
MFC after: 2 weeks
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Sponsored by: vBSDCon
Differential Revision: https://reviews.freebsd.org/D3644


# 56d5e096 06-Apr-2015 Gleb Smirnoff <glebius@FreeBSD.org>

Stop including if_var.h from userland.

Sponsored by: Nginx, Inc.


# 07bf9879 13-Mar-2015 John Baldwin <jhb@FreeBSD.org>

Simplify string mangling in ifmaybeload().
- Use strlcpy() instead of strcpy().
- Use strlcat() instead of a strlcpy() with a magic number subtracted
from the length.
- Replace strncmp(..., strlen(foo) + 1) with strcmp(...).

Differential Revision: https://reviews.freebsd.org/D1814
Reviewed by: rpaulo
MFC after: 2 weeks


# 976e4945 02-Feb-2015 Vsevolod Stakhov <vsevolod@FreeBSD.org>

Revert the change of flowid output format. [1]

Reverse the sorting order of the interfaces addresses familise so it should be
the same as getifaddrs(3) order. [2]

Suggested by: hrs [1], bz [2]
Approved by: hrs, bapt


# 07a51db9 02-Feb-2015 Vsevolod Stakhov <vsevolod@FreeBSD.org>

Style(9) fixes.

Approved by: bapt, ae
X-MFC-With: r278080


# 35c73e51 02-Feb-2015 Vsevolod Stakhov <vsevolod@FreeBSD.org>

Reorganize the list of addresses associated with an interface and group them
based on the address family. This should help to recognize interfaces with
multiple AF (e.g. ipv4 and ipv6) with many aliases or additional addresses. The
order of addresses inside a single group is strictly preserved.

Improve the scope_id output for AF_INET6 families, as the
current approach uses hexadecimal string that is basically the ID of an
interface, whilst this information is already depicted by getnameinfo(3) call.
Therefore, now ifconfig just prints the scope of address as it is defined in
2.4 of RFC 2373.

PR: 197270
Approved by: bapt
MFC after: 2 weeks


# 4f7bf7a8 02-Oct-2014 Hiroki Sato <hrs@FreeBSD.org>

Revert r272390.

Pointed out by: glebius


# 394c813d 01-Oct-2014 Hiroki Sato <hrs@FreeBSD.org>

Add IFCAP_HWSTATS.


# f732123e 16-Aug-2014 Alexander V. Chernikov <melifaro@FreeBSD.org>

Add support for reading i2c SFP/SFP+ data from NIC driver and
presenting most interesting fields via ifconfig -v.
This version supports Intel ixgbe driver only.

Tested on: Cisco,Intel,Mellanox,ModuleTech,Molex transceivers
MFC after: 2 weeks


# 33640c4a 12-Aug-2014 Glen Barber <gjb@FreeBSD.org>

Fix a typo in a comment: s/interprete/interpret/

Submitted by: Sam Fourman Jr.
MFC after: 3 days
Sponsored by: The FreeBSD Foundation


# 2c284d93 13-Mar-2014 Gleb Smirnoff <glebius@FreeBSD.org>

Remove IPX support.

IPX was a network transport protocol in Novell's NetWare network operating
system from late 80s and then 90s. The NetWare itself switched to TCP/IP
as default transport in 1998. Later, in this century the Novell Open
Enterprise Server became successor of Novell NetWare. The last release
that claimed to still support IPX was OES 2 in 2007. Routing equipment
vendors (e.g. Cisco) discontinued support for IPX in 2011.

Thus, IPX won't be supported in FreeBSD 11.0-RELEASE.


# 7df3f986 05-Nov-2013 Gleb Smirnoff <glebius@FreeBSD.org>

Axe IFF_SMART.

Submitted by: pluknet


# a5752d55 21-Dec-2012 Kevin Lo <kevlo@FreeBSD.org>

Fix socket calls on error post-r243965.

Submitted by: Garrett Cooper


# 09fe6320 19-Jun-2012 Navdeep Parhar <np@FreeBSD.org>

- Updated TOE support in the kernel.

- Stateful TCP offload drivers for Terminator 3 and 4 (T3 and T4) ASICs.
These are available as t3_tom and t4_tom modules that augment cxgb(4)
and cxgbe(4) respectively. The cxgb/cxgbe drivers continue to work as
usual with or without these extra features.

- iWARP driver for Terminator 3 ASIC (kernel verbs). T4 iWARP in the
works and will follow soon.

Build-tested with make universe.

30s overview
============
What interfaces support TCP offload? Look for TOE4 and/or TOE6 in the
capabilities of an interface:
# ifconfig -m | grep TOE

Enable/disable TCP offload on an interface (just like any other ifnet
capability):
# ifconfig cxgbe0 toe
# ifconfig cxgbe0 -toe

Which connections are offloaded? Look for toe4 and/or toe6 in the
output of netstat and sockstat:
# netstat -np tcp | grep toe
# sockstat -46c | grep toe

Reviewed by: bz, gnn
Sponsored by: Chelsio communications.
MFC after: ~3 months (after 9.1, and after ensuring MFC is feasible)


# cf7aca24 28-May-2012 Bjoern A. Zeeb <bz@FreeBSD.org>

Removed the IFCAP_ prefix when printing the IPv6 checksum capabilities.

Submitted by: dim
MFC after: 3 days


# 356ab07e 28-May-2012 Bjoern A. Zeeb <bz@FreeBSD.org>

It turns out that too many drivers are not only parsing the L2/3/4
headers for TSO but also for generic checksum offloading. Ideally we
would only have one common function shared amongst all drivers, and
perhaps when updating them for IPv6 we should introduce that.
Eventually we should provide the meta information along with mbufs to
avoid (re-)parsing entirely.

To not break IPv6 (checksums and offload) and to be able to MFC the
changes without risking to hurt 3rd party drivers, duplicate the v4
framework, as other OSes have done as well.

Introduce interface capability flags for TX/RX checksum offload with
IPv6, to allow independent toggling (where possible). Add CSUM_*_IPV6
flags for UDP/TCP over IPv6, and reserve further for SCTP, and IPv6
fragmentation. Define CSUM_DELAY_DATA_IPV6 as we do for legacy IP and
add an alias for CSUM_DATA_VALID_IPV6.

This pretty much brings IPv6 handling in line with IPv4.
TSO is still handled in a different way and not via if_hwassist.

Update ifconfig to allow (un)setting of the new capability flags.
Update loopback to announce the new capabilities and if_hwassist flags.

Individual driver updates will have to follow, as will SCTP.

Reported by: gallatin, dim, ..
Reviewed by: gallatin (glanced at?)
MFC after: 3 days
X-MFC with: r235961,235959,235958


# 1623284f 19-May-2012 Bjoern A. Zeeb <bz@FreeBSD.org>

MFp4 bz_ipv6_fast:

Allow tso4 and tso6 be set individually given we have the bits.
This will help with drivers not working as expected during the
transition time and later.

Sponsored by: The FreeBSD Foundation
Sponsored by: iXsystems

Reviewed by: gnn
MFC After: 1 week


# 9697f9f8 14-Feb-2012 Robert Millan <rmh@FreeBSD.org>

Disable jail support in ifconfig when either building a rescue
image or MK_JAIL knob has been set to "no".

Reviewed by: bz
Approved by: adrian (mentor)


# 08b68b0e 15-Dec-2011 Gleb Smirnoff <glebius@FreeBSD.org>

A major overhaul of the CARP implementation. The ip_carp.c was started
from scratch, copying needed functionality from the old implemenation
on demand, with a thorough review of all code. The main change is that
interface layer has been removed from the CARP. Now redundant addresses
are configured exactly on the interfaces, they run on.

The CARP configuration itself is, as before, configured and read via
SIOCSVH/SIOCGVH ioctls. A new prefix created with SIOCAIFADDR or
SIOCAIFADDR_IN6 may now be configured to a particular virtual host id,
which makes the prefix redundant.

ifconfig(8) semantics has been changed too: now one doesn't need
to clone carpXX interface, he/she should directly configure a vhid
on a Ethernet interface.

To supply vhid data from the kernel to an application the getifaddrs(8)
function had been changed to pass ifam_data with each address. [1]

The new implementation definitely closes all PRs related to carp(4)
being an interface, and may close several others. It also allows
to run a single redundant IP per interface.

Big thanks to Bjoern Zeeb for his help with inet6 part of patch, for
idea on using ifam_data and for several rounds of reviewing!

PR: kern/117000, kern/126945, kern/126714, kern/120130, kern/117448
Reviewed by: bz
Submitted by: bz [1]


# ad2571a2 18-Jul-2011 Bjoern A. Zeeb <bz@FreeBSD.org>

If compiling RESCUE always ignore feature_present(3) calls so that
a /rescue/ifconfig more modern than the kernel could still configure
IPv4 or IPv6 addresses.

Reported by: Andrzej Tobola (ato iem.pw.edu.pl)
Reported by: gcooper
MFC after: 1 day
X-MFC: will not MFC any time soon, just reminder for r222527


# c9d658e9 13-Jun-2011 Luigi Rizzo <luigi@FreeBSD.org>

Grab one of the ifcap bits for netmap, and enable printing in ifconfig.

Document the fact that we might want an IFCAP_CANTCHANGE mask,
even though the value is not yet used in sys/net/if.c

(asked on -current a week ago, no feedback so i assume no objection).


# 5af3fa9a 31-May-2011 Bjoern A. Zeeb <bz@FreeBSD.org>

Conditionally compile in the af_inet and af_inet6, af_nd6 modules.
If compiled in for dual-stack use, test with feature_present(3)
to see if we should register the IPv4/IPv6 address family related
options.

In case there is no "inet" support we would love to go with the
usage() and make the address family mandatory (as it is for anything
but inet in theory). Unfortunately people are used to
ifconfig IF up/down
etc. as well, so use a fallback of "link". Adjust the man page
to reflect these minor details.

Improve error handling printing a warning in addition to the usage
telling that we do not know the given address family in two places.

Reviewed by: hrs, rwatson
Sponsored by: The FreeBSD Foundation
Sponsored by: iXsystems
MFC after: 2 weeks


# 6e3cb000 07-Dec-2010 Weongyo Jeong <weongyo@FreeBSD.org>

Introduces IFF_CANTCONFIG interface flag to point that the interface
isn't configurable in a meaningful way. This is for ifconfig(8) or
other tools not to change code whenever IFT_USB-like interfaces are
registered at the interface list.

Reviewed by: brooks
No objections: gavin, jkim


# 6d2f981e 30-Nov-2010 Weongyo Jeong <weongyo@FreeBSD.org>

Don't print usbus[0-9] interfaces that it's not the interesting
interface type for ifconfig(8).


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# d99d8e2e 06-Aug-2010 John Baldwin <jhb@FreeBSD.org>

Ethernet vlan(4) interfaces have valid Ethernet link layer addresses but
use a different interface type (IFT_L2VLAN vs IFT_ETHER). Treat IFT_L2VLAN
interfaces like IFT_ETHER interfaces when handling link layer addresses.

Reviewed by: syrinx (bsnmpd)
MFC after: 1 week


# 0919a8fb 27-Apr-2010 Xin LI <delphij@FreeBSD.org>

MFC r206637:

When an underlying ioctl(2) handler returns an error, our ioctl(2)
interface considers that it hits a fatal error, and will not copyout
the request structure back for _IOW and _IOWR ioctls, keeping them
untouched.

The previous implementation of the SIOCGIFDESCR ioctl intends to
feed the buffer length back to userland. However, if we return
an error, the feedback would be defeated and ifconfig(8) would
trap into an infinite loop.

This commit changes SIOCGIFDESCR to set buffer field to NULL to
indicate the previous ENAMETOOLONG case.

Reported by: bschmidt


# 57d84848 14-Apr-2010 Xin LI <delphij@FreeBSD.org>

When an underlying ioctl(2) handler returns an error, our ioctl(2)
interface considers that it hits a fatal error, and will not copyout
the request structure back for _IOW and _IOWR ioctls, keeping them
untouched.

The previous implementation of the SIOCGIFDESCR ioctl intends to
feed the buffer length back to userland. However, if we return
an error, the feedback would be defeated and ifconfig(8) would
trap into an infinite loop.

This commit changes SIOCGIFDESCR to set buffer field to NULL to
indicate the previous ENAMETOOLONG case.

Reported by: bschmidt
MFC after: 2 weeks


# 94190b39 01-Apr-2010 Qing Li <qingli@FreeBSD.org>

MFC 205222

Verify interface up status using its link state only
if the interface has such capability. The interface
capability flag indicates whether such capability
exists. This approach is much more backward compatible.
Physical device driver changes will be part of another
commit.

Also updated the ifconfig utility to show the LINKSTATE
capability if present.

Reviewed by: rwatson, imp, juli


# be3410a9 18-Mar-2010 Pyun YongHyeon <yongari@FreeBSD.org>

MFC r204150:
Add TSO support on VLAN in fconfig(8).


# 6b533b5d 16-Mar-2010 Qing Li <qingli@FreeBSD.org>

Verify interface up status using its link state only
if the interface has such capability. The interface
capability flag indicates whether such capability
exists. This approach is much more backward compatible.
Physical device driver changes will be part of another
commit.

Also updated the ifconfig utility to show the LINKSTATE
capability if present.

Reviewed by: rwatson, imp, juli
MFC after: 3 days


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# a5a931b3 25-Feb-2010 Xin LI <delphij@FreeBSD.org>

MFC 203052:

Add interface description capability as inspired by OpenBSD. Thanks for
rwatson@, jhb@, brooks@ and others for feedback to the old implementation!

Sponsored by: iXsystems, Inc.


# 0f686c0f 20-Feb-2010 Pyun YongHyeon <yongari@FreeBSD.org>

Add TSO support on VLAN in fconfig(8).

Reviewed by: thompsa


# 215940b3 26-Jan-2010 Xin LI <delphij@FreeBSD.org>

Revised revision 199201 (add interface description capability as inspired
by OpenBSD), based on comments from many, including rwatson, jhb, brooks
and others.

Sponsored by: iXsystems, Inc.
MFC after: 1 month


# c3582a19 24-Nov-2009 Will Andrews <will@FreeBSD.org>

Make ``ifconfig -l ether'' only list interfaces that speak Ethernet.

PR: 118987
Approved by: ken (mentor)


# 1a9d4dda 12-Nov-2009 Xin LI <delphij@FreeBSD.org>

Revert revision 199201 for now as it has introduced a kernel vulnerability
and requires more polishing.


# 41c8c6e8 11-Nov-2009 Xin LI <delphij@FreeBSD.org>

Add interface description capability as inspired by OpenBSD.

MFC after: 3 months


# 00dc5f8e 26-Jul-2009 Bjoern A. Zeeb <bz@FreeBSD.org>

Make ifconfig ifN -vnet <jname|jid> actually work:

- fix ifconfig to ignore the non-existent interface in the current
network stack in case of '-vnet'.
- in ifconfig: actually use the local variables defined for the
vnet functions rather than modifying the global.

Reviewed by: rwatson
Approved by: re (kib)


# 5061de23 24-Jun-2009 Jamie Gritton <jamie@FreeBSD.org>

Add the "vnet" and "-vnet" options, to allow moving interfaces between
jails with VIMAGE.

Approved by: bz (mentor)


# b59dcaee 23-Jun-2009 Xin LI <delphij@FreeBSD.org>

- Use size_t instead of int when appropriate;
- Use C99 sparse initialization.

With these changes ifconfig(8) is WARNS=2 clean.


# 31b2ac28 18-Apr-2009 Robert Watson <rwatson@FreeBSD.org>

ifconfig(8) no longer needs to know how to print the IFF_NEEDSGIANT flag,
since it shortly won't be defined at all.


# a9948a71 15-Mar-2009 Jamie Gritton <jamie@FreeBSD.org>

Default to AF_LOCAL instead of AF_INET sockets for non-family-specific
operations. This allows the query operations to work in non-IPv4 jails,
and will be necessary in a future of possible non-INET networking.

Approved by: bz (mentor)


# fab08280 14-Jan-2009 Sam Leffler <sam@FreeBSD.org>

use correct interface name when setting flags; fixes ifconfig ... create ... up

Noticed by: Chris Anderson


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 39669258 29-Sep-2008 Sam Leffler <sam@FreeBSD.org>

Distinguish between cmd/parameters used for clone operations and
all others. Use this to disambiguate cmd line arguments that can
be either clone params or regular parameters so, in particular,
"bssid" again works as a regular parameter.

While here leverage the above to improve the logic for flushing
clone operations on the first !clone cmd line parameter.

Reviewed by: jhay


# eafbb00d 28-Aug-2008 Jack F Vogel <jfv@FreeBSD.org>

Add support in ifconfig to control the vlan hardware filter feature.

Reviewed by: EvilSam and moi
MFC after:1 week


# 3b0edf7d 02-Aug-2008 Andrew Thompson <thompsa@FreeBSD.org>

Move the grekey to its own file, ifconfig.c does not have interface specific
code.

Submitted by: sam


# 131c55bc 20-Jun-2008 Andrew Thompson <thompsa@FreeBSD.org>

Add support for the optional key in the GRE header.

PR: kern/114714
Submitted by: Cristian KLEIN


# 2fa02c5f 31-Mar-2008 Sam Leffler <sam@FreeBSD.org>

Fix handling of create operation together with setting other parameters:
o mark cmds/parameters to indicate they are potential arguments to a clone
operation (e.g. vlantag)
o when handling a create/clone operation do the callback on seeing the first
non-clone cmd line argument so the new device is created and can be used;
and re-setup operating state to reflect the newly created device

Reviewed by: Eugene Grosbein
MFC after: 2 weeks


# de0abf19 09-Dec-2007 Sam Leffler <sam@FreeBSD.org>

Wake On Lan (WOL) infrastructure

Submitted by: Stefan Sperling <stsp@stsp.name>
Reviewed by: brooks


# 265e8a9a 04-Oct-2007 Andrew Thompson <thompsa@FreeBSD.org>

Fix the module name matching to the drivers present in the kernel. Previously
it would return true on a partial match where it would think the edsc module
was already present by having a positive match on 'ed'. This changes it so
that it compares the full string including the nul terminators.

This also fixes a buffer overflow in the ifkind variable where the length of
the interface name in *argv wasnt checked for size.

Reviewed by: brooks
Approved by: re (gnn)


# 0cae11b9 13-Jun-2007 Robert Watson <rwatson@FreeBSD.org>

Remove IPX over IP tunneling pieces from ifconfig(8), omitted portion of
previous commit:

Remove IPX over IP tunneling support, which allows IPX routing over IP
tunnels, and was not MPSAFE. The code can be easily restored in the
event that someone with an IPX over IP tunnel configuration can work
with me to test patches.

This removes one of five remaining consumers of NET_NEEDS_GIANT.

Approved by: re (kensmith)

Spotted by: Artem Naluzhny <tutat nhamon dot com dot ua>


# a6575bfc 11-Jun-2007 Andre Oppermann <andre@FreeBSD.org>

Add reporting and toggling of TCP LRO (large receive offload) support to
ifconfig(8).


# a389ab00 22-May-2007 Andrew Thompson <thompsa@FreeBSD.org>

Add the -n flag for disabling automatic module loading, this will be used by
rc.d to stop it reloading the network module on unload.


# f013cfc5 24-Mar-2007 Yaroslav Tykhiy <ytykhiy@gmail.com>

Back out rev. 1.129 because it breaks the practice of auto-loading
hardware drivers. Unlike pseudo-device drivers, which just attach
to the cloning framework and wait for "ifconfig create", h/w drivers
create interfaces for installed cards as soon as loaded. The issue
of devd(8) involuntarily reloading modules should be dealt with in a
different way.


# a40fb996 12-Mar-2007 Yaroslav Tykhiy <ytykhiy@gmail.com>

Attempt to load the kernel module only if we are going to create a
new interface. In other cases loading the module is unwanted and
can lead to ill side effects. One such effect found is as follows:
"kldunload if_foo" tells the module to kill all its interfaces,
which results in messages sent to devd; the module unloads. Then
devd starts processing the messages, which ends up in a etc script
running ifconfig fooX, which reloads the module.


# e5f01549 27-Feb-2007 Sam Leffler <sam@FreeBSD.org>

o consistently check strlcpy result
o warn when we skip an interface because it's name is too long


# 0b28f081 27-Feb-2007 Sam Leffler <sam@FreeBSD.org>

correct type to silence const complaint


# 30705853 27-Feb-2007 Sam Leffler <sam@FreeBSD.org>

unbreak create operation, must copy argument to global name

Spotted by: des


# cb8c905a 24-Feb-2007 Sam Leffler <sam@FreeBSD.org>

use getifaddrs from libc instead of private code

Reviewed by: bms
MFC after: 1 month


# 3ca72aeb 29-Dec-2006 Bjoern A. Zeeb <bz@FreeBSD.org>

Fix an off-by-one which could mean writing beyond the end of the array
when copying the interface name.
This code part should probably be rewritten.


# 6b92a006 20-Sep-2006 Andre Oppermann <andre@FreeBSD.org>

In setifcap() only set/unset those capabilities the interface actually
supports.


# 581d6e4c 08-Sep-2006 Andre Oppermann <andre@FreeBSD.org>

Fix octal representation of TSO4 and TSO6 bits in interface capabilities
description.


# d7097da4 06-Sep-2006 Andre Oppermann <andre@FreeBSD.org>

Make TSO (TCP segmentation offload) capabilities visible and accessible with
'ifconfig em0 tso' and 'ifconfig em0 -tso'. TSO for IPv4 and IPv6 is always
enabled or disabled together. The driver may enable only one if it doesn't
support both.

Document 'tso' and '-tso' in the ifconfig(8) man pages.

Sponsored by: TCP/IP Optimization Fundraise 2005


# db82353d 09-Jul-2006 Sam Leffler <sam@FreeBSD.org>

o replace special handling of clone operations by a clone callback
mechanism
o change vlan cloning to use callback and pass all vlan parameters
on create using the new SIOCREATE2 ioctl
o update vlan set logic to match existing practice


# 193af8d2 12-Mar-2006 Gleb Smirnoff <glebius@FreeBSD.org>

There is no IFF_POLLING flag anymore.


# 5dc27bc6 30-Jan-2006 Gleb Smirnoff <glebius@FreeBSD.org>

Recognize new VLAN_HWCSUM flag.


# c21a88e7 30-Jan-2006 Yaroslav Tykhiy <ytykhiy@gmail.com>

Do address assignment/removal operations after callbacks.

Presently, ifconfig callbacks are used for L2 configuration, media
and vlan, so actions associated with address assignment, like sending
out a gratuitous ARP, should go when L2 is running already.

This also should fix the problem with setting up vlan interfaces
from rc.conf, when both IP and vlan+vlandev parameters are passed
to ifconfig at once.

Future work: Consider introducing several ifconfig callback lists
to invoke callbacks orderly.

MFC after: 1 week


# 9e241c5e 29-Sep-2005 Yaroslav Tykhiy <ytykhiy@gmail.com>

For the sake of consistency and easier typing,
introduce "-tunnel" as an alias for "deletetunnel".
The latter is overly long and prone to typos, but
keep it for POLA since it costs nothing.

MFC after: 5 days


# b7eb47e2 14-Jul-2005 Robert Watson <rwatson@FreeBSD.org>

Add a new flag '-k' to ifconfig(8), indicating that it is alright to
print potentially sensitive keying material to stdout. With the new
802.11 support, ifconfig(8) is now capable of printing 802.11 keys,
and did by default for the root user, which is undesirable in some
environments. Now it will not print keying material unless requested
(and available to the user).

MFC after: 1 week


# 2eb9396f 13-Jul-2005 Yaroslav Tykhiy <ytykhiy@gmail.com>

Add symbolic names for the IFF_PPROMISC and IFF_NEEDSGIANT flags
so that ifconfig(8) can print them.

MFC after: 5 days


# eb2a391f 19-May-2005 Sam Leffler <sam@FreeBSD.org>

guard against bogus address data

Submitted by: Bakul Shah


# c508bf7a 08-Apr-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

ISO C does not allow unnamed union members.


# 77a9f6dd 08-Apr-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

Fix typo in comment.


# 90c4b74c 31-Dec-2004 Sam Leffler <sam@FreeBSD.org>

Fix special status reporting. Prior to the reorg there was
special-purpose code to display status for an interface for
state that was not address-oriented. This status reporting
was merged in to the address-oriented status reporting but
did not work for link address reporting (as discovered with
fwip interfaces). Correct this mis-merge and eliminate the
bogus kludge that was used for link-level address reporting.

o add an af_other_status method for an address family for
reporting status of things like media, vlan, etc.
o call the af_other_status methods after reporting address
status for an interface
o special-case link address status; when reporting all
status for an interface invoke it specially prior to
reporting af_other_status methods (since it requires the
sockaddr_dl that is passed in to status separately from
the rtmsg address state)
o correct the calling convention for link address status;
don't cast types, construct the proper parameter

This fixes ifconfig on fwip interfaces.


# 58ac5e5b 10-Dec-2004 Sam Leffler <sam@FreeBSD.org>

add a callback mechanism for code that wants to defer committing changes
until all the command line args have been processed

Reviewed by: ambrisko


# 5faf8dcb 08-Dec-2004 Sam Leffler <sam@FreeBSD.org>

Overhaul to cleanup some of the tangled logic that's grown over the years.

o break per-address family support out into separate files
o modularize per-address family and functional operations using
a registration mechanism; this permits configuration according
to which files you include (but beware that order of the files
is important to insure backwards compatibility)
o many cleanups to eliminate incestuous behaviour, global variables,
and poor coding practices (still much more to fix)

The original motivation of this work was to support dynamic addition
of functionality based on the interface so we can eliminate the various
little control programs and so that vendors can distribute ifconfig
plugins that support their in-kernel code. That work is still to be
completed.

o Update 802.11 support for all the new net80211 functionality; some
of these operations (e.g. list *) may be better suited in a different
program


# 9e734b44 01-Sep-2004 Brooks Davis <brooks@FreeBSD.org>

Use a spare byte in struct if_data to store the structure size without
increasing it. Add code to ifconfig to use this size to find the
sockaddr_dl after the struct if_data in the routing message. This
allows struct if_data to grow (up to 255 bytes) without breaking
ifconfig.

Submitted by: peter


# a740f6ee 08-Aug-2004 Pyun YongHyeon <yongari@FreeBSD.org>

Fix long standing mediaopt setting bugs seen on sparc64. Though
the bug exists in little-endian machine, it was not triggered due
to the difference of memory ordering between little/big endian
machines. Instead of relying on possibly modified value during
function invokcations, use saved copy of ifr.ifr_addr.sa_family.
Also add a comment at the top of ifconfig.c clarifying the issue
so the bug won't re-appear.

Approved by: jake
Reviewed by: yar


# e82866fe 26-Jul-2004 Yaroslav Tykhiy <ytykhiy@gmail.com>

Add two knobs to ifconfig(8), `vlanmtu' and `vlanhwtag',
that provide control over the respective capabilities
of an interface, reception of extended frames and hardware
VLAN multiplexor.


# 41b0ee74 30-Apr-2004 Doug Ambrisko <ambrisko@FreeBSD.org>

For both ifconfig and route if we didn't get enough memory from the
prior sysctl due to the structure growing between calls try again.

Also try again for deleting routes if things fail. We've seen
route -f fail this way which does not actually flush all routes.
This fixes it. It will whine but it will do the work.

PR: 56732
Obtained from: IronPort


# 0b46c085 13-Apr-2004 Luigi Rizzo <luigi@FreeBSD.org>

Replace ROUNDUP/ADVANCE with SA_SIZE


# 3a3b019a 11-Apr-2004 Ruslan Ermilov <ru@FreeBSD.org>

Added the new interface capability option for drivers that implement
user-configurable polling(4) support. Make ifconfig(8) aware of it.

Suggested by: luigi


# 4c723140 09-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp


# a6b03f42 30-Mar-2004 Sam Leffler <sam@FreeBSD.org>

add support for setting 802.11 rtsthreshold, transmit power,
and 11g protection mode

Reviewed by: imp (just code)


# 08b82c6b 12-Mar-2004 Ruslan Ermilov <ru@FreeBSD.org>

The print mask's first part is the base, not the total number of bit
identifiers.


# aec32663 12-Mar-2004 Ruslan Ermilov <ru@FreeBSD.org>

Show the polling(4) flag on the interface.


# c88f8102 10-Mar-2004 Bruce Evans <bde@FreeBSD.org>

Fixed a misspelling of 0 as NULL.


# 652d6e18 26-Feb-2004 Alexander Kabaev <kan@FreeBSD.org>

Look for both name and if_<name> strings in module metadata. Pseudo-devices
like tun are naming their modules using the 'if_; prefix and previous version of
the code failed to detect their presence in the kernel, resulting in the same
module being loaded twice.


# 97bebf0a 03-Feb-2004 Brooks Davis <brooks@FreeBSD.org>

Add ifconfig support for network interface renaming. In the process,
reorganize the printing of the interface name when using wildcard
cloning so it is not printed if it we either immediately rename or
destroy the interface.

Reviewed by: ru


# bbe513db 31-Jan-2004 Brooks Davis <brooks@FreeBSD.org>

Use memcpy plus a manual NUL termination when copying the interface name
from the sdl because strlcpy requires that the source string be
NUL-terminated unlike strncpy.

Submitted by: Peter Jeremy <PeterJeremy at optushome dot com dot au>


# a4fa9864 26-Jan-2004 Brooks Davis <brooks@FreeBSD.org>

Use IFNAMSIZ instead of a magic value for the length of an interface
name.

Prevent the kernel from potentially overflowing the interface name
variable. The size argument of strlcpy is complex because the name is
not null-terminated in sdl_data.


# 566214a3 25-Oct-2003 Peter Wemm <peter@FreeBSD.org>

Give wider types to sscanf to fix two warnings (u_short cannot be > 0xffff)
and to make sure that we catch oversized arguments rather than silently
truncate them. I dont know if sscanf will reject an integer if it will
not fit in the short return variable or not, but this way it should be
detected.


# deb62e28 01-Oct-2003 Ruslan Ermilov <ru@FreeBSD.org>

By popular demand, added the "static ARP" per-interface option.


# 4e61f6f1 28-Apr-2003 Sam Leffler <sam@FreeBSD.org>

add a "mode" directive to specify the operating mode for multi-mode devices;
this is mostly intended for use with multi-mode 802.11 devices that support
some combination of 11a, 11b, and 11g


# 71d66ceb 15-Apr-2003 Matthew N. Dodd <mdodd@FreeBSD.org>

Don't abuse module names to facilitate ifconfig module loading;
such abuse isn't really needed. (And if we do need type information
associated with a module then we should make it explicit and not
use hacks.)


# 059c32d2 05-Mar-2003 Peter Wemm <peter@FreeBSD.org>

Kill #ifdef NS code


# 83d5e173 23-Jan-2003 Matthew N. Dodd <mdodd@FreeBSD.org>

Add missing #if USE_IF_MEDIA/#endif.


# b8701b54 21-Jan-2003 Max Khon <fjoe@FreeBSD.org>

fix link_status() in non-Ethernet case

MFC after: 1 week


# 94da2600 14-Nov-2002 Sam Leffler <sam@FreeBSD.org>

o display new interface capability bits
o capitilize capability bit strings for consistency

Approved by: re


# fb313324 24-Oct-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Report the MONITOR bit.


# 97490f4b 23-Oct-2002 Robert Watson <rwatson@FreeBSD.org>

Rename ifconfig's "mac" argument to "maclabel" to prevent confusion
regarding 802.1 MAC and Mandatory Access Control (MAC). Some
potential for confusion remains further in other areas of the
system regarding Message Authentication Codes (MAC).

Requested by: wollman
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories


# 2d58d642 22-Oct-2002 Robert Watson <rwatson@FreeBSD.org>

Teach ifconfig(8) how to print and set the MAC labels on network
interfaces using the 'mac' argument. Without MAC support in the
kernel, this does not change the behavior of ifconfig.

Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories


# b6fcb4fe 01-Oct-2002 Dima Dorfman <dd@FreeBSD.org>

Don't crash when the user feeds us nonesense in the form:
ifconfig IF ether WHATEVER -alias

PR: 42544
Submitted by: Mike Makonnen <makonnen@pacbell.net>


# afbe3a0f 27-Sep-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Add the "Monitor" interface flag.

Setting this flag on an ethernet interface blocks transmission of packets
and discards incoming packets after BPF processing.

This is useful if you want to monitor network trafic but not interact
with the network in question.

Sponsored by: http://www.babeltech.dk


# ffb079be 19-Aug-2002 Maxim Sobolev <sobomax@FreeBSD.org>

Implement user-setable promiscuous mode (a new `promisc' flag for ifconfig(8)).
Also, for all interfaces in this mode pass all ethernet frames to upper layer,
even those not addressed to our own MAC, which allows packets encapsulated
in those frames be processed with packet filters (ipfw(8) et al).

Emphatically requested by: Anton Turygin <pa3op@ukr-link.net>
Valuable suggestions by: fenner


# 3471c917 19-Aug-2002 Maxim Sobolev <sobomax@FreeBSD.org>

Fix last-minute typo which breaks the world.

Submitted by: many


# 62f76486 18-Aug-2002 Maxim Sobolev <sobomax@FreeBSD.org>

Increase size of ifnet.if_flags from 16 bits (short) to 32 bits (int). To avoid
breaking application ABI use unused ifreq.ifru_flags[1] for upper 16 bits in
SIOCSIFFLAGS and SIOCGIFFLAGS ioctl's.

Reviewed by: -hackers, -net


# 331a2db8 15-Jun-2002 Hajimu UMEMOTO <ume@FreeBSD.org>

Add eui64 option which fills interface index (lowermost 64bit of
an IPv6 address) automatically.
This should obsolete prefix(8).

Obtained from: NetBSD
MFC after: 2 weeks


# bc123897 18-Apr-2002 Warner Losh <imp@FreeBSD.org>

De-__P, use ansi function definitions


# 1876df83 27-Mar-2002 Ruslan Ermilov <ru@FreeBSD.org>

Turn "ether" address family into a generic "link" family
that could be used to set/get arbitrary length link level
addresses. Alias "lladdr" parameter and "ether" family
to the new "link" family for backward compatibility.

PR: bin/31476
MFC after: 1 week


# 3d438ad6 20-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Remove 'register' keyword.
It does not help modern compilers, and some may take some hit from it.
(I also found several functions that listed *every* of its 10 local vars with
"register" -- just how many free registers do people think machines have?)


# 47af9353 03-Dec-2001 Ruslan Ermilov <ru@FreeBSD.org>

MTU and metric are available with NET_RT_IFLIST.

MFC after: 3 days


# 1643c8f3 17-Oct-2001 Jonathan Lemon <jlemon@FreeBSD.org>

When specifying an interface to ifconfig, first look up the interface
index, then retrieve statistics for that index, rather than retrieving
all interfaces and then looking for a matching name. This allows the
user to refer to an interface via an alias name.

While I'm here, also perform a few assorted cleanups.


# 5fc10eaf 18-Sep-2001 Jonathan Lemon <jlemon@FreeBSD.org>

Split hwcsum into rxcsum and txcsum components.


# f35b9d16 18-Sep-2001 Jonathan Lemon <jlemon@FreeBSD.org>

Teach ifconfig about the new interface capability words.


# 1ce95f78 17-Aug-2001 Brooks Davis <brooks@FreeBSD.org>

Actuall make plumb work in addition to create as per the manpage.

PR: bin/29812
Submitted by: Joao Carlos Mendes Luis <jonny@eng05.embratel.net.br>


# 59e7e5d1 26-Jul-2001 Hajimu UMEMOTO <ume@FreeBSD.org>

ifconfig if0 netmask xxx.xxx.xxx.0 didn't change the netmask.

PR: bin/28833
MFC after: 3 days


# b5cd4931 20-Jul-2001 David E. O'Brien <obrien@FreeBSD.org>

Dike out the IPX bits if RELEASE_CRUNCH is defined.


# 3e61dca0 02-Jul-2001 Brooks Davis <brooks@FreeBSD.org>

Support network device cloning via create and destroy options.

Reviewed by: ru, ume
Obtained from: NetBSD
MFC after: 1 week


# 33841545 10-Jun-2001 Hajimu UMEMOTO <ume@FreeBSD.org>

Sync with recent KAME.
This work was based on kame-20010528-freebsd43-snap.tgz and some
critical problem after the snap was out were fixed.
There are many many changes since last KAME merge.

TODO:
- The definitions of SADB_* in sys/net/pfkeyv2.h are still different
from RFC2407/IANA assignment because of binary compatibility
issue. It should be fixed under 5-CURRENT.
- ip6po_m member of struct ip6_pktopts is no longer used. But, it
is still there because of binary compatibility issue. It should
be removed under 5-CURRENT.

Reviewed by: itojun
Obtained from: KAME
MFC after: 3 weeks


# ca299b1f 29-May-2001 Poul-Henning Kamp <phk@FreeBSD.org>

When using interfaces that support if_media, the supported media list is
printed on a single, very long, and generally unreadable line. This
isn't very useful. It's also really ugly and most of the time you don't
care what media is supported anyway.

PR: 27701
Submitted by: Brooks Davis <brooks@one-eyed-alien.net>


# 419d8080 26-May-2001 Poul-Henning Kamp <phk@FreeBSD.org>

Currently, each wireless networking driver has it's own control program
despite the fact that most people want to set exactly the same settings
regardless of which card they have. It has been repeatidly suggested
that this configuration should be done via ifconfig. This patch
implements the required functionality in ifconfig and add support to the
wi and an drivers. It also provides partial, untested support for the
awi driver.

PR: 25577
Submitted by: Brooks Davis <brooks@one-eyed-alien.net>


# e1387e5d 04-May-2001 Jesper Skriver <jesper@FreeBSD.org>

Implement slash/CIDR notation for IPv4 and IPv6 addresses.

MFC after: 1 week

Reviewed by: phk
Obtained from: NetBSD


# bf8a1b09 21-Feb-2001 Hajimu UMEMOTO <ume@FreeBSD.org>

if no address is setted, do not call ioctl(SIOCAIFADDR)

Obtained from: KAME


# 17927a64 30-Nov-2000 Andrey A. Chernov <ache@FreeBSD.org>

Add missing && which absense stops 'make world'


# ee7b8bab 30-Nov-2000 Luigi Rizzo <luigi@FreeBSD.org>

remove an undefined reference when no VLAN support is compiled in.


# 1ada402a 27-Nov-2000 Hajimu UMEMOTO <ume@FreeBSD.org>

Add missing initialization for IPv6 address lifetime.

PR: misc/22884
Obtained from: KAME


# abc3361a 19-Jul-2000 Archie Cobbs <archie@FreeBSD.org>

Show the actual command line usage in the man page and usage error string.


# d80e7aa7 18-Jul-2000 Archie Cobbs <archie@FreeBSD.org>

Make "ifconfig" with no arguments equivalent to "ifconfig -a".


# de010cdf 12-Jul-2000 John Baldwin <jhb@FreeBSD.org>

Add support to the 'ether' address family to support setting of addresses.
This allows you to set ether addresses with 'ifconfig ether'. Also, use
some saner socket address families that allow several special case tests
to be removed.


# b106252c 16-Jun-2000 Bill Paul <wpaul@FreeBSD.org>

Implement SIOCSIFLLADDR, which allows you to change the link-level
address on an interface. This basically allows you to do what my
little setmac module/utility does via ifconfig. This involves the
following changes:

socket.h: define SIOCSIFLLADDR
if.c: add support for SIOCSIFLLADDR, which resets the values in
the arpcom struct and sockaddr_dl for the specified interface.
Note that if the interface is already up, we need to down/up
it in order to program the underlying hardware's receive filter.
ifconfig.c: add lladdr command
ifconfig.8: document lladdr command

You can now force the MAC address on any ethernet interface to be
whatever you want. (The change is not sticky across reboots of course:
we don't actually reprogram the EEPROM or anything.) Actually, you
can reprogram the MAC address on other kinds of interfaces too; this
shouldn't be ethernet-specific (though at the moment it's limited to
6 bytes of address data).

Nobody ran up to me and said "this is the politically correct way to
do this!" so I don't want to hear any complaints from people who think
I could have done it more elegantly. Consider yourselves lucky I didn't
do it by having ifconfig tread all over /dev/kmem.


# 3812e266 05-Mar-2000 Peter Wemm <peter@FreeBSD.org>

Purely cosmetic tweak, use consistant whitespace with scopeid.


# 62585e33 28-Feb-2000 Yoshinobu Inoue <shin@FreeBSD.org>

Print scope id for scoped addrs.

Approved by: jkh


# d6d1cb48 26-Feb-2000 Robert Watson <rwatson@FreeBSD.org>

Introduce ``add'' and ``remove'' as alternatives to ``alias'' and ``delete''.
Improve compatibility with BSD/OS, and also more accurately reflect that
IP aliases aren't really any different than the primary IP address on an
interface.

Reviewed by: dcs
Approved by: jkh


# 94fafad0 09-Feb-2000 Yoshinobu Inoue <shin@FreeBSD.org>

Support IPv6 scoped addr in ifconfig and route

IPv6 scoped addr display is not yet supported by ifconfig
and route. Now almost of IPv6 apps support it, so its support
in ifconfig and route is important to keep consisetncy, and
to avoid user confusion.

Approved by: jkh


# 749daf9e 29-Dec-1999 Ruslan Ermilov <ru@FreeBSD.org>

- do not dereference a null pointer.
- minor sanity.

PR: 15318


# f06590f6 15-Dec-1999 Bill Fumerola <billf@FreeBSD.org>

Spelling correction (adress -> address)


# cfa1ca9d 07-Dec-1999 Yoshinobu Inoue <shin@FreeBSD.org>

udp IPv6 support, IPv6/IPv4 tunneling support in kernel,
packet divert at kernel for IPv6/IPv4 translater daemon

This includes queue related patch submitted by jburkhol@home.com.

Submitted by: queue related patch from jburkhol@home.com
Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project


# f3722ef6 20-Sep-1999 Mike Smith <msmith@FreeBSD.org>

If we don't appear to have a module loaded supporting the interface
we're about to operate on, try to load one. Don't complain if the
load fails, and always press on regardless (there may not be a module
suitable or required).

With the renaming of the PCI ethernet driver modules and the addition
of appropriate miibus dependancies on those modules that need it, it is
now no longer necessary to compile many ethernet drivers into the kernel;
they will be loaded on demand the first time they are ifconfig'ed.

Inspiration from: mount
Reviewed by: obrien


# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 6003dc8e 19-Jun-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Move the IFSTATUS stuff after the address listing.


# 413dd0ba 19-Jun-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Add a new interface ioctl, to return "aux status".

This is inteded for to allow ifconfig to print various unstructured
information from an interface.

The data is returned from the kernel in ASCII form, see the comment in
if.h for some technicalities.

Canonical cut&paste example to be found in if_tun.c

Initial use:
Now tun* interfaces tell the PID of the process which opened them.

Future uses could be (volounteers welcome!):
Have ppp/slip interfaces tell which tty they use.
Make sync interfaces return their media state: red/yellow/blue
alarm, timeslot assignment and so on.
Make ethernets warn about missing heartbeats and/or cables


# cf4b9371 06-Jun-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Introduce IFF_SMART bit.

This means that the driver will add/delete routes when it knows it is
up/down, rather than have the generic code belive it is up if configured.

This is probably most useful for serial lines, although many PHY chips
could probably tell us if we're connected to the cable/hub as well.


# 97ed1257 14-Mar-1999 Bill Paul <wpaul@FreeBSD.org>

Grrr... botched remote commit. Let's try this again: vlan updates,
take two.


# 511d9c69 07-Aug-1998 Poul-Henning Kamp <phk@FreeBSD.org>

unifdef -UISO

Inspired by bdes comment to PR: 7419


# 91ba27a7 06-Jul-1998 Bruce Evans <bde@FreeBSD.org>

ioctl() request args are unsigned longs, so don't attempt to store
them as ints. Among other bugs, doing so at best caused benign
overflow followed by fatal sign extension on machines with 32-bit
ints and 64-bit longs.


# e333b944 06-Jul-1998 Philippe Charnier <charnier@FreeBSD.org>

Update man page to allow adding address_family when -l is used (this is a no op
for now). Correct use of .Nm. Short usage string (see man page for full list).
Spelling. Use err(3).


# 83e65693 19-Mar-1998 Eivind Eklund <eivind@FreeBSD.org>

Make 'ifconfig -l ether' only list Ethernet interfaces. This is
useful, intuitive, and match the old comments in the source.
Previously, 'ifconfig -l ether' and 'ifconfig -l' were equal.


# b1a3bc5e 26-Dec-1997 Warner Losh <imp@FreeBSD.org>

style(9) corrections
Submitted by: bde


# 9ae323c5 23-Dec-1997 Warner Losh <imp@FreeBSD.org>

Be extra paranoid about trusting the size of the address returned from
gethostbyaddr.
Submitted by: Julian Assange


# 0f30219f 26-Oct-1997 Steve Price <steve@FreeBSD.org>

Fix a misleading comment.

PR: bin/4861
Submitted by: Alex <garbanzo@hooked.net>


# 41cd75b7 15-Oct-1997 Peter Wemm <peter@FreeBSD.org>

Make the supported media info output the default.
The -m switch is now accepted for backwards compatability.

Suggested by: davidg


# c5149505 10-May-1997 Peter Wemm <peter@FreeBSD.org>

Clean up some more. Move parsing of sysctl iflist data into a single
place rather than updating the main loop's index variables from within
a subroutine and other revolting things like that. Move some more
globals into local variables.


# eca42d3c 10-May-1997 Peter Wemm <peter@FreeBSD.org>

Grumble.. My last patchup here didn't quite work either. I hate this
program and it's use of global variables. Somehow, I managed to miss the
most obvious case.. "ifconfig ed0 10.0.0.1" failed (no "inet")

Submitted by: dfr


# 9c3b235f 06-May-1997 Peter Wemm <peter@FreeBSD.org>

Restore unintentially lost backwards compat behavior of defaulting to
family inet if not specified. (eg: "ifconfig ed0" down would fail because
no family was specified, even though the up/down status is not per family)

Pointed out by: Wolfgang Helbig <helbig@MX.BA-Stuttgart.De>


# 9906480a 04-May-1997 Peter Wemm <peter@FreeBSD.org>

Commit hooks for ifmedia support. It's optional in the Makefile, and
can be trivially disabled.


# ed055a83 04-May-1997 Peter Wemm <peter@FreeBSD.org>

Second try at cleanups and fixes (without if_media stuff for the moment)
- parse command options using getopt for consistancy
- sanitise the command parsing so that it's less like spaghetti
- implement a "-l" option (idea from NetBSD - just list names)
- attempt to clean up the sysctl parsing loop some more. It still needs
to be taken out the back and shot though.
- cut down on global usage, but there's a lot more scope for this.
- make usage string a bit closer to reality (it was missing lots of things)

Unfortunately, I did this for the second time but with the memory of
the NetBSD version still recently in my mind. It's hard to redo simple
changes or getopt stuff without making it look like what you've been
working with a few hours ago.


# fa738d15 04-May-1997 Peter Wemm <peter@FreeBSD.org>

force null commit to skip over rev 1.25 so there's less cvs trouble


# c0ec1f37 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 702a1d01 03-Jan-1997 Garrett Wollman <wollman@FreeBSD.org>

Update to match changes in <net/if.h>.


# 628d2ac1 10-Dec-1996 Garrett Wollman <wollman@FreeBSD.org>

Fix up programs which expect <net/if.h> to include <sys/time.h> to instead
do it themselves. (Some of these programs actually depended on this
beyond compiling the definition of struct ifinfo!) Also fix up some
other #include messes while we're at it.


# a1199ade 21-Nov-1996 Garrett Wollman <wollman@FreeBSD.org>

Fix lots of non-bug questionable code:

- Don't link against libkvm and don't uselessly include <kvm.h>.
- Declare constant objects as const.
- Declare functions with the correct types.
- Call functions with the correct parameters.

Not fixed:

- The sysctl parsing remains ugly (but it may be the best we can do).
- atnetrange() should use strtoul() rather than sscanf() for better
error checking.


# 55d27aaa 04-Sep-1996 Julian Elischer <julian@FreeBSD.org>

Get rid of an unexpectedly bogus sanity check under appletalk because
it stopped us from removing or setting loopback address
on lo0:

also make use of the fact the athe sockaddre_at struct now has a "netrange"
field.

CVS ----------------------------------------------------------------------


# 3a67d2bc 22-Jul-1996 Julian Elischer <julian@FreeBSD.org>

Submitted by: archie@whistle.com

appletalk cleanups


# c6c1bba8 14-Jul-1996 Alexander Langer <alex@FreeBSD.org>

Grammar fix described by wollman in response to PR 1363.


# e05f2836 08-Jul-1996 Julian Elischer <julian@FreeBSD.org>

Submitted by: Archie@whistle.com
Obtained from: Whistle Communications
patches to allow ifconfig to work with appletalk addresses etc.


# cbc17e71 13-Feb-1996 Garrett Wollman <wollman@FreeBSD.org>

XNS sort-of-support is no more.


# 0761cb29 06-Feb-1996 Garrett Wollman <wollman@FreeBSD.org>

Remove support for OSI networking in user-land (#ifdef OSI aor CCITT)
in preparation for its removal from the kernel source tree. NB: because
a function was deleted, libc is now at version 3.0 (was 2.2 previously).


# 34b8a752 30-Jan-1996 Andrey A. Chernov <ache@FreeBSD.org>

Add missing comma in usage printf


# e416b391 08-Jan-1996 Peter Wemm <peter@FreeBSD.org>

Yet another "fix" for some of the mistakes in the recent versions..

I discovered that when asking for the IFLIST via sysctl(), if you
specify only AF_INET address, it actually gives you only AF_INET..
(suprise, suprise..!)

Now, it should "do the right thing" in just about all cases... The only
problem, is that "the right thing" isn't exactly clear in all cases.


# 79769a74 07-Jan-1996 Peter Wemm <peter@FreeBSD.org>

Fix some of my mistakes, slight cleanup, improve reliability (the old
ifconfig would segfault on "ifconfig ed0 ether up" and the like).

The main reason for this commit was that an "ifconfig -a" would also show
the AF_INET addresses in AF_IPX form (if the kernel was configured for IPX)
due to insufficient AF checking in my "new way" of doing it.


# 062d242e 01-Jan-1996 Peter Wemm <peter@FreeBSD.org>

My really ugly hack to ifconfig to make it pick up interface aliases
and the ethernet address for non-root users.

I apologise to the world for propagating the ugliness of some of the code
constructs within ifconfig... Fixing them would just abou mean rewriting
most of the function call interfaces, something I didn't have the stomach
for. :-)


# ee9a4638 07-Dec-1995 Garrett Wollman <wollman@FreeBSD.org>

Use a dynamically-sized buffer for SIOCGIFCONF so that `ifconfig -a'
actually retrieves all the information no matter how many interfaces
there are. (Probably there are other utilities which need similar
modification.)

Submitted by: Andrew Webster <awebster@dataradio.com>


# cc6a66f2 26-Oct-1995 Julian Elischer <julian@FreeBSD.org>

Reviewed by: julian and jhay@mikom.csir.co.za
Submitted by: Mike Mitchell, supervisor@alb.asctmd.com

This is a bulk mport of Mike's IPX/SPX protocol stacks and all the
related gunf that goes with it..
it is not guaranteed to work 100% correctly at this time
but as we had several people trying to work on it
I figured it would be better to get it checked in so
they could all get teh same thing to work on..

Mikes been using it for a year or so
but on 2.0

more changes and stuff will be merged in from other developers now that this is in.

Mike Mitchell, Network Engineer
AMTECH Systems Corporation, Technology and Manufacturing
8600 Jefferson Street, Albuquerque, New Mexico 87113 (505) 856-8000
supervisor@alb.asctmd.com


# 5ebc7e62 30-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.


# ef6304d8 26-Apr-1995 Paul Traina <pst@FreeBSD.org>

Replace call to obsolete inet_addr routine with inet_aton so we can specify
netmasks and broadcast addresses of 255.255.255.255.


# f7fa522e 12-Mar-1995 Bill Paul <wpaul@FreeBSD.org>

Impliment -ad and -au flags in addition to -a and document the change
in the man page. ifconfig -au affects all interfaces marked as up,
and ifconfig -ad affects only the interfaces marked down. ifconfig -a
still handles everything. This change is purely for compatibility with
SunOS, for those who might be accustomed to the SunOS ifconfig's
behavior.


# a3091721 30-Dec-1994 Jordan K. Hubbard <jkh@FreeBSD.org>

From: Wankle Rotary Engine <wpaul@skynet.ctr.columbia.edu>

- The -a flag now works just as it does in SunOS: '-a' is actually
handled like a wildcard for all interfaces. 'ifconfig -a' displays
the status of all interfaces, 'ifconfig -a netmask 0xffffff00' sets
the netmask of all interfaces, and so forth. I don't know if many
people really need to be able to set the netmasks of all interfaces
at once, but the SunOS ifconfig seems to allow this, so there you
have it.

- An 'ether_status' function has been added to display the ethernet
address of all ethernet interfaces. Again, as in SunOS, you must
be root in order for this to work. The ethernet address is read
from /dev/kmem using kvm_open() and kvm_read(), much in the same
was as it's done with netstat. If you choose to install ifconfig
set-gid kmem then normal users will be able to see the ethernet
address as well, though this may not be desireable. This feature
requires a small change to the ifconfig Makefile: you need to link
with -lkvm in order to use the kvm_*() functions.

Submitted by: wpaul


# 794cdf17 20-Nov-1994 Andreas Schulz <ats@FreeBSD.org>

Add parameters "compress", "normal" and "noicmp" for the slip usage.
These names are used in the slip.hosts file as examples, but ifconfig
have formerly only accepted link0, -link0 and link1 for this.


# 4db32b03 08-Aug-1994 David Greenman <dg@FreeBSD.org>

Added support for setting the per-interface MTU.


# 8fae3551 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite sbin Sources

Note: XNSrouted and routed NOT imported here, they shall be imported with
usr.sbin.