History log of /freebsd/sbin/ifconfig/ifvlan.c (Results 1 – 25 of 41)
Revision Date Author Comments
# 76df3c57 21-May-2024 Zhenlei Huang <zlei@FreeBSD.org>

ifconfig: Redo fix vlan/vlanproto reconfiguration

When the if_vlan(4) interface has not been fully configured, i.e., a
bare interface without a physical interface associated with it,
retrieving the

ifconfig: Redo fix vlan/vlanproto reconfiguration

When the if_vlan(4) interface has not been fully configured, i.e., a
bare interface without a physical interface associated with it,
retrieving the current settings of it and unconditionally overwriting
`params` will result in losing vlandev settings in `params`. That will
lead to failing to associate the if_vlan(4) interface with the requested
physical interface and the false report 'both vlan and vlandev must be
specified'.

Fix that by checking if the vlan interface has been fully configured.

The basic VLAN test is slightly modified to cover this case.

PR: 279181
Reviewed by: kp
Tested by: Mike Tancsa <mike@sentex.net>
Fixes: b82b8055ad44 ifconfig: fix vlan/vlanproto reconfiguration
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45283

show more ...


# 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


# 701468ba 23-Sep-2023 John Baldwin <jhb@FreeBSD.org>

ifconfig/ifvlan.c: Whitespace fix


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

ifconfig: consistently sort set/clear commands

Sponsored by: The FreeBSD Foundation


# 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 wh

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

show more ...


# 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

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

show more ...


# 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 glo

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

show more ...


# 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


# 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 fir

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

show more ...


# 28b498e6 02-Apr-2023 Zhenlei Huang <zlei@FreeBSD.org>

ifconfig: Improve VLAN identifier parsing

VLAN identifier 0xFFF is reserved. It must not be configured or
transmitted.

Also validate during parsing to prevent potential integer overflow.

Reviewed

ifconfig: Improve VLAN identifier parsing

VLAN identifier 0xFFF is reserved. It must not be configured or
transmitted.

Also validate during parsing to prevent potential integer overflow.

Reviewed by: #network, melifaro
Fixes: c7cffd65c5d85 Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39282

show more ...


# b82b8055 18-Jul-2022 Kristof Provost <kp@FreeBSD.org>

ifconfig: fix vlan/vlanproto reconfiguration

The setvlantag() and setvlanproto() functions are used in two scenarios:
when we create a new vlan interface and when we update an existing
interface.
Th

ifconfig: fix vlan/vlanproto reconfiguration

The setvlantag() and setvlanproto() functions are used in two scenarios:
when we create a new vlan interface and when we update an existing
interface.
These are distinguished by the getvlan() at the end of the functions. If
this fails we assume that is because the interface doesn't exist (so
we're creating a new one). We only update the 'params' struct, and
expect the settings to be applied when we vlan_create().

However, if we're updating an existing interface we do not retrieve the
current settings, and can end up invalidating settings.

Fix this by using the settings we retrieved while checking which
scenario we're in.

Note that we do not address this for setvlandev(), because if_vlan does
not allow the vlan parent device to be changed without disassociating it
first (with ifconfig vlanX -vlandev).

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35848

show more ...


# 656f5031 29-Jan-2022 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: remove debug printf introduced in 779fd0534466

Reported by: jhb


# 779fd053 17-Jan-2022 Alexander V. Chernikov <melifaro@FreeBSD.org>

ifconfig: improve vlan options parsing

PR: 261136
Reported by: Daniel O'Connor
MFC after: 2 weeks


# b84d0aaa 19-Jan-2021 Allan Jude <allanjude@FreeBSD.org>

ifconfig: add vlanproto "qiniq" as an alias for "802.1ad"

QinQ is better known by this name, so accept it as an alias

Reported-by: Mike Geiger
Reviewed-by: melifaro, hselasky, rpokala
MFC-with: 366

ifconfig: add vlanproto "qiniq" as an alias for "802.1ad"

QinQ is better known by this name, so accept it as an alias

