History log of /freebsd-10-stable/sbin/ifconfig/ifclone.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 368505 10-Dec-2020 hselasky

Fix bug in ifconfig regarding VLAN creation.

Detection of VLAN interface type must happen before detection of
interface type by prefix. Else the following sequence of commands will
try to create a LAGG interface instead of a VLAN interface, which
accidentially works, because the data pointed to by the ifr_data
pointer is not parsed by the VLAN create ioctl(2).

How to reproduce:
# ifconfig lagg0 create
# ifconfig lagg0.256 create

This is a direct commit.

Differential Revision: https://reviews.freebsd.org/D27521
Tested by: raul.munoz@custos.es
Sponsored by: Mellanox Technologies // NVIDIA Networking


# 319265 30-May-2017 asomers

MFC r317755, r317758

r317755:
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
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10587

r317758:
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
X-MFC-With: 317755
Sponsored by: Spectra Logic Corp


# 300285 20-May-2016 truckman

MFC r299873

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


# 296425 06-Mar-2016 kp

MFC r295836:
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)

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


# 289986 26-Oct-2015 ngie

MFC r288305:

Replace N #defines with nitems to simplify ifconfig code slightly


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 194799 23-Jun-2009 delphij

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

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


# 189864 15-Mar-2009 jamie

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)


# 189096 26-Feb-2009 rpaulo

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)


# 177799 31-Mar-2008 sam

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


# 161248 12-Aug-2006 yar

Restore the "plumb" compatibility command, which was lost
due to the recent change by sam@ to clone operations in ifconfig(8).


# 160196 09-Jul-2006 sam

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


# 138593 08-Dec-2004 sam

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