Commit Graph

353 Commits

Author SHA1 Message Date
pooka bd085b2b32 If RUMP_ACTION, treat close() as a rump syscall. 2009-06-02 23:41:35 +00:00
pooka 355dcf3a3b Install agr ioctl header and stop putting our hand under the sys skirt
in ifconfig.
2009-05-26 21:58:31 +00:00
pooka 162ca8ac83 Add compile mode which executes rump system calls. This is useful
when figuring out Where In The Kernel Is Carmen Sandiego's ioctl
for an ifconfig command line, since we can simply single-step into
the kernel.

Activated by "make RUMP_ACTION=1".  No changes to normal case.
2009-05-26 16:03:24 +00:00
dyoung 46db29bcf1 Bring getifaddrs(3) behavior in line with the documentation: the
ifa_data member of every AF_LINK struct ifaddrs points at the
corresponding struct if_data.  In ifconfig(8), do not try to suppress
duplicate AF_LINK ifaddrs by checking for a NULL ifa_data.

Don't copy out two AF_LINK struct ifaddrs for each active link-layer
address. getifaddrs(3) used to copy out one ifaddrs for the kernel's
RTM_IFINFO message, and one more for the kernel's RTM_NEWADDR message.
I suppress the first duplicate with a highly conservative change that
wastes a little bit of ifaddrs storage.  The storage is not leaked.
2009-04-27 20:10:49 +00:00
dyoung 740c7b59d2 To make sure that we always print the active link-layer address in the
'address: ' field, don't treat the first address as the active address,
but search the link-layer addresses for the ones flagged IFLR_ACTIVE,
and print those.  Extract a subroutine, print_link_addresses(), for
printing link-layer addresses.
2009-04-21 22:46:39 +00:00
dyoung ce947d8aa0 Cosmetic: add some whitespace for my ease of reading. 2009-04-21 22:13:10 +00:00
dyoung 5785e48164 There's no use casting a socket address to sockaddr_dl, only to cast it
back to sockaddr, so don't do it.
2009-04-21 21:57:14 +00:00
dyoung 5cd12bc44e Use getnameinfo(3) to render a human-readable link-layer address in the
'address: ' line, just as we do in the 'link xx:xx:...:xx' line.
2009-04-21 21:42:35 +00:00
dyoung 4590553b36 Fix indentation: change spaces to tabs. 2009-04-21 18:00:25 +00:00
lukem ef685eeea9 Enable WARNS=4 by default except for:
dump  dump_lfs  fsck_ffs  fsck_lfs  fsdb  mount_smbfs
	newfs_ext2fs  newfs_lfs  resize_lfs  setkey
2009-04-11 07:58:11 +00:00
joerg f2aa054fbc Remove physical markup. Remove incorrect keep, .Bk is not callable, but
used as such. It doesn't seem to serve any purpose at the point either.
2009-04-08 14:32:05 +00:00
plunky bb505f700b Because the IFF_NOARP flag is a negative option it needs to be negated
when being applied from the "arp" option which itself is positive.

problem demonstrated by

# ifconfig tap3 create
# ifconfig tap3
tap3: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
	address: f2:0b:a4:7f:44:03
	media: Ethernet autoselect
# ifconfig tap3 arp
# ifconfig tap3
tap3: flags=8882<BROADCAST,NOARP,SIMPLEX,MULTICAST> mtu 1500
	address: f2:0b:a4:7f:44:03
	media: Ethernet autoselect
# ifconfig tap3 -arp
# ifconfig tap3
tap3: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
	address: f2:0b:a4:7f:44:03
	media: Ethernet autoselect
# ifconfig tap3 destroy
#
2009-04-04 17:10:19 +00:00
reed b7b9ab25b1 Point to ifmedia(4) more. And refer to -m flag to (for media). 2009-03-27 19:33:22 +00:00
uebayasi a6533b8fed Comment out CFLAGS+=-g. 2009-02-13 16:02:05 +00:00
lukem c6144e484f fix -Wsign-compare issues 2009-01-18 00:24:29 +00:00
tsutsui 09275f2b8b Specify -fno-loop-optimize on m68000 as workaround for gcc -O1 codegen bug
mentioned in PR bin/40036 and PR toolchain/40066.
2008-11-29 15:28:49 +00:00
tsutsui da5d5a9f1c Add RCS Id. XXX why separate Makefile.inc? 2008-11-29 15:23:32 +00:00
wiz 0247fc12f6 Bump date for previous. Remove trailing whitespace.
New sentence, new line. Capitalize Ethernet.
2008-09-30 09:41:41 +00:00
dyoung 7abd58c82d Do not mention the 'ns' address family any longer, since that
support was removed quite a while ago.

