dded support for IFF_ALTPHYS flag (when it's defined in net/if.h). Added
authorGarrett Wollman <wollman@FreeBSD.org>
Mon, 8 Nov 1993 22:10:50 +0000 (22:10 +0000)
committerGarrett Wollman <wollman@FreeBSD.org>
Mon, 8 Nov 1993 22:10:50 +0000 (22:10 +0000)
documentation for  altphys, bnc/aui, llc[012].  Also changed ifconfig to use
inet_aton() rather than inet_addr() so that you can specify the IP address
255.255.255.255.

sbin/ifconfig/ifconfig.8
sbin/ifconfig/ifconfig.c

index f09bfa0..4499bb4 100644 (file)
@@ -130,6 +130,22 @@ Internet
 addresses and 10Mb/s Ethernet addresses.
 .It Fl arp
 Disable the use of the Address Resolution Protocol.
 addresses and 10Mb/s Ethernet addresses.
 .It Fl arp
 Disable the use of the Address Resolution Protocol.
+.It Cm altphys
+Instruct the adapter to use a physical network connection other than
+the default, such as the AUI port rather than a built-in transceiver.
+(See
+.Cm aui ,
+which is another name for the same flag, below.)
+.It Fl altphys
+Disable the use of the alternate physical network connection.
+.It Cm aui
+On certain Ethernet drivers, configures the adapter to use the AUI
+port rather than the default built-in transceiver.  (See also
+.Cm altphys ) .
+.It Cm bnc
+On certain Ethernet drivers, configures the adapter to use the
+built-in transceiver rather than the AUI port.  (See also
+.Cm Fl altphys ) .
 .It Cm broadcast
 (Inet only)
 Specify the address to use to represent broadcasts to the
 .It Cm broadcast
 (Inet only)
 Specify the address to use to represent broadcasts to the
@@ -165,6 +181,20 @@ of the destination.
 IP encapsulation of
 .Tn CLNP
 packets is done differently.
 IP encapsulation of
 .Tn CLNP
 packets is done differently.
+.It Cm llc0
+Enable use of IEEE 802.2 LLC class 0.  (Currently
+unimplemented.)
+.It Fl llc0
+Disable IEEE 802.2 LLC class 0.  Not all interfaces may permit this,
+as most 802 networks have no alternative link layer other than 802.2.
+.It Cm llc1
+Enable use of IEEE 802.2 LLC class 1.  (Currently unimplemented.)
+.It Fl llc1
+Disable use of IEEE 802.2 LLC class 1.
+.It Cm llc2
+Enable use of IEEE 802.2 LLC class 2.  (Currently unimplemented.)
+.It Fl llc2
+Disable use of IEEE 802.2 LLC class 2.
 .It Cm metric Ar n
 Set the routing metric of the interface to
 .Ar n ,
 .It Cm metric Ar n
 Set the routing metric of the interface to
 .Ar n ,
index 111b88e..c8d2177 100644 (file)
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
- * --------------------         -----   ----------------------
- * CURRENT PATCH LEVEL:         1       00102
- * --------------------         -----   ----------------------
- *
- * 06 Sep 92   Herb Peyerl             Added "aui"/"bnc" options to ifconfig
- *                                     for 3COM 3C503 port selection
- * 10 Mar 93   Rodney W. Grimes        Made the aui/bnc more general, you now
- *                                     also have llc[0-2] and -llc[0-2].
- *                                     Added the rest of the output flag bits.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
@@ -50,6 +40,8 @@ char copyright[] =
 
 #ifndef lint
 static char sccsid[] = "@(#)ifconfig.c 5.1 (Berkeley) 2/28/91";
 
 #ifndef lint
 static char sccsid[] = "@(#)ifconfig.c 5.1 (Berkeley) 2/28/91";
+static const char rcsid[] = 
+  "$Id$";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -60,7 +52,6 @@ static char sccsid[] = "@(#)ifconfig.c        5.1 (Berkeley) 2/28/91";
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#ifdef notdef
 #define        NSIP
 #include <netns/ns.h>
 #include <netns/ns_if.h>
 #define        NSIP
 #include <netns/ns.h>
 #include <netns/ns_if.h>
@@ -68,7 +59,6 @@ static char sccsid[] = "@(#)ifconfig.c        5.1 (Berkeley) 2/28/91";
 #define EON
 #include <netiso/iso.h>
 #include <netiso/iso_var.h>
 #define EON
 #include <netiso/iso.h>
 #include <netiso/iso_var.h>
-#endif
 #include <netdb.h>
 #include <sys/protosw.h>
 
 #include <netdb.h>
 #include <sys/protosw.h>
 
@@ -118,8 +108,17 @@ struct     cmd {
        { "-arp",       IFF_NOARP,      setifflags },
        { "debug",      IFF_DEBUG,      setifflags },
        { "-debug",     -IFF_DEBUG,     setifflags },
        { "-arp",       IFF_NOARP,      setifflags },
        { "debug",      IFF_DEBUG,      setifflags },
        { "-debug",     -IFF_DEBUG,     setifflags },
+#ifdef IFF_ALTPHYS
+       { "aui",        IFF_ALTPHYS,    setifflags },
+       { "bnc",        -IFF_ALTPHYS,   setifflags },
+       { "altphys",    IFF_ALTPHYS,    setifflags },
+       { "-altphys",   -IFF_ALTPHYS,   setifflags },
+#else
        { "aui",        IFF_LLC0,       setifflags },   /* 06 Sep 92*/
        { "bnc",        -IFF_LLC0,      setifflags },
        { "aui",        IFF_LLC0,       setifflags },   /* 06 Sep 92*/
        { "bnc",        -IFF_LLC0,      setifflags },
+       { "altphys",    IFF_LLC0,       setifflags },
+       { "-altphys",   -IFF_LLC0,      setifflags },
+#endif
        { "llc0",       IFF_LLC0,       setifflags },   /* 10 Mar 93 */
        { "-llc0",      -IFF_LLC0,      setifflags },
        { "llc1",       IFF_LLC1,       setifflags },
        { "llc0",       IFF_LLC0,       setifflags },   /* 10 Mar 93 */
        { "-llc0",      -IFF_LLC0,      setifflags },
        { "llc1",       IFF_LLC1,       setifflags },
@@ -384,10 +383,14 @@ setsnpaoffset(val)
 #endif
 }
 
 #endif
 }
 
