Commit Graph

15 Commits

Author SHA1 Message Date
pooka a415ef09e9 Convert from the .ifdef RUMP_ACTION stuff to RUMPPRG. 2010-12-13 17:35:08 +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 ae9b1bdb85 Use getnameinfo(3) instead of inet_ntoa(3) to convert IPv4 addresses
to names.
2009-08-07 19:35:55 +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 47bfdf8c0e Make prototype and definition of in_alias() agree: it's static. 2008-05-12 20:59:13 +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 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 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 a25eaede91 Add a source-address selection policy mechanism to the kernel.
Also, add ioctls SIOCGIFADDRPREF/SIOCSIFADDRPREF to get/set preference
numbers for addresses.  Make ifconfig(8) set/display preference
numbers.

To activate source-address selection policies in your kernel, add
'options IPSELSRC' to your kernel configuration.

Miscellaneous changes in support of source-address selection:

        1 Factor out some common code, producing rt_replace_ifa().

        2 Abbreviate a for-loop with TAILQ_FOREACH().

        3 Add the predicates on IPv4 addresses IN_LINKLOCAL() and
          IN_PRIVATE(), that are true for link-local unicast
          (169.254/16) and RFC1918 private addresses, respectively.
          Add the predicate IN_ANY_LOCAL() that is true for link-local
          unicast and multicast.

        4 Add IPv4-specific interface attach/detach routines,
          in_domifattach and in_domifdetach, which build #ifdef
          IPSELSRC.

See in_getifa(9) for a more thorough description of source-address
selection policy.
2006-11-13 05:13:38 +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 e00adb14b6 Split the IPv4 support into its own file. 2005-03-20 02:43:50 +00:00