Commit Graph

39 Commits

Author SHA1 Message Date
msaitoh 5ae436aa7e Whitespace fix. 2019-08-16 10:33:17 +00:00
roy 5174f725c2 Modernise the output for the address to address/prefix instead
of differring outputs for INET and INET6.
The hex string of the INET netmask was particulary hard to read.
2016-10-01 15:10:58 +00:00
roy d55c25711c ifaddrs has more data than just the address.
Use it instead of making pointless ioctl calls.
2016-09-30 16:47:56 +00:00
christos 448df9d70c print address flag bits using snprintb 2016-09-13 00:20:51 +00:00
riastradh ab04408fa8 Consistently use estrlcpy for ifr.ifr_name here, not strncpy. 2016-02-29 16:23:25 +00:00
roy 74efc0b2e3 -W seconds will wait for the detached flag to clear on addresses on
interfaces marked up to allow time for the carrier to appear on the
interface.

This does not extend the -w option duration.
2016-01-07 11:32:21 +00:00
roy e0cc834e99 ioctl -> prog_ioctl as pointed out by pooka@ 2015-05-12 14:05:29 +00:00
roy a7a37fb042 Move the INET6 specific code for wait_dad_exec() into af_inet6
by using a new afswtch hook af_addr_tentative.
2015-04-22 17:42:22 +00:00
roy 9fbc750691 Display the IPv6 address flags autoconf and temporary 2015-01-20 22:13:19 +00:00
roy 38d2e3f021 Remove the ability for userland to toggle IN6_IFF_TENTATIVE.
Preserve IN6_IFF_TENTATIVE when updating address flags.
2014-10-20 14:50:09 +00:00
christos 730b60ec52 use symbolic flags 2013-10-19 15:50:26 +00:00
christos 0dd81edd01 use the new scopeid functions 2013-10-19 00:35:30 +00:00
pooka a415ef09e9 Convert from the .ifdef RUMP_ACTION stuff to RUMPPRG. 2010-12-13 17:35:08 +00:00
dyoung 6abb73d262 Compare a pointer with NULL instead of testing its "truth." 2010-01-22 23:50:07 +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 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
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 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 ed29145620 Get rid of sec2str() altogether. 2008-05-11 23:27:32 +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
dyoung 16f748ab9d Delete unused array sin6tab[]. Delete unnecessary casts. 2008-05-11 22:18:20 +00:00
dyoung 3df1d7792b Delete dead code in sec2str(). 2008-05-11 22:16:29 +00:00
dyoung 8ae5a779c6 Retire some code that in6_commit_address() replaces. 2008-05-11 22:12:04 +00:00
dyoung 503d41a97f Let the address family modules zero initialize their own ifreqs,
instead of zeroing them in commit_address().

Switch to in6_commit_address() from in6_getprefix() and in6_getaddr().

Temporarily add some debugging code to setia6eui64_impl().
2008-05-11 22:07:23 +00:00
dyoung 44e2875450 Move IPv4/IPv6-specific code from commit_address() to in_commit_address()
and in6_commit_address().  Fixes the USE_INET6=no build.
2008-05-08 07:13:20 +00:00
dyoung 71b48a4b36 Move IPv6 syntax to af_inet6.c from ifconfig.c. Move IFKW() macro
from ifconfig.c to parse.h for reuse.
2008-05-07 21:29:27 +00:00
dyoung ed7181ed99 Fix a bug that I introduced in rev 1.88, where the default IPv6
prefix length changed from 64 to 128.  While I am here, allow an
address to be given with prefix length /0, but interpret it as
/128.
2008-05-07 18:08:30 +00:00
dyoung fac0aeb0a0 Use prop_dictionary_util(3). 2008-05-06 21:13:20 +00:00
dyoung 32cf2beed0 Rename in_addr_commit() to commit_address(), and refactor slightly
to support IPv6 as well as IPv4 (a work in progress).

Make the second argument of af_status() a bool instead of an int.

Exit early with an error if the operator specifies an unsupported
address family on the command line.  The change should help rc
scripts to detect that IPv6 support is missing from the kernel,
with 'ifconfig lo0 inet6'.

Start using prop_dictionary_util(3).
2008-05-06 16:15:17 +00:00
dyoung 7b01455a0e Overhaul ifconfig. Use fewer global variables. Take a leap toward
improved modularity and extensibility.

In the new architecture, a directed graph of argument-matching
objects (match objects) expresses the set of feasible ifconfig
statements.  Match objects are labelled by subroutines that provide
the statement semantics.

Many IPv4, IPv6, 802.11, tunnel, and media configurations have been
tested.

AppleTalk, ISO, carp(4), agr(4), and vlan(4) configuration need
testing.
2008-05-06 04:33:42 +00:00
dyoung 52440afe4e Don't cast memset(3) to void. Remove a needless cast to struct
in6_addr *.
2008-04-24 05:29:40 +00:00
dyoung 499909306a Use static initializers to setup ISO and IPv6 addresses, instead
of calling protocol family-specific routines from main().
2008-04-15 22:24:37 +00:00
christos 2a1607d040 Programs that use efun. 2006-08-26 18:14:28 +00:00
elad d10cf99230 fix incorrect usage of strncpy() to (an internal implementation of)
estrlcpy().

okay christos
2006-06-16 23:48:35 +00:00
tron 2ab5da17ce Adapt ifconfig(8) to new return value from socket(2). This stops
ifconfig(8) from printing errors like "ifconfig: socket: Address
family not supported by protocol family" when examining the status
of a network interface.
2006-06-14 11:05:42 +00:00
thorpej d14cc8f89c Remove an #ifdef that is no longer necessary. 2005-03-20 02:44:50 +00:00
thorpej 26dbe00d59 Split IPv6 support out into its own file. 2005-03-20 01:09:16 +00:00