History log of /src/sbin/ifconfig/af_inet.c |
Revision | | Date | Author | Comments |
1.28 |
| 14-May-2020 |
msaitoh | Remove extra semicolon.
|
1.27 |
| 10-Apr-2020 |
plunky | trim extraneous return statement
|
1.26 |
| 16-Aug-2019 |
msaitoh | Whitespace fix.
|
1.25 |
| 11-Jun-2018 |
kamil | branches: 1.25.2; Correct Undefined Behavior in ifconfig(8)
Unportable left shift reported with MKSANITIZER=yes USE_SANITIZER=undefined:
# ifconfig alc0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 ec_capabilities=3<VLAN_MTU,VLAN_HWTAGGING> ec_enabled=0 address: xx:xx:xx:xx:xx:xx /public/src.git/sbin/ifconfig/af_inet.c:102:34: runtime error: left shift of 16777215 by 8 places cannot be represented in type 'int' inet 192.168.0.38/24 broadcast 192.168.0.255 flags 0x0 inet6 xxxx::xxxx:xxxx:xxxx:xxx%alc0/64 flags 0x0 scopeid 0x1 lo0: flags=0x8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33624 inet 127.0.0.1/8 flags 0x0 inet6 ::1/128 flags 0x20<NODAD> inet6 fe80::1%lo0/64 flags 0x0 scopeid 0x2
Change shifting left 1 to shifting 1U. This corrects the issue.
if (cidr < 32) { /* more than 1 bit in mask */ /* check for non-contig netmask */ if ((mask ^ (((1 << cidr) - 1) << (32 - cidr))) != 0) // <- here return -1; /* noncontig, no pfxlen */ }
Solution suggested by <uwe>
Sponsored by <The NetBSD Foundation>
|
1.24 |
| 01-Oct-2016 |
kre | branches: 1.24.12;
Return to printing explicit "netmask 0x...." in the case that the mask set is non-contiguous. We don't prohibit setting such things (even if they are basically useless) so they can be set by accident. ifconfig ifN 10.0.0.1 netmask 225.0.0.0 produced ifN .. inet 10.0.0.1/8 with the previous form (since 225 is 0xE1), now it produces ifN ... inet 10.0.0.1 netmask 0xe1000000
If the "netmask" form ever appears in ifconfig output, it (now) means that the netmask is non-contig, which should make that case obvious (whther intended, or set by accident)
|
1.23 |
| 01-Oct-2016 |
roy | 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.
|
1.22 |
| 30-Sep-2016 |
roy | Remove the alias keyword from ifconfig output as it serves no purpose.
|
1.21 |
| 30-Sep-2016 |
roy | ifaddrs has more data than just the address. Use it instead of making pointless ioctl calls.
|
1.20 |
| 13-Sep-2016 |
christos | print address flag bits using snprintb
|
1.19 |
| 29-Feb-2016 |
riastradh | branches: 1.19.2; Consistently use estrlcpy for ifr.ifr_name here, not strncpy.
|
1.18 |
| 07-Jan-2016 |
roy | -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.
|
1.17 |
| 12-May-2015 |
roy | ioctl -> prog_ioctl as pointed out by pooka@
|
1.16 |
| 02-May-2015 |
roy | Report IN_IFF_TENTATIVE and friends. Wait for IN_IFF_TENTATIVE to be removed with the -w flag.
|
1.15 |
| 13-Dec-2010 |
pooka | Convert from the .ifdef RUMP_ACTION stuff to RUMPPRG.
|
1.14 |
| 11-Sep-2009 |
dyoung | 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).
|
1.13 |
| 07-Aug-2009 |
dyoung | Use getnameinfo(3) instead of inet_ntoa(3) to convert IPv4 addresses to names.
|
1.12 |
| 02-Jul-2008 |
dyoung | 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.
|
1.11 |
| 12-May-2008 |
dyoung | Make prototype and definition of in_alias() agree: it's static.
|
1.10 |
| 11-May-2008 |
dyoung | 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.
|
1.9 |
| 11-May-2008 |
dyoung | 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().
|
1.8 |
| 08-May-2008 |
dyoung | Move IPv4/IPv6-specific code from commit_address() to in_commit_address() and in6_commit_address(). Fixes the USE_INET6=no build.
|
1.7 |
| 06-May-2008 |
dyoung | branches: 1.7.2; 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).
|
1.6 |
| 06-May-2008 |
dyoung | 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.
|
1.5 |
| 13-Nov-2006 |
dyoung | branches: 1.5.18; 1.5.20; 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.
|
1.4 |
| 26-Aug-2006 |
christos | Programs that use efun.
|
1.3 |
| 16-Jun-2006 |
elad | fix incorrect usage of strncpy() to (an internal implementation of) estrlcpy().
okay christos
|
1.2 |
| 14-Jun-2006 |
tron | 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.
|
1.1 |
| 20-Mar-2005 |
thorpej | Split the IPv4 support into its own file.
|
1.5.20.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.5.18.2 |
| 28-Sep-2008 |
mjf | Sync with HEAD.
|
1.5.18.1 |
| 02-Jun-2008 |
mjf | Sync with HEAD.
|
1.7.2.2 |
| 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.7.2.1 |
| 23-Jun-2008 |
wrstuden | Sync w/ -current. 34 merge conflicts to follow.
|
1.19.2.1 |
| 04-Nov-2016 |
pgoyette | Sync with HEAD
|
1.24.12.1 |
| 25-Jun-2018 |
pgoyette | Sync with HEAD
|
1.25.2.1 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|