Commit Graph

382 Commits

Author SHA1 Message Date
pooka 72e657672d A few weeks ago when i added "linkstr" support I didn't know that
the string parser gives a proplib object which isn't a terminated
string.  Fix that mistake now.
2010-12-14 10:51:51 +00:00
pooka 67a4f392d8 use crunchops for crunchables 2010-12-13 21:48:01 +00:00
njoly 6c19f9ea7b op_read return value is a ssize_t, not an int. 2010-12-13 19:17:20 +00:00
pooka a415ef09e9 Convert from the .ifdef RUMP_ACTION stuff to RUMPPRG. 2010-12-13 17:35:08 +00:00
pooka 6f2301fb3c Implement ifconfig linkstr as proposed on tech-net. 2010-11-15 22:42:36 +00:00
pooka 2ddc760fc7 Need getifaddrs() for the rump client since it executes sysctl(2) 2010-11-05 16:23:56 +00:00
pooka 7d1c54af24 adapt to new rumpclient_init() signature 2010-11-05 13:52:41 +00:00
pooka 23c2b7b527 Update RUMP_ACTION to use the newstyle rump client. 2010-11-04 23:31:12 +00:00
dyoung aa9db6efb2 Add to the string parse object (pstr), and its constructors, a flag that
tells whether it should detect and convert to binary a hexadecimal octet
string of the form 0x0123ABab, or leave those strings undecoded.

If the argument for a 'media', 'mediamode', 'mediaopt', '-mediaopt',
'nwkey', or 'bssid' keyword is a hexadecimal octet string, do not detect
and decode it.  (Note that setifnwkey decodes hexadecimal strings on its
own.)

This fixes a bug noticed by Jim Miller where the trailing zero-octets
were discarded from hexadecimal octet-string arguments for 'nwkey'.
2010-07-01 16:44:05 +00:00
dyoung de51d12924 Apparently, -g belongs in the DBG variable, not in CFLAGS. Make it so
on a line that is commented-out in this makefile.
2010-07-01 16:28:21 +00:00
dyoung 83fdd687cf Change a > to a >= to avoid writing to the character after the end of
the buffer passed to get_string().
2010-07-01 16:12:23 +00:00
plunky a5a749a5f7 C99 says that offsetof() expands to a constant expresssion, so we
can't use variable array index in there. Do the calculation manually
for C99 compilers (pcc)
2010-04-20 21:25:25 +00:00
is c41a4b460e Use getnameinfo() for printing AppleTalk addresses. While here, fix
printing of broadcast for this address family (AT broadcast is fixed
node 255 on the local net).
2010-01-30 18:30:33 +00:00
dyoung 6abb73d262 Compare a pointer with NULL instead of testing its "truth." 2010-01-22 23:50:07 +00:00
tsutsui aa68f4ed1a - no space needed between -I and dir per gcc(1)
- it's still better to use ${NETBSDSRCDIR} per other existing Makefiles
2009-09-16 15:08:29 +00:00
tsutsui d60368466f Add comments that Makefile.inc should have shared stuff with
src/distrib/utils/x_ifconfig for install media.
2009-09-16 14:59:45 +00:00
he ad8225c04b Move the addition of pfsync.c from Makefile.inc to Makefile,
so that this part doesn't get included in install media versions
of ifconfig, as per comments on source-changes@ from Izumi Tsutsui.
Also re-instate the use of ${.CURDIR} when setting up the include path.
2009-09-15 09:22:07 +00:00
he 4cf3355067 Change from using ${.CURDIR} to ${NETBSDSRCDIR} because this file
may be included by different parts of the source tree, in particular
deep down in the distrib/ tree, where ../.. isn't sufficient to "climb"
up to the top of the tree.  Fixes the build at least for our arc port.
2009-09-14 15:12:21 +00:00
degroote 2d48ac808c Import pfsync support from OpenBSD 4.2
Pfsync interface exposes change in the pf(4) over a pseudo-interface, and can
be used to synchronise different pf.

This work was part of my 2009 GSoC

No objection on tech-net@
2009-09-14 10:36:48 +00:00
dyoung 230fd8c662 This should fix 'carpdev <ifname>' or, at least, not break it more
badly than before.
2009-09-11 23:22:28 +00:00
dyoung c5d5f7697a Make ifconfig(8) set and display preference numbers for IPv6
addresses.  Make the kernel support SIOC[SG]IFADDRPREF for IPv6
interface addresses.

In in6ifa_ifpforlinklocal(), consult preference numbers before
making an otherwise arbitrary choice of in6_ifaddr.  Otherwise,
preference numbers are *not* consulted by the kernel, but that will
be rather easy for somebody with a little bit of free time to fix.

Please note that setting the preference number for a link-local
IPv6 address does not work right, yet, but that ought to be fixed
soon.

In support of the changes above,

1 Add a method to struct domain for "externalizing" a sockaddr, and
  provide an implementation for IPv6.  Expect more work in this area: it
  may be more proper to say that the IPv6 implementation "internalizes"
  a sockaddr.  Add sockaddr_externalize().

2 Add a subroutine, sofamily(), that returns a struct socket's address
  family or AF_UNSPEC.

3 Make a lot of IPv4-specific code generic, and move it from
  sys/netinet/ to sys/net/ for re-use by IPv6 parts of the kernel and
  ifconfig(8).
2009-09-11 22:06:29 +00:00
dyoung fcabb0789a Describe the -N flag. 2009-08-07 20:13:12 +00:00
dyoung ae9b1bdb85 Use getnameinfo(3) instead of inet_ntoa(3) to convert IPv4 addresses
to names.
2009-08-07 19:35:55 +00:00
dyoung ab7c5957a9 Add option -N. -N is just the opposite of option -n in netstat(8)
or route(8): it tells ifconfig(8) to try to resolve numbers to
hosts and service names.

This default ifconfig behavior stays the same as it always was.
2009-08-07 18:53:37 +00:00
hubertf 270beabd82 Add "MAC" keyword to the corresponding example. 2009-07-29 21:47:11 +00:00
dyoung 854940045a Don't require a "vlan" argument with "-vlanif". "ifconfig vlan0
-vlanif" works as one would expect, now.
2009-07-28 18:22:33 +00:00
dyoung 183dffe7f4 Both carp.c and vlan.c expect for a keyword with a KW_T_STR-type
value to put a prop_string_t into the environment, but the keyword
parser put a prop_data_t into the environment, instead.  That broke
the -vlanif and -carpdev keywords and defied developer expectations.
Let's put a prop_string_t into the environment.

Thanks to Arnaud Degroote for reporting the problem.
2009-07-28 18:21:06 +00:00
dyoung 9044aa4f92 Use the keyword 'MAC' so that people looking for a way to change
their MAC address can find the example.
2009-07-02 18:43:47 +00:00
dyoung 53e43e1e70 Deprecate wiconfig's -r, -g, -m options. Note that equivalent
options are available in ifconfig(8).
2009-07-02 17:45:25 +00:00
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