Mention the 'link' address family.  Describe the 'active' keyword.
Add examples for adding and activating a link-layer address.
2008-09-29 17:28:07 +00:00
dyoung 83dfe33e66 is@ pointed out that I set the phase and range of a sockaddr_at
without subsequently doing anything with it, so commit_address()
works with an address with phase == 0.  phase == 0 is not allowed,
hence

random84# ifconfig nfe0 atalk 3.14
ifconfig: SIOCAIFADDR: Invalid argument

Solution: copy the new sockaddr_at to a temporary input environment,
and pass that environment to commit_address().  I may as well copy
the new sockaddr_at to the output environment, while I am at it.
2008-08-01 22:44:17 +00:00
dyoung 10b425b514 Extract common code. Create subroutine paddr_prefix_size(). 2008-08-01 22:29:13 +00:00
dyoung 4668b21b50 Always initialize the union of sockaddrs. I used to initialize it
only in the AF_UNSPEC/AF_INET/AF_INET6 cases.  Maybe this will fix
the AF_APPLETALK problem that is@ reports:

random84# ifconfig nfe0 atalk 3.14
ifconfig: SIOCAIFADDR: Invalid argument
2008-08-01 18:05:56 +00:00
lukem 6543a91fea Remove the \n and tabs from the __COPYRIGHT() strings.
(Tweak some to use a consistent format.)
2008-07-20 01:20:21 +00:00
dyoung 723da104d6 Cosmetic: s/xenv/oenv/ 2008-07-15 21:27:58 +00:00
dyoung 95a02c3401 Make usage() static. 2008-07-15 21:19:24 +00:00
dyoung 3e89e7b09b Only describe flags -L and -m in the usage if they are available.
That helps me get rid of some conditional compilation (INET6) in
ifconfig.

Let each protocol/feature-module print its own usage, so that the
ifconfig usage reflects the modules that are actually compiled-in.

Write usage information for carp(4) options.
2008-07-15 20:56:13 +00:00
dyoung d75414adf5 Let us add/remove features from ifconfig, such as support for
various address families (inet, inet6, iso, atalk) and protocols
(802.11, 802.3ad, CARP), simply by trimming the list of sources in
the Makefile.  This helps one customize ifconfig for an embedded
device or for install media, and it eliminates a lot of grotty
#ifdef'age.  Now, the ifconfig syntax and semantics are finalized
at run-time using the constructor routines in each address-family/protocol
module.

(In principle, ifconfig could load virtually all of its syntax from
shared objects.)

Extract a lot of common code into subroutines, in order to shrink
the ifconfig binary a bit.  Make all of the address families share
code for address addition/replacement/removal, and delete "legacy"
code for manipulating addresses.  That may have broken atalk and
iso, despite my best efforts.

Extract an include file, Makefile.inc, containing the make-fu that
both ifconfig and x_ifconfig share.

Sprinkle static.  Change some int's to bool's.  Constify.

Add RCS Ids to carp.c and env.c.  Move media code to a new file,
media.c.  Delete several unneeded header files.

Set, reset, and display the IEEE 802.11 attribute, 'dot11RTSThreshold'.

Bug fix: do not require both a interface address and a destination
address for point-to-point interfaces, but accept a interface
address by itself.
2008-07-02 07:44:13 +00:00
dyoung d46fe4da98 Remove one more struct afswtch.af_getprefix() remnant. 2008-06-03 21:03:27 +00:00
dyoung 31a7bcb871 Remove remnants of struct afswtch.af_getprefix(). 2008-06-03 21:02:49 +00:00
dyoung 89ef65cc34 *Always* pass the prefix mask specified on the command line, even
on an IFF_POINTOPOINT interface.  Patch tested by John Klos and
found to fix the bug he reported on tech-net@, "Subject: Can't use
gif in -current".
2008-06-03 04:59:30 +00:00
dyoung 480fc38f3c Cosmetic: add missing /*FALLTHROUGH*/. 2008-06-02 23:19:16 +00:00
dyoung 5035ceab3b Fix kern/38775, "ifconfig inet delete fails". 2008-05-28 17:17:14 +00:00
dyoung aa10084492 Fix two bugs:
1 Let us associate a keyword with either a signed or an unsigned
  number.  Associate the '-chan' keyword with an unsigned number.
  This fixes the defect that crashed 'ifconfig wi0 -chan', reported
  by Michael van Elst.

