Commit Graph

398 Commits

Author SHA1 Message Date
joerg e240adbd0b Retire OSI network stack. OK core@ 2013-03-01 18:25:13 +00:00
apb 819da78f2e Abort on error from prop_dictionary_augment. 2013-02-07 13:21:34 +00:00
apb acc2342d2c Avoid dereferencing NULL. Coverity CID 275201.
Also fix a typo in previous: !== should be !=
2013-02-07 13:20:51 +00:00
apb beb9ef8fe5 Don't call prop_distionary_make_immutable on a NULL pointer.
Coverity CID 275179.
2013-02-07 11:24:15 +00:00
christos 17cb1d718c fix function name in error messages. 2012-12-30 22:52:35 +00:00
christos 082a5b2911 PR/46579: Takahiro HAYASHI: ifconfig clone destroy should not print useless
diagnostic and exit with an error code. Get the interface name and flags
opportunistically to allow the code to return normally if it does not need
to do anything.
2012-12-30 22:50:42 +00:00
pgoyette 52dd3d0558 Use snprintb_m(3) to split flags/capabilities/enabled across multiple
output lines.

As discussed on current-users
2012-11-01 13:43:23 +00:00
msaitoh bbc956a9be Add SIOCGETHERCAP ioctl.
There was no way to know the setting of ec_capabilities and ec_capenable
other than grepping the source.

See http://mail-index.netbsd.org/tech-kern/2010/07/28/msg008613.html
2012-10-31 10:17:34 +00:00
christos 54abeff8fd don't define RUMP_ACTION if MKRUMP = no 2012-08-08 14:10:38 +00:00
christos c583007244 PR/43141: Tobias Nygren: Print an error on unknown interfaces. 2012-03-17 02:25:08 +00:00
mbalmer 28c55e99d7 When ifconfig is invoked without any arguments, display the list of
all network interfaces (equivalent to ifconfig -a), instead of displaying
the usage.  (This is consistent with the behaviour on FreeBSD and OpenBSD.)
2012-01-28 15:01:44 +00:00
joerg baa8e84b6f Use __dead 2011-08-29 14:34:58 +00:00
christos f5bc231029 use memcpy to avoid strict aliasing warnings 2011-08-14 12:15:15 +00:00
mrg c111245a78 apply some -Wno-error and/or -fno-strict-aliasing.
all of this should be looked at closer, but some of them are not
very trivial.
2011-06-22 02:49:41 +00:00
riastradh 63cdfaffb6 Fix typo: `symbolically' takes three l's, not two. 2011-05-31 16:17:30 +00:00
joerg b1162954df Don't use address strings as format string. 2011-05-24 11:38:56 +00:00
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