Commit Graph

148 Commits

Author SHA1 Message Date
Will Andrews
c3582a1967 Make ``ifconfig -l ether'' only list interfaces that speak Ethernet.
PR:		118987
Approved by:	ken (mentor)
2009-11-25 00:00:57 +00:00
Xin LI
1a9d4dda9b Revert revision 199201 for now as it has introduced a kernel vulnerability
and requires more polishing.
2009-11-12 19:02:10 +00:00
Xin LI
41c8c6e876 Add interface description capability as inspired by OpenBSD.
MFC after:	3 months
2009-11-11 21:30:58 +00:00
Bjoern A. Zeeb
00dc5f8e66 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)
2009-07-26 11:25:57 +00:00
Jamie Gritton
5061de23fa Add the "vnet" and "-vnet" options, to allow moving interfaces between
jails with VIMAGE.

Approved by:	bz (mentor)
2009-06-24 18:21:37 +00:00
Xin LI
b59dcaeeb3 - Use size_t instead of int when appropriate;
- Use C99 sparse initialization.

With these changes ifconfig(8) is WARNS=2 clean.
2009-06-23 23:49:52 +00:00
Robert Watson
31b2ac28c9 ifconfig(8) no longer needs to know how to print the IFF_NEEDSGIANT flag,
since it shortly won't be defined at all.
2009-04-18 20:10:39 +00:00
Jamie Gritton
a9948a71cf 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)
2009-03-15 22:33:18 +00:00
Sam Leffler
fab0828067 use correct interface name when setting flags; fixes ifconfig ... create ... up
Noticed by:	Chris Anderson
2009-01-14 22:55:49 +00:00
Sam Leffler
39669258d7 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
2008-09-29 16:27:32 +00:00
Jack F Vogel
eafbb00d24 Add support in ifconfig to control the vlan hardware filter feature.
Reviewed by: EvilSam and moi
MFC after:1 week
2008-08-28 22:13:44 +00:00
Andrew Thompson
3b0edf7dd0 Move the grekey to its own file, ifconfig.c does not have interface specific
code.

Submitted by:	sam
2008-08-03 03:36:12 +00:00
Andrew Thompson
131c55bc5b Add support for the optional key in the GRE header.
PR:		kern/114714
Submitted by:	Cristian KLEIN
2008-06-20 17:26:34 +00:00
Sam Leffler
2fa02c5fb7 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
2008-03-31 15:38:07 +00:00
Sam Leffler
de0abf19ba Wake On Lan (WOL) infrastructure
Submitted by:	Stefan Sperling <stsp@stsp.name>
Reviewed by:	brooks
2007-12-10 02:31:00 +00:00
Andrew Thompson
265e8a9acc 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)
2007-10-04 09:45:41 +00:00
Robert Watson
0cae11b9cc 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>
2007-06-13 18:07:59 +00:00
Andre Oppermann
a6575bfc2d Add reporting and toggling of TCP LRO (large receive offload) support to
ifconfig(8).
2007-06-11 20:15:20 +00:00
Andrew Thompson
a389ab003f 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.
2007-05-22 17:41:09 +00:00
Yaroslav Tykhiy
f013cfc544 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.
2007-03-24 20:26:54 +00:00
Yaroslav Tykhiy
a40fb996ae 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.
2007-03-12 13:08:56 +00:00
Sam Leffler
e5f015499d o consistently check strlcpy result
o warn when we skip an interface because it's name is too long
2007-02-27 17:11:18 +00:00
Sam Leffler
0b28f08125 correct type to silence const complaint 2007-02-27 17:03:22 +00:00
Sam Leffler
30705853b0 unbreak create operation, must copy argument to global name
Spotted by:	des
2007-02-27 17:00:59 +00:00
Sam Leffler
cb8c905ae9 use getifaddrs from libc instead of private code
Reviewed by:	bms
MFC after:	1 month
2007-02-24 23:55:46 +00:00
Bjoern A. Zeeb
3ca72aeb09 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.
2006-12-29 18:44:04 +00:00
Andre Oppermann
6b92a00668 In setifcap() only set/unset those capabilities the interface actually
supports.
2006-09-20 15:38:37 +00:00
Andre Oppermann
581d6e4ca7 Fix octal representation of TSO4 and TSO6 bits in interface capabilities
description.
2006-09-08 13:29:38 +00:00
Andre Oppermann
d7097da403 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
2006-09-06 22:07:14 +00:00
Sam Leffler
db82353d87 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
2006-07-09 06:10:23 +00:00
Gleb Smirnoff
193af8d25e There is no IFF_POLLING flag anymore. 2006-03-12 14:00:15 +00:00
Gleb Smirnoff
5dc27bc63b Recognize new VLAN_HWCSUM flag. 2006-01-30 14:04:30 +00:00
Yaroslav Tykhiy
c21a88e7f8 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
2006-01-30 13:37:34 +00:00
Yaroslav Tykhiy
9e241c5ef2 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
2005-09-29 23:53:29 +00:00
Robert Watson
b7eb47e290 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
2005-07-14 18:33:21 +00:00
Yaroslav Tykhiy
2eb9396fb7 Add symbolic names for the IFF_PPROMISC and IFF_NEEDSGIANT flags
so that ifconfig(8) can print them.

MFC after:	5 days
2005-07-13 21:23:40 +00:00
Sam Leffler
eb2a391f14 guard against bogus address data
Submitted by:	Bakul Shah
2005-05-20 03:58:53 +00:00
Stefan Farfeleder
c508bf7a54 ISO C does not allow unnamed union members. 2005-04-08 21:37:41 +00:00
Stefan Farfeleder
77a9f6dd96 Fix typo in comment. 2005-04-08 21:31:20 +00:00
Sam Leffler
90c4b74cbe 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.
2004-12-31 19:46:27 +00:00
Sam Leffler
58ac5e5b7a add a callback mechanism for code that wants to defer committing changes
until all the command line args have been processed

Reviewed by:	ambrisko
2004-12-11 02:33:33 +00:00
Sam Leffler
5faf8dcb55 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
2004-12-08 19:18:07 +00:00
Brooks Davis
9e734b4468 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
2004-09-01 18:22:14 +00:00
Pyun YongHyeon
a740f6ee14 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
2004-08-09 03:13:57 +00:00
Yaroslav Tykhiy
e82866fea6 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.
2004-07-26 13:25:45 +00:00
Doug Ambrisko
41b0ee744a 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
2004-04-30 22:34:12 +00:00
Luigi Rizzo
0b46c08590 Replace ROUNDUP/ADVANCE with SA_SIZE 2004-04-13 11:24:43 +00:00
Ruslan Ermilov
3a3b019aeb Added the new interface capability option for drivers that implement
user-configurable polling(4) support.  Make ifconfig(8) aware of it.

Suggested by:	luigi
2004-04-11 13:36:52 +00:00
Mark Murray
4c723140a4 Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp
2004-04-09 19:58:40 +00:00
Sam Leffler
a6b03f428a add support for setting 802.11 rtsthreshold, transmit power,
and 11g protection mode

Reviewed by:	imp (just code)
2004-03-30 22:59:22 +00:00