Commit hooks for ifmedia support. It's optional in the Makefile, and
can be trivially disabled.
This commit is contained in:
parent
036d0fb7d5
commit
54b5e92f49
@ -1,7 +1,13 @@
|
||||
# From: @(#)Makefile 8.1 (Berkeley) 6/5/93
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.9 1997/02/22 14:32:32 peter Exp $
|
||||
|
||||
PROG= ifconfig
|
||||
SRCS= ifconfig.c
|
||||
|
||||
#comment out to exclude SIOC[GS]IFMEDIA support
|
||||
SRCS+= ifmedia.c
|
||||
CFLAGS+=-DUSE_IF_MEDIA
|
||||
|
||||
MAN8= ifconfig.8
|
||||
DPADD= ${LIBIPX}
|
||||
LDADD= -lipx
|
||||
|
@ -42,7 +42,7 @@ static const char copyright[] =
|
||||
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id: ifconfig.c,v 1.25 1997/05/04 06:00:27 peter Exp $";
|
||||
"$Id: ifconfig.c,v 1.26 1997/05/04 06:14:47 peter Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -95,6 +95,8 @@ static const char rcsid[] =
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ifconfig.h"
|
||||
|
||||
struct ifreq ifr, ridreq;
|
||||
struct ifaliasreq addreq;
|
||||
#ifdef ISO
|
||||
@ -182,6 +184,11 @@ struct cmd {
|
||||
{ "-link1", -IFF_LINK1, setifflags },
|
||||
{ "link2", IFF_LINK2, setifflags },
|
||||
{ "-link2", -IFF_LINK2, setifflags },
|
||||
#ifdef USE_IF_MEDIA
|
||||
{ "media", NEXTARG, setmedia },
|
||||
{ "mediaopt", NEXTARG, setmediaopt },
|
||||
{ "-mediaopt", NEXTARG, unsetmediaopt },
|
||||
#endif
|
||||
{ "normal", -IFF_LINK0, setifflags },
|
||||
{ "compress", IFF_LINK0, setifflags },
|
||||
{ "noicmp", IFF_LINK1, setifflags },
|
||||
@ -282,6 +289,11 @@ usage()
|
||||
fputs(" [ mtu n ]\n", stderr);
|
||||
fputs(" [ arp | -arp ]\n", stderr);
|
||||
fputs(" [ link0 | -link0 ] [ link1 | -link1 ] [ link2 | -link2 ]\n", stderr);
|
||||
#ifdef USE_IF_MEDIA
|
||||
fputs(" [ media mtype ]\n", stderr);
|
||||
fputs(" [ mediaopt mopts ]\n", stderr);
|
||||
fputs(" [ -mediaopt mopts ]\n", stderr);
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -299,7 +311,7 @@ main(argc, argv)
|
||||
|
||||
/* Parse leading line options */
|
||||
all = allmedia = downonly = uponly = namesonly = 0;
|
||||
while ((c = getopt(argc, argv, "adlu")) != -1) {
|
||||
while ((c = getopt(argc, argv, "adlmu")) != -1) {
|
||||
switch (c) {
|
||||
case 'a': /* scan all interfaces */
|
||||
all++;
|
||||
@ -313,6 +325,14 @@ main(argc, argv)
|
||||
case 'u': /* restrict scan to "down" interfaces */
|
||||
uponly++;
|
||||
break;
|
||||
case 'm': /* show media choices in status */
|
||||
#ifdef USE_IF_MEDIA
|
||||
allmedia++;
|
||||
#else
|
||||
fputs("WARNING: if_media not compiled in!\n", stderr);
|
||||
usage();
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
@ -474,6 +494,9 @@ ifconfig(argc, argv, rafp)
|
||||
|
||||
if (argc == 0) {
|
||||
status();
|
||||
#ifdef USE_IF_MEDIA
|
||||
media_status(s);
|
||||
#endif
|
||||
close(s);
|
||||
return(0);
|
||||
}
|
||||
|
45
sbin/ifconfig/ifconfig.h
Normal file
45
sbin/ifconfig/ifconfig.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 1997 Peter Wemm.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 for the FreeBSD Project
|
||||
* by Peter Wemm.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
*
|
||||
* so there!
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
extern struct ifreq ifr;
|
||||
|
||||
extern char name[32]; /* name of interface */
|
||||
extern int allmedia;
|
||||
|
||||
extern void setmedia(const char *, int, int);
|
||||
extern void setmediaopt(const char *, int, int);
|
||||
extern void unsetmediaopt(const char *, int, int);
|
||||
extern void media_status(int s);
|
Loading…
Reference in New Issue
Block a user