To: None <netbsd-users@NetBSD.org>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-users
Date: 04/13/2004 10:24:32
--BZaMRJmqxGScZ8Mx
Content-Type: multipart/mixed; boundary="SO98HVl1bnMOfKZd"
Content-Disposition: inline
--SO98HVl1bnMOfKZd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
I've just read the replies which have been sent to the list only through
the web interface. I'm not subscribed to this list so I set the Reply-To:
appropriately in those in which I expected a reply. I thought this was the
right place to ask this, I wanted to ask the users.
Just to provide a little more than stupid ranting, I've attached the
changes I made to ifconfig locally. I hope it's correct but decided yourself
whether you want to use a patch provided by someone not capable of using
ifconfig without the right amount of rope. Now I could only enter=20
ifconfig 1500 && echo 'Success!' if I wanted to fool myself.
EOT,
Christian
--SO98HVl1bnMOfKZd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ifconfig.udif"
Content-Transfer-Encoding: quoted-printable
? .gdbinit
? ifconfig
? ifconfig.cat8
Index: ifconfig.8
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sbin/ifconfig/ifconfig.8,v
retrieving revision 1.72
diff -u -r1.72 ifconfig.8
--- ifconfig.8 1 Mar 2004 00:19:06 -0000 1.72
+++ ifconfig.8 13 Apr 2004 08:08:20 -0000
@@ -37,11 +37,14 @@
.Nd configure network interface parameters
.Sh SYNOPSIS
.Nm
-.Ar interface address_family
+.Ar interface
+.Oo=20
+.Ar address_family
.Oo
.Ar address
.Op Ar dest_address
.Oc
+.Oc
.Op Ar parameters
.Nm
.Op Fl Lmvz
@@ -84,6 +87,8 @@
.Tn DARPA
Internet address expressed in the Internet standard
.Dq dot notation .
+.Nm does not accept 1-, 2-, or 3-part dotted addresses; all four parts must
+be specified.
For the Xerox Network Systems(tm) family,
addresses are
.Ar net:a.b.c.d.e.f ,
@@ -121,6 +126,9 @@
.Dq iso ,
and
.Dq ns .
+If omitted
+.Dq inet
+is assumed.
.It Ar interface
The
.Ar interface
@@ -635,6 +643,7 @@
tried to alter an interface's configuration.
.Sh SEE ALSO
.Xr netstat 1 ,
+.Xr inet_pton 3 ,
.Xr ifmedia 4 ,
.Xr netintro 4 ,
.Xr ifconfig.if 5 ,
Index: ifconfig.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.141
diff -u -r1.141 ifconfig.c
--- ifconfig.c 1 Mar 2004 00:11:33 -0000 1.141
+++ ifconfig.c 13 Apr 2004 08:08:21 -0000
@@ -2720,6 +2720,7 @@
struct sockaddr_in *gasin =3D sintab[which];
struct hostent *hp;
struct netent *np;
+ int ret;
=20
gasin->sin_len =3D sizeof(*gasin);
if (which !=3D MASK)
@@ -2733,13 +2734,19 @@
}
}
=20
- if (inet_aton(str, &gasin->sin_addr) =3D=3D 0) {
+ ret =3D inet_pton(gasin->sin_family, str, &gasin->sin_addr);
+ if (ret =3D=3D 1) {
if ((hp =3D gethostbyname(str)) !=3D NULL)
(void) memcpy(&gasin->sin_addr, hp->h_addr, hp->h_length);
else if ((np =3D getnetbyname(str)) !=3D NULL)
gasin->sin_addr =3D inet_makeaddr(np->n_net, INADDR_ANY);
else
errx(EXIT_FAILURE, "%s: bad value", str);
+ } else if (ret =3D=3D 0) {
+ errx(EXIT_FAILURE,
+ "%s: not parsable for address family", str);
+ } else {
+ err(EXIT_FAILURE, "inet_pton() failed for \"%s\"", str);
}
}
=20
--SO98HVl1bnMOfKZd--
--BZaMRJmqxGScZ8Mx
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)
iD8DBQFAe6O/0KQix3oyIMcRArIjAKCALorA5VZHFXoHCyfw6Dqhza35CQCfXge9
MCO6LiR3S8n09sp2Q/Wkdh8=
=5dma
-----END PGP SIGNATURE-----
--BZaMRJmqxGScZ8Mx--