Reported-by: Mike Geiger
Reviewed-by: melifaro, hselasky, rpokala
MFC-with: 366917
Sponsored-by: Klara Inc.
Differential-Revision: https://reviews.freebsd.org/D28245

show more ...


# 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) ifco

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

show more ...


# c7cffd65 21-Oct-2020 Alexander V. Chernikov <melifaro@FreeBSD.org>

Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q).

802.1ad interfaces are created with ifconfig using the "vlanproto" parameter.
Eg., the following creates a 802.1Q VLAN (id #42) over a 802.1

Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q).

802.1ad interfaces are created with ifconfig using the "vlanproto" parameter.
Eg., the following creates a 802.1Q VLAN (id #42) over a 802.1ad S-VLAN
(id #5) over a physical Ethernet interface (em0).

ifconfig vlan5 create vlandev em0 vlan 5 vlanproto 802.1ad up
ifconfig vlan42 create vlandev vlan5 vlan 42 inet 10.5.42.1/24

VLAN_MTU, VLAN_HWCSUM and VLAN_TSO capabilities should be properly
supported. VLAN_HWTAGGING is only partially supported, as there is
currently no IFCAP_VLAN_* denoting the possibility to set the VLAN
EtherType to anything else than 0x8100 (802.1ad uses 0x88A8).

Submitted by: Olivier Piras
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D26436

show more ...


# df57947f 18-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

spdx: initial adoption of licensing ID tags.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensou

spdx: initial adoption of licensing ID tags.

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.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes: yes
Differential Revision: https://reviews.freebsd.org/D13133

show more ...


# 2ccbbd06 06-Jun-2016 Marcelo Araujo <araujo@FreeBSD.org>

Add support to priority code point (PCP) that is an 3-bit field
which refers to IEEE 802.1p class of service and maps to the frame
priority level.

Values in order of priority are: 1 (Background (low

Add support to priority code point (PCP) that is an 3-bit field
which refers to IEEE 802.1p class of service and maps to the frame
priority level.

Values in order of priority are: 1 (Background (lowest)),
0 (Best effort (default)), 2 (Excellent effort),
3 (Critical applications), 4 (Video, < 100ms latency),
5 (Video, < 10ms latency), 6 (Internetwork control) and
7 (Network control (highest)).

Example of usage:
root# ifconfig em0.1 create
root# ifconfig em0.1 vlanpcp 3

Note:
The review D801 includes the pf(4) part, but as discussed with kristof,
we won't commit the pf(4) bits for now.
The credits of the original code is from rwatson.

Differential Revision: https://reviews.freebsd.org/D801
Reviewed by: gnn, adrian, loos
Discussed with: rwatson, glebius, kristof
Tested by: many including Matthew Grooms <mgrooms__shrew.net>
Obtained from: pfSense
Relnotes: Yes

show more ...


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

Replace N #defines with nitems to simplify ifconfig code slightly

MFC after: 1 week


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

Stop including if_var.h from userland.

Sponsored by: Nginx, Inc.


# 9b776960 17-Dec-2011 Bjoern A. Zeeb <bz@FreeBSD.org>

Allow toggling of IFCAP_VLAN_HWCSUM for hardware that supports checksum
offloading on vlans and document the new option.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation


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

Add TSO support on VLAN in fconfig(8).

Reviewed by: thompsa


# 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.


# 9c1fd0b0 27-Feb-2009 Rui Paulo <rpaulo@FreeBSD.org>

Replace clone_setcallback() with a new function clone_setdefcallback()
that selects a callback from an interface prefix name. This allows us to
report a meaningful error when the user types 'ifconfig

Replace clone_setcallback() with a new function clone_setdefcallback()
that selects a callback from an interface prefix name. This allows us to
report a meaningful error when the user types 'ifconfig wlan0 create',
for example, and also kills some redundant code.

Reviewed by: sam (earlier version)

show more ...


# 67207b69 15-Dec-2008 Sam Leffler <sam@FreeBSD.org>

back out unintended change


12