2 Do not try to interpret names as ISO addresses unless the ISO
  address family was specified.  iso_addr(3) does not report errors,
  so it appears to interpret *everything* as an ISO address.  This
  is a stopgap fix for the defect in 'ifconfig lo0 inet6' on a
  !INET6 kernel that deletes the first IPv4 address on lo0.
  (Reported by Scott Ellis.)
2008-05-19 18:00:31 +00:00
dyoung 3ebe24aa36 Apply netmasks to !(IFF_BROADCAST|IFF_POINTOPOINT) interfaces as
well as to IFF_BROADCAST interfaces.  Fixes the bug reported by
Markus W Kilbinger,

	ifconfig stf0 inet6 2002:xxxx:76ec:0001::1 prefixlen 16 alias

results in the wrong configuration,

	stf0: flags=1<UP> mtu 1280
		inet6 2002:xxxx:76ec:1::1 prefixlen 64
2008-05-16 20:57:42 +00:00
dyoung 4a04a80d10 The key 'vlantag' activates the 'vlanif' keyword, not the key
'vlan'.  Should fix this bug reported by Pierre Pronchery,

# ifconfig vlan0 vlan 1 vlanif hme0
ifconfig: SIOCAIFADDR: Address family not supported by protocol family
2008-05-16 20:53:35 +00:00
dyoung 76766729c4 Use an AF_LINK socket to add/delete/get link-layer addresses. 2008-05-13 18:10:17 +00:00
dyoung 3361a66d0a Per discussion at
<http://mail-index.netbsd.org/tech-net/2008/04/08/msg000371.html>,
let us add, delete, and activate link-layer addresses with ifconfig:

# ifconfig sip0 link 02:00:00:00:00:01                   [add address]
# ifconfig sip0 link 02:00:00:00:00:02                   [add address]
# ifconfig sip0 link 02:00:00:00:00:02 active            [activate address]
# ifconfig sip0 link 02:00:00:00:00:01 delete            [remove address]
2008-05-12 22:06:13 +00:00
dyoung af8202a3c2 Apply the right copyright notice. 2008-05-12 22:01:32 +00:00
dyoung 85a29f7ecc Fix link-layer address parsing. Add debug statements.
Cosmetic: fix copyright whitespace.
2008-05-12 21:54:51 +00:00
dyoung 8c56a7ef60 Cosmetic: fix copyright whitespace. 2008-05-12 21:53:32 +00:00
dyoung cd86d94cd8 We cannot create an AF_LINK socket. If AF_LINK is requested, create
an AF_INET socket, instead.
2008-05-12 21:52:29 +00:00
dyoung 47bfdf8c0e Make prototype and definition of in_alias() agree: it's static. 2008-05-12 20:59:13 +00:00
dyoung b312223d4e Retire in6_addreq and in6_ridreq, which we do not use in the
commit_address() regime.
2008-05-12 20:58:16 +00:00
dyoung 3f2ce08bf8 Initialize IPv6 addresses and ifreqs with more rigor. Fixes this
bug reported by Matthias Scheler,

# ifconfig sip0 inet6 fdb4:542d:dc11:ec20::1
ifconfig: SIOCAIFADDR_IN6: Invalid argument
# ifconfig sip0 inet6 fdb4:542d:dc11:ec20::1 prefixlen 64
2008-05-12 15:35:50 +00:00
dyoung 0f6386183c setifipdst() is gone, so delete the prototype. #include nothing
(XXX).
2008-05-12 00:40:40 +00:00
dyoung 4279a83897 Add code for parsing link-layer addresses of the form xx:xx:...:xx. 2008-05-12 00:39:18 +00:00
dyoung d3c42f50ae Start to adapt the AppleTalk module to use commit_address(). 2008-05-11 23:28:40 +00:00
dyoung ed29145620 Get rid of sec2str() altogether. 2008-05-11 23:27:32 +00:00
dyoung 50a22265be Don't export in_alias(). Pass in_alias() a more useful template.
Misc. cosmetic changes.  Delete dead code.  Treat the address
preference as int16_t, since that is its real type.
2008-05-11 23:25:46 +00:00
dyoung 42c94b7768 In in6_alias(), instead of repeating the memset()/estrlcpy()/sockaddr_in6
assignment-dance, copy creq to ifr6 before each ioctl().
2008-05-11 22:30:07 +00:00