BSD 4_4 release
[unix-history] / usr / src / sbin / ifconfig / ifconfig.c
index e4c64ee..36560b9 100644 (file)
@@ -1,18 +1,44 @@
 /*
 /*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1983 Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1983, 1993\n\
      The Regents of the University of California.  All rights reserved.\n";
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)ifconfig.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)ifconfig.c 8.1 (Berkeley) 6/5/93";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -60,7 +86,7 @@ extern        int errno;
 
 int    setifflags(), setifaddr(), setifdstaddr(), setifnetmask();
 int    setifmetric(), setifbroadaddr(), setifipdst();
 
 int    setifflags(), setifaddr(), setifdstaddr(), setifnetmask();
 int    setifmetric(), setifbroadaddr(), setifipdst();
-int    notealias(), setsnpaoffset(), setnsellength();
+int    notealias(), setsnpaoffset(), setnsellength(), notrailers();
 
 #define        NEXTARG         0xffffff
 
 
 #define        NEXTARG         0xffffff
 
@@ -71,8 +97,8 @@ struct        cmd {
 } cmds[] = {
        { "up",         IFF_UP,         setifflags } ,
        { "down",       -IFF_UP,        setifflags },
 } cmds[] = {
        { "up",         IFF_UP,         setifflags } ,
        { "down",       -IFF_UP,        setifflags },
-       { "trailers",   -IFF_NOTRAILERS,setifflags },
-       { "-trailers",  IFF_NOTRAILERS, setifflags },
+       { "trailers",   -1,             notrailers },
+       { "-trailers",  1,              notrailers },
        { "arp",        -IFF_NOARP,     setifflags },
        { "-arp",       IFF_NOARP,      setifflags },
        { "debug",      IFF_DEBUG,      setifflags },
        { "arp",        -IFF_NOARP,     setifflags },
        { "-arp",       IFF_NOARP,      setifflags },
        { "debug",      IFF_DEBUG,      setifflags },
@@ -91,6 +117,12 @@ struct      cmd {
        { "ipdst",      NEXTARG,        setifipdst },
        { "snpaoffset", NEXTARG,        setsnpaoffset },
        { "nsellength", NEXTARG,        setnsellength },
        { "ipdst",      NEXTARG,        setifipdst },
        { "snpaoffset", NEXTARG,        setsnpaoffset },
        { "nsellength", NEXTARG,        setnsellength },
+       { "link0",      IFF_LINK0,      setifflags } ,
+       { "-link0",     -IFF_LINK0,     setifflags } ,
+       { "link1",      IFF_LINK1,      setifflags } ,
+       { "-link1",     -IFF_LINK1,     setifflags } ,
+       { "link2",      IFF_LINK2,      setifflags } ,
+       { "-link2",     -IFF_LINK2,     setifflags } ,
        { 0,            0,              setifaddr },
        { 0,            0,              setifdstaddr },
 };
        { 0,            0,              setifaddr },
        { 0,            0,              setifdstaddr },
 };
@@ -139,8 +171,8 @@ main(argc, argv)
                    "\t[ af [ address [ dest_addr ] ] [ up ] [ down ]",
                            "[ netmask mask ] ]\n",
                    "\t[ metric n ]\n",
                    "\t[ af [ address [ dest_addr ] ] [ up ] [ down ]",
                            "[ netmask mask ] ]\n",
                    "\t[ metric n ]\n",
-                   "\t[ trailers | -trailers ]\n",
-                   "\t[ arp | -arp ]\n");
+                   "\t[ arp | -arp ]\n",
+                   "\t[ link0 | -link0 ] [ link1 | -link1 ] [ link2 | -link2 ] \n");
                exit(1);
        }
        argc--, argv++;
                exit(1);
        }
        argc--, argv++;
@@ -279,6 +311,14 @@ notealias(addr, param)
                clearaddr = 0;
 }
 
                clearaddr = 0;
 }
 
+/*ARGSUSED*/
+notrailers(vname, value)
+       char *vname;
+       int value;
+{
+       printf("Note: trailers are no longer sent, but always received\n");
+}
+
 /*ARGSUSED*/
 setifdstaddr(addr, param)
        char *addr;
 /*ARGSUSED*/
 setifdstaddr(addr, param)
        char *addr;
@@ -324,8 +364,8 @@ setsnpaoffset(val)
 }
 
 #define        IFFBITS \
 }
 
 #define        IFFBITS \
-"\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6NOTRAILERS\7RUNNING\
-\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX"
+"\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6NOTRAILERS\7RUNNING\10NOARP\
+\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2\20MULTICAST"
 
 /*
  * Print the status of the interface.  If an address family was
 
 /*
  * Print the status of the interface.  If an address family was