History log of /freebsd-current/sbin/ifconfig/ifconfig_netlink.c
Revision Date Author Comments
# 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


# 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


# 4f8f43b0 16-Oct-2023 Kristof Provost <kp@FreeBSD.org>

netlink: cope with growing requests

If a request ends up growing beyong the initially allocated space the
netlink functions (such as snl_add_msg_attr_u32()) will allocate a
new buffer. This invalidates the header pointer we can have received
from snl_create_msg_request(). Always use the hdr returned by
snl_finalize_msg().

Reviewed by: melifaro
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D42223


# 6f3947be 25-Aug-2023 Gleb Smirnoff <glebius@FreeBSD.org>

ifconfig: fix 'ifconfig -l link'

The rtnetlink(4) RTM_GETADDR does not list link level addresses, thus
the correct match for interfaces that have a link level address should
be based on what was returned by RTM_GETLINK.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D41586


# 31016aa0 25-Aug-2023 Gleb Smirnoff <glebius@FreeBSD.org>

ifconfig: fix 'ifconfig -l ether'

When matching interfaces for being Ethernet, use same trick that
the link module does - pass if_type through convert_iftype().
That restores historicaly behaviour of listing lagg(4) ports.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D41585


# a29916a6 20-Jul-2023 Navdeep Parhar <np@FreeBSD.org>

ifconfig_netlink.c: whitespace cleanup.

No functional change.


# 88284368 20-Jul-2023 Navdeep Parhar <np@FreeBSD.org>

ifconfig: Shift unsigned value to avoid UB.

Reported by: kib@


# 47b1fef6 19-Jul-2023 Navdeep Parhar <np@FreeBSD.org>

ifconfig: Fix the display of capabilities in the netlink based code.

The capabilities in if_capabilities2/if_capenable2 are reported in the
second 32b and were not being displayed correctly. v does not need to
be advanced because v[i / 32] is the correct 32b value already.

Sponsored by: Chelsio Communications

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


# 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


# 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


# 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


# 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


# 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


# 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


# 12cfa3c1 24-May-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: fix interface address ordering with Netlink.


# 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


# 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


# 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