+/*
+ * This is ok if IFF_ALTPHYS is not defined, since we can be sure of never
+ * seeing in in that case anyway.
+ */
 #define        IFFBITS \
 "\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6NOTRAILERS\7RUNNING\10NOARP\
 \11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LLC0\16LLC1\17LLC2\
 #define        IFFBITS \
 "\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6NOTRAILERS\7RUNNING\10NOARP\
 \11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LLC0\16LLC1\17LLC2\
-"
+\20ALTPHYS\21MULTICAST\22VIRTUAL"
 
 /*
  * Print the status of the interface.  If an address family was
 
 /*
  * Print the status of the interface.  If an address family was
@@ -415,7 +418,6 @@ in_status(force)
        int force;
 {
        struct sockaddr_in *sin;
        int force;
 {
        struct sockaddr_in *sin;
-       char *inet_ntoa();
 
        strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
        if (ioctl(s, SIOCGIFADDR, (caddr_t)&ifr) < 0) {
 
        strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
        if (ioctl(s, SIOCGIFADDR, (caddr_t)&ifr) < 0) {
@@ -558,8 +560,6 @@ iso_status(force)
 Perror(cmd)
        char *cmd;
 {
 Perror(cmd)
        char *cmd;
 {
-       extern int errno;
-
        fprintf(stderr, "ifconfig: ");
        switch (errno) {
 
        fprintf(stderr, "ifconfig: ");
        switch (errno) {
 
@@ -596,8 +596,8 @@ in_getaddr(s, which)
        if (which != MASK)
                sin->sin_family = AF_INET;
 
        if (which != MASK)
                sin->sin_family = AF_INET;
 
-       if ((val = inet_addr(s)) != -1)
-               sin->sin_addr.s_addr = val;
+       if (inet_aton(s, &sin->sin_addr))
+               ; /* do nothing, conversion successful */
        else if (hp = gethostbyname(s))
                bcopy(hp->h_addr, (char *)&sin->sin_addr, hp->h_length);
        else if (np = getnetbyname(s))
        else if (hp = gethostbyname(s))
                bcopy(hp->h_addr, (char *)&sin->sin_addr, hp->h_length);
        else if (np = getnetbyname(s))