Permalink
Browse files

OpenBSD 2.8

  • Loading branch information...
1 parent 5dcffb7 commit 7080302a0360b315c76e3bc5d681c3dd1e5240a6 itojun committed Feb 1, 2001
Showing with 52 additions and 21 deletions.
  1. +11 −5 openbsd/sbin/ifconfig/ifconfig.8
  2. +41 −16 openbsd/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ifconfig.8,v 1.43 2000/04/26 19:03:46 chris Exp $
+.\" $OpenBSD: ifconfig.8,v 1.48 2000/10/17 21:56:06 naddy Exp $
.\" $NetBSD: ifconfig.8,v 1.11 1996/01/04 21:27:29 pk Exp $
.\" $FreeBSD: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $
.\"
@@ -111,7 +111,7 @@ and each of the six bytes of the host number,
through
.Ar f ,
are specified in hexadecimal.
-The host number may be omitted on 10Mb/s Ethernet interfaces,
+The host number may be omitted on Ethernet interfaces,
which use the hardware physical address,
and on interfaces other than the first.
For the
@@ -168,7 +168,7 @@ between network level addresses and link level addresses (default).
This is currently implemented for mapping between
.Tn DARPA
Internet
-addresses and 10Mb/s Ethernet addresses.
+addresses and Ethernet addresses.
.It Fl arp
Disable the use of the Address Resolution Protocol.
.It Cm anycast
@@ -214,7 +214,7 @@ When an interface is marked
the system will not attempt to
transmit messages through that interface.
If possible, the interface will be reset to disable reception as well.
-This action does not automatically disable routes using the interface.
+This action automatically disables routes using the interface.
.It Cm dstsa
Bind an
.Xr ipsec 4
@@ -410,6 +410,11 @@ There is some evidence that a number different from 1 may be useful
for
.Tn AFI
37 type addresses.
+.It Cm nwid Ar id
+(IEEE 802.11 devices only, specifically
+.Xr ray 4 )
+.br
+Configure network ID for IEEE 802.11-based wireless network interfaces.
.It Cm phase
The argument following this specifies the version (phase) of the
AppleTalk network attached to the interface.
@@ -473,7 +478,7 @@ messages in a manner which minimizes the number of
memory to memory copy operations performed by the receiver.
On networks that support the Address Resolution Protocol (see
.Xr arp 4 ;
-currently, only 10 Mb/s Ethernet),
+currently, only Ethernet),
this flag indicates that the system should request that other
systems use trailers when sending to this host.
Similarly, trailer encapsulations will be sent to other
@@ -559,6 +564,7 @@ tried to alter an interface's configuration.
.Xr netstat 1 ,
.Xr ifmedia 4 ,
.Xr netintro 4 ,
+.Xr hostname.if 5 ,
.Xr brconfig 8 ,
.Xr rc 8 ,
.Xr routed 8
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.36 2000/04/28 04:44:58 chris Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.40 2000/08/03 07:34:41 angelos Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -81,7 +81,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#else
-static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.36 2000/04/28 04:44:58 chris Exp $";
+static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.40 2000/08/03 07:34:41 angelos Exp $";
#endif
#endif /* not lint */
@@ -767,24 +767,26 @@ gifsettunnel(src, dst)
char *src;
char *dst;
{
- struct addrinfo *srcres, *dstres;
+ struct addrinfo hints, *srcres, *dstres;
struct ifaliasreq addreq;
int ecode;
-
#ifdef INET6
struct in6_aliasreq in6_addreq;
#endif /* INET6 */
- if ((ecode = getaddrinfo(src, NULL, NULL, &srcres)) != 0)
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = afp->af_af;
+
+ if ((ecode = getaddrinfo(src, NULL, &hints, &srcres)) != 0)
errx(1, "error in parsing address string: %s",
gai_strerror(ecode));
- if ((ecode = getaddrinfo(dst, NULL, NULL, &dstres)) != 0)
+ if ((ecode = getaddrinfo(dst, NULL, &hints, &dstres)) != 0)
errx(1, "error in parsing address string: %s",
gai_strerror(ecode));
if (srcres->ai_addr->sa_family != dstres->ai_addr->sa_family)
- errx(1,
+ errx(1,
"source and destination address families do not match");
switch (srcres->ai_addr->sa_family)
@@ -1410,9 +1412,14 @@ phys_status(force)
u_long srccmd, dstcmd;
struct ifreq *ifrp;
char *ver = "";
-
+#ifdef NI_WITHSCOPEID
+ const int niflag = NI_NUMERICHOST | NI_WITHSCOPEID;
+#else
+ const int niflag = NI_NUMERICHOST;
+#endif
#ifdef INET6
struct in6_ifreq in6_ifr;
+ int s6;
#endif /* INET6 */
force = 0; /*fool gcc*/
@@ -1421,27 +1428,45 @@ phys_status(force)
#ifdef INET6
bzero(&in6_ifr, sizeof(in6_ifr));
strncpy(in6_ifr.ifr_name, name, IFNAMSIZ);
- srccmd = SIOCGIFPSRCADDR_IN6;
- dstcmd = SIOCGIFPDSTADDR_IN6;
- ifrp = (struct ifreq *) &in6_ifr;
+ s6 = socket(AF_INET6, SOCK_DGRAM, 0);
+ if (s6 < 0) {
+ ifrp = &ifr;
+ srccmd = SIOCGIFPSRCADDR;
+ dstcmd = SIOCGIFPDSTADDR;
+ } else {
+ close(s6);
+ srccmd = SIOCGIFPSRCADDR_IN6;
+ dstcmd = SIOCGIFPDSTADDR_IN6;
+ ifrp = (struct ifreq *) &in6_ifr;
+ }
#else /* INET6 */
- ifrp = ifr;
+ ifrp = &ifr;
srccmd = SIOCGIFPSRCADDR;
dstcmd = SIOCGIFPDSTADDR;
#endif /* INET6 */
if (0 <= ioctl(s, srccmd, (caddr_t)ifrp)) {
+#ifdef INET6
+ if (ifrp->ifr_addr.sa_family == AF_INET6)
+ in6_fillscopeid((struct sockaddr_in6 *)&ifrp->ifr_addr);
+#endif
getnameinfo(&ifrp->ifr_addr, ifrp->ifr_addr.sa_len,
- psrcaddr, NI_MAXHOST, 0, 0, NI_NUMERICHOST);
+ psrcaddr, NI_MAXHOST, 0, 0, niflag);
#ifdef INET6
if (ifrp->ifr_addr.sa_family == AF_INET6)
ver = "6";
#endif /* INET6 */
- if (0 <= ioctl(s, dstcmd, (caddr_t)ifrp))
+ if (0 <= ioctl(s, dstcmd, (caddr_t)ifrp)) {
+#ifdef INET6
+ if (ifrp->ifr_addr.sa_family == AF_INET6) {
+ in6_fillscopeid((struct sockaddr_in6 *)
+ &ifrp->ifr_addr);
+ }
+#endif
getnameinfo(&ifrp->ifr_addr, ifrp->ifr_addr.sa_len,
- pdstaddr, NI_MAXHOST, 0, 0,
- NI_NUMERICHOST);
+ pdstaddr, NI_MAXHOST, 0, 0, niflag);
+ }
printf("\tphysical address inet%s %s --> %s\n", ver,
psrcaddr, pdstaddr);

0 comments on commit 7080302

Please sign in to comment.