projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BSD 4_3_Net_2 release
[unix-history]
/
usr
/
src
/
contrib
/
usr.x25
/
x25config.c
diff --git
a/usr/src/contrib/usr.x25/x25config.c
b/usr/src/contrib/usr.x25/x25config.c
index
3b73fab
..
b9843ce
100644
(file)
--- a/
usr/src/contrib/usr.x25/x25config.c
+++ b/
usr/src/contrib/usr.x25/x25config.c
@@
-1,3
+1,11
@@
+/*
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ *
+ * %W% (Berkeley) %G%
+ */
/*
* Configure X.25 interface
*
/*
* Configure X.25 interface
*
@@
-20,8
+28,8
@@
#define IFFBITS \
"\020\1UP\2BROADCAST\3DEBUG\4ROUTE\5POINTOPOINT\6NOTRAILERS\7RUNNING\10NOARP"
#define IFFBITS \
"\020\1UP\2BROADCAST\3DEBUG\4ROUTE\5POINTOPOINT\6NOTRAILERS\7RUNNING\10NOARP"
-int setifflags (), setdefault (), setnet (), setntn ();
-int setlproto (), sethdlc (), setlwsize (), setltrace ();
+int setifflags (), setdefault (), setnet (), setntn ()
, setprepnd0 ()
;
+int setlproto (), sethdlc (), setlwsize (), setltrace ()
, setnodnic ()
;
int setyear (), setpwsize (), setpacketsize (), setmaxlcn (), setptrace ();
struct cmd {
int setyear (), setpwsize (), setpacketsize (), setmaxlcn (), setptrace ();
struct cmd {
@@
-43,6
+51,10
@@
struct cmd {
"unset", HDLCPROTO_UNSET, sethdlc,
"-ltrace", 0, setltrace,
"ltrace", 1, setltrace,
"unset", HDLCPROTO_UNSET, sethdlc,
"-ltrace", 0, setltrace,
"ltrace", 1, setltrace,
+ "-prepnd0", 0, setprepnd0,
+ "prepnd0", 1, setprepnd0,
+ "-nodnic", 0, setnodnic,
+ "nodnic", 1, setnodnic,
"1976", X25_1976, setyear,
"1980", X25_1980, setyear,
"1976", X25_1976, setyear,
"1980", X25_1980, setyear,
@@
-60,7
+72,8
@@
struct cmd {
};
struct ifreq ifr;
};
struct ifreq ifr;
-struct x25config x25conf = { AF_CCITT };
+struct ifreq_x25 ifrx25;
+#define x25conf ifrx25.ifr_xc
char *myname;
char *ifname; /* interface name */
char *myname;
char *ifname; /* interface name */
@@
-86,15
+99,15
@@
int argc;
if (ioctl (s, SIOCGIFFLAGS, (char *)&ifr) < 0)
syserr ("ioctl (SIOCGIFFLAGS)");
ifflags = ifr.ifr_flags;
if (ioctl (s, SIOCGIFFLAGS, (char *)&ifr) < 0)
syserr ("ioctl (SIOCGIFFLAGS)");
ifflags = ifr.ifr_flags;
- strcpy (ifr.ifr_name, ifname);
- if (ioctl (s, SIOCGIFADDR, (char *)&ifr) == 0)
- bcopy ((char *)&ifr.ifr_addr, (char *)&x25conf, sizeof (x25conf));
-
+ strcpy (ifrx25.ifr_name, ifname);
+ if (ioctl (s, SIOCGIFCONF_X25, (char *)&ifrx25) < 0) {
+ x25conf.xc_addr.x25_len = sizeof(x25conf);
+ x25conf.xc_addr.x25_family = AF_CCITT;
+ }
if (argc == 2) {
status ();
exit (0);
}
if (argc == 2) {
status ();
exit (0);
}
-
argv++;
while (*argv) {
register struct cmd *cp;
argv++;
while (*argv) {
register struct cmd *cp;
@@
-125,10
+138,9
@@
int argc;
if (ioctl (s, SIOCSIFFLAGS, (char *)&ifr) < 0)
syserr ("ioctl (SIOCSIFFLAGS)");
if (ioctl (s, SIOCSIFFLAGS, (char *)&ifr) < 0)
syserr ("ioctl (SIOCSIFFLAGS)");
- strcpy (ifr.ifr_name, ifname);
- bcopy ((char *)&x25conf, (char *)&ifr.ifr_addr, sizeof (x25conf));
- if (ioctl (s, SIOCSIFADDR, (char *)&ifr) < 0)
- syserr ("ioctl (SIOCSIFADDR)");
+ strcpy (ifrx25.ifr_name, ifname);
+ if (ioctl (s, SIOCSIFCONF_X25, (char *)&ifrx25) < 0)
+ syserr ("ioctl (SIOCSIFCONF_X25)");
exit (0);
}
exit (0);
}
@@
-158,7
+170,7
@@
char *fmt;
status ()
{
status ()
{
- char
addr[sizeof (x25conf.xc_ntn) * 2 + 1]
;
+ char
*addr = x25conf.xc_addr.x25_addr
;
printf ("%s: ", ifname);
printb ("interface flags", ifflags, IFFBITS);
printf ("%s: ", ifname);
printb ("interface flags", ifflags, IFFBITS);
@@
-167,8
+179,7
@@
status ()
if (x25conf.xc_ltrace)
printf ("\ttracing: on\n");
printf ("\npacket level:\n");
if (x25conf.xc_ltrace)
printf ("\ttracing: on\n");
printf ("\npacket level:\n");
- from_bcd (x25conf.xc_ntn, addr, x25conf.xc_ntnlen);
- printf ("\taddress: %04d %s\n", x25conf.xc_net, addr);
+ printf ("\taddress: %04d %s\n", x25conf.xc_addr.x25_net, addr);
printf ("\twindow size: %d\n", x25conf.xc_pwsize);
printf ("\tpacket size: %d\n", 1 << x25conf.xc_psize);
printf ("\tmax lcn: %d\n", x25conf.xc_maxlcn);
printf ("\twindow size: %d\n", x25conf.xc_pwsize);
printf ("\tpacket size: %d\n", 1 << x25conf.xc_psize);
printf ("\tmax lcn: %d\n", x25conf.xc_maxlcn);
@@
-190,7
+201,7
@@
setifflags (value)
setdefault (arg)
{
setdefault (arg)
{
- x25conf.xc_family = AF_CCITT;
+ x25conf.xc_
addr.x25_
family = AF_CCITT;
x25conf.xc_lproto = CCITTPROTO_HDLC;
x25conf.xc_lptype = HDLCPROTO_LAPB;
x25conf.xc_lwsize = 7;
x25conf.xc_lproto = CCITTPROTO_HDLC;
x25conf.xc_lptype = HDLCPROTO_LAPB;
x25conf.xc_lwsize = 7;
@@
-212,7
+223,7
@@
char *arg;
net = np->n_net;
} else
net = atoi (arg);
net = np->n_net;
} else
net = atoi (arg);
- x25conf.xc_net = net;
+ x25conf.xc_
addr.x25_
net = net;
}
setntn (arg)
}
setntn (arg)
@@
-227,18
+238,16
@@
register char *arg;
if ((hp = getx25hostbyname (arg)) == 0)
abort ("can't find '%s' in /etc/x25hosts", arg);
arg = ((struct sockaddr_x25 *)hp->h_addr)->x25_addr;
if ((hp = getx25hostbyname (arg)) == 0)
abort ("can't find '%s' in /etc/x25hosts", arg);
arg = ((struct sockaddr_x25 *)hp->h_addr)->x25_addr;
- l = strlen (arg);
+ l = strlen (arg)
+ 1
;
} else
} else
- for (l =
0
, p = arg; *p; p++) {
+ for (l =
1
, p = arg; *p; p++) {
l++;
if (*p < '0' || *p > '9')
abort ("invalid character in ntn address");
}
l++;
if (*p < '0' || *p > '9')
abort ("invalid character in ntn address");
}
- if (l > sizeof (x25conf.xc_
ntn) * 2 || l == 0
)
+ if (l > sizeof (x25conf.xc_
addr.x25_addr)
)
abort ("invalid ntn address");
abort ("invalid ntn address");
-
- x25conf.xc_ntnlen = l;
- to_bcd (arg, x25conf.xc_ntn);
+ bcopy(arg, x25conf.xc_addr.x25_addr, l);
}
to_bcd (src, dest)
}
to_bcd (src, dest)
@@
-285,6
+294,16
@@
char *arg;
x25conf.xc_lwsize = ws;
}
x25conf.xc_lwsize = ws;
}
+setprepnd0 (arg)
+{
+ x25conf.xc_prepnd0 = arg;
+}
+
+setnodnic (arg)
+{
+ x25conf.xc_nodnic = arg;
+}
+
setltrace (arg)
{
x25conf.xc_ltrace = arg;
setltrace (arg)
{
x25conf.xc_ltrace = arg;