History log of /src/sys/net/if_var.h (Results 1 – 25 of 1488)
Revision Date Author Comments
# 349fcf07 21-Dec-2025 Gleb Smirnoff <glebius@FreeBSD.org>

net: add ifnet_rename_event EVENTHANDLER(9) for interface renaming

and don't trigger ifnet_arrival_event and ifnet_departure_event for a
rename, as the interface isn't being detached from any protoc

net: add ifnet_rename_event EVENTHANDLER(9) for interface renaming

and don't trigger ifnet_arrival_event and ifnet_departure_event for a
rename, as the interface isn't being detached from any protocol. The
consumers of the arrival/departure events are divided into a few
categories:
- which indeed need to do the same actions as if interface was fully
detached and attached: routing socket and netlink notifications to
userland and the Linux sysfs. All addressed by this commit.
- which build their logic based on an interface name, but should actually
update their database on rename: packet filters. This commit leaves
them with the old behavior - emulate full detach & attach, but this
should be improved.
- which shouldn't do anything on rename, not touched by the commit.
- ng_ether and if_tuntap, that are special and will be addressed by
separate commits.

show more ...


# 0d469d23 18-Dec-2025 Gleb Smirnoff <glebius@FreeBSD.org>

net: attach IPv4 and IPv6 stacks to an interface with EVENTHANDLER(9)

This change retires two historic relics: the if_afdata[] array and the
dom_ifattach/dom_ifdetach methods.

The if_afdata[] array

net: attach IPv4 and IPv6 stacks to an interface with EVENTHANDLER(9)

This change retires two historic relics: the if_afdata[] array and the
dom_ifattach/dom_ifdetach methods.

The if_afdata[] array is a relic of the era, when there was expectation
that many transport protocols will coexist with IP, e.g. IPX or NetAtalk.
The array hasn't had any members except AF_INET and AF_INET6 for over a
decade already. This change removes the array and just leaves two pointer
fields: if_inet and if_inet6.

The dom_ifattach/dom_ifdetach predates the EVENTHANDLER(9) framework and
was a good enough method to initialize protocol contexts back then. Today
there is no good reason to treat IPv4 and IPv6 stacks differently to other
protocols/features that attach and detach from an interface.

The locking of if_afdata[] is a relic of SMPng times, when the system
startup and the interface attach was even more convoluted than before this
change, and we also had unloadable protocols that used a field in
if_afdata[]. Note that IPv4 and IPv6 are not unloadable.

Note that this change removes NET_EPOCH_WAIT() from the interface detach
sequence. This may surface several new races associated with interface
removal. I failed to hit any with consecutive test suite runs, though.
The expected general race scenario is that while struct ifnet is freed
with proper epoch_call(9) itself, some structures hanging off ifnet are
freed with direct free(9). The proper fix is either make if_foo point at
some static "dead" structure providing SMP visibility of this store, or
free those structure with epoch_call(9). All of these cases are planned
to be found and resolved during 16.0-CURRENT lifetime.

Reviewed by: zlei, gallatin, melifaro
Differential Revision: https://reviews.freebsd.org/D54089

show more ...


# 713b57c4 18-Dec-2025 Gleb Smirnoff <glebius@FreeBSD.org>

net: split ifnet_arrival_event into two events

Run the original ifnet_arrival_event before linking the interface.
Otherwise there is a race window when interface is already visible, but
not all of t

net: split ifnet_arrival_event into two events

Run the original ifnet_arrival_event before linking the interface.
Otherwise there is a race window when interface is already visible, but
not all of the protocols have completed their attach. Provide a new event
handler ifnet_attached_event, that is executed when the inteface is fully
visible. Use it in route(4) socket and netlink(4) to announce new
interface to the userland. Properly document the ifnet events in if_var.h.

Reviewed by: zlei, melifaro
Differential Revision: https://reviews.freebsd.org/D54085

show more ...


# fd131b47 04-Dec-2025 Gleb Smirnoff <glebius@FreeBSD.org>

net: remove dom_ifmtu

It is a remnant of a network stack design that was supposed to support
multiple network protocols. Today it is clear that we are left with IPv4
and IPv6 only. Only IPv6 may h

net: remove dom_ifmtu

It is a remnant of a network stack design that was supposed to support
multiple network protocols. Today it is clear that we are left with IPv4
and IPv6 only. Only IPv6 may have an MTU different to the interface MTU.

show more ...


# 50071731 27-Oct-2025 Mark Johnston <markj@FreeBSD.org>

net: Remove useless field annotations

MFC after: 1 week


# ebb60d47 01-Oct-2025 Kristof Provost <kp@FreeBSD.org>

Revert "IfAPI: Added missing accessor for if_home_vnet"

This reverts commit 4e7a375804e5ad4b244ce9a035fa971cbf2f0944.

We do not want out-of-tree consumers to access the home_vnet variable.

As disc

Revert "IfAPI: Added missing accessor for if_home_vnet"

This reverts commit 4e7a375804e5ad4b244ce9a035fa971cbf2f0944.

We do not want out-of-tree consumers to access the home_vnet variable.

As discussed with the author and Gleb Smirnoff.

show more ...


# 4e7a3758 28-Sep-2025 ItzBlinkzy <kitey13579@gmail.com>

IfAPI: Added missing accessor for if_home_vnet

Reviewed by: kp
Signed-off-by: Kevin Irabor <kevin.irabor04@gmail.com>


# 431856c8 25-Aug-2025 Aymeric Wibo <obiwac@FreeBSD.org>

netlink: Bypass refcounting when setting promiscuity

When asking for IFF_PROMISC when modifying interfaces with netlink, set
permanent flag instead (IFF_PPROMISC) as netlink interface modification
h

netlink: Bypass refcounting when setting promiscuity

When asking for IFF_PROMISC when modifying interfaces with netlink, set
permanent flag instead (IFF_PPROMISC) as netlink interface modification
has no way of doing promiscuity reference counting through ifpromisc().
We can't do reference counting because every netlink interface
modification necessarily either sets or unsets IFF_PROMISC in ifi_flags,
and ifi_change is usually set to 0xFFFFFFFF.

This logic was the same between this and SIOCSIFFLAGS, so factor out
if_setppromisc() function.

Reviewed by: melifaro, saheed, kp, mckusick (mentor)
Approved by: melifaro, saheed, mckusick (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52056

show more ...


# 27f680be 31-May-2025 Konstantin Belousov <kib@FreeBSD.org>

send tags: add a status report method

Reviewed by: jhb, markj
Sponsored by: NVidia networking
Differential revision: https://reviews.freebsd.org/D50653


# 8e1af802 09-Dec-2024 Gleb Smirnoff <glebius@FreeBSD.org>

IfAPI: make if_getlladdr() to return char *

No functional change. The caddr_t is a relic typedef from C version
that didn't have void pointer. In this particular change we really
need a char * poi

IfAPI: make if_getlladdr() to return char *

No functional change. The caddr_t is a relic typedef from C version
that didn't have void pointer. In this particular change we really
need a char * pointer rather than void, because some consumers use
the link level address as a char array.

show more ...


# f6efccaa 08-Nov-2024 Justin Hibbits <jhibbits@FreeBSD.org>

IfAPI: Remove temporary inclusion of if_private.h

Summary:
The kernel is now fully migrated to the IfAPI, so remove the temporary
inclusion of the private structure definition.

Reviewed By: #networ

IfAPI: Remove temporary inclusion of if_private.h

Summary:
The kernel is now fully migrated to the IfAPI, so remove the temporary
inclusion of the private structure definition.

Reviewed By: #network, melifaro
Differential Revision: https://reviews.freebsd.org/D39621

show more ...


# 408c909d 04-Sep-2024 Mark Johnston <markj@FreeBSD.org>

ifnet: Remove if_getamcount()

All uses of this function were incorrect. if_amcount is a reference
count which tracks the number of times the network stack internally set
IFF_ALLMULTI. (if_pcount i

ifnet: Remove if_getamcount()

All uses of this function were incorrect. if_amcount is a reference
count which tracks the number of times the network stack internally set
IFF_ALLMULTI. (if_pcount is the corresponding counter for IFF_PROMISC.)

Remove if_getamcount() and fix up callers to get the number of assigned
multicast addresses instead, since that's what they actually want.

Sponsored by: Klara, Inc.
Reviewed by: zlei, glebius
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D46523

show more ...


# aff22541 30-Jul-2024 Konstantin Belousov <kib@FreeBSD.org>

ipsec_accel: consistently provide arguments name in typedefs

Sponsored by: NVidia networking


# 240b7bfe 14-Feb-2024 Konstantin Belousov <kib@FreeBSD.org>

ipsec_offload: offload inner checksums calculations for UDP/TCP/TSO

and allow the interface driver to declare such support.

Sponsored by: NVIDIA networking
Differential revision: https://reviews.fr

ipsec_offload: offload inner checksums calculations for UDP/TCP/TSO

and allow the interface driver to declare such support.

Sponsored by: NVIDIA networking
Differential revision: https://reviews.freebsd.org/D44221

show more ...


# 2131654b 07-Feb-2024 Konstantin Belousov <kib@FreeBSD.org>

sys/net: Add IPSEC_OFFLOAD interface cap and methods structure

Reviewed by: glebius
Sponsored by: NVIDIA networking
Differential revision: https://reviews.freebsd.org/D44314


# 29363fb4 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: 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 s

sys: 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

show more ...


# 2a371643 21-Jul-2023 Justin Hibbits <jhibbits@FreeBSD.org>

IfAPI: Retire if_etherbpfmtap() and if_bpfmtap()

Summary:
These came in the original DrvAPI commits in 2014, and are obsoleted by
bpf_mtap_if() and ether_bpf_mtap_if(). The `_if` suffix, rather tha

IfAPI: Retire if_etherbpfmtap() and if_bpfmtap()

Summary:
These came in the original DrvAPI commits in 2014, and are obsoleted by
bpf_mtap_if() and ether_bpf_mtap_if(). The `_if` suffix, rather than
prefix, conveys that it's operating on the bpf of the interface, instead
than the interface itself.

Reviewed by: glebius
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D41146

show more ...


# 2ff63af9 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


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

netlink: convert to IfAPI.

Convert to IfAPI everything except `IF_AFDATA_WLOCK` usage in neigh.c.

Reviewed By: jhibbits
Differential Revision: https://reviews.freebsd.org/D40577


# 848d5bb1 17-May-2023 Konstantin Belousov <kib@FreeBSD.org>

net/if_var.h: consistently use if_t over struct ifnet *

Reviewed by: jhibbits
Sponsored by: NVidia networking
Differential revision: https://reviews.freebsd.org/D40125


# f766d1d5 10-Apr-2023 Justin Hibbits <jhibbits@FreeBSD.org>

IfAPI: Add if_maddr_empty() to check for any maddrs

if_llmaddr_count() only counts link-level multicast addresses.
hv_netvsc(4) needs to know if there are any multicast addresses. Since
hv_netvsc(4

IfAPI: Add if_maddr_empty() to check for any maddrs

if_llmaddr_count() only counts link-level multicast addresses.
hv_netvsc(4) needs to know if there are any multicast addresses. Since
hv_netvsc(4) is the only instance where this would be used, make it a
simple boolean. If others need a if_maddr_count(), that can be added in
the future.

Reviewed by: melifaro
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39493

show more ...


# 7814374b 07-Apr-2023 Justin Hibbits <jhibbits@FreeBSD.org>

IfAPI: Hide the macros that touch ifnet members

Nothing should be directly touching the ifnet members, which are hidden
in <net/if_private.h>, so hide them in the same header to avoid errors
from us

IfAPI: Hide the macros that touch ifnet members

Nothing should be directly touching the ifnet members, which are hidden
in <net/if_private.h>, so hide them in the same header to avoid errors
from users.

Sponsored by: Juniper Networks, Inc.

show more ...


# 56d4550c 19-Apr-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifnet: factor out interface renaming into a separate function.

This change is required to support interface renaming via Netlink.
No functional changes intended.

Reviewed by: zlei
Differential Revi

ifnet: factor out interface renaming into a separate function.

This change is required to support interface renaming via Netlink.
No functional changes intended.

Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D39692
MFC after: 2 weeks

show more ...


# e2427c69 16-Mar-2023 Justin Hibbits <jhibbits@FreeBSD.org>

IfAPI: Add iterator to complement if_foreach()

Summary:
Sometimes an if_foreach() callback can be trivial, or need a lot of
outer context. In this case a regular `for` loop makes more sense. To
ke

IfAPI: Add iterator to complement if_foreach()

Summary:
Sometimes an if_foreach() callback can be trivial, or need a lot of
outer context. In this case a regular `for` loop makes more sense. To
keep things hidden in the new API, use an opaque `if_iter` structure
that can still be instantiated on the stack. The current implementation
uses just a single pointer out of the 4 alotted to the opaque context,
and the cleanup does nothing, but may be used in the future.

Reviewed by: melifaro
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39138

show more ...


# df2b419a 04-Mar-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifnet: add if_foreach_sleep() to allow ifnet iterations with sleep.

Subscribers: imp, ae, glebius

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


12345678910>>...60