pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/pppd Add our revision 1.50 of sys-bsd.c that I had...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7c98e179cb75
branches:  trunk
changeset: 486755:7c98e179cb75
user:      cube <cube%pkgsrc.org@localhost>
date:      Sun Jan 02 17:26:09 2005 +0000

description:
Add our revision 1.50 of sys-bsd.c that I had forgotten.  It adds support
for cloning ppp(4) as found in -current.

diffstat:

 net/pppd/distinfo         |   4 +-
 net/pppd/patches/patch-az |  49 +++++++++++++++++++++++++++++++++++-----------
 2 files changed, 39 insertions(+), 14 deletions(-)

diffs (101 lines):

diff -r a47a1d28b2ee -r 7c98e179cb75 net/pppd/distinfo
--- a/net/pppd/distinfo Sun Jan 02 17:16:00 2005 +0000
+++ b/net/pppd/distinfo Sun Jan 02 17:26:09 2005 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.1.1.1 2005/01/02 02:51:41 cube Exp $
+$NetBSD: distinfo,v 1.2 2005/01/02 17:26:09 cube Exp $
 
 SHA1 (ppp-2.4.3.tar.gz) = 5e2789f4dedc81943fa9f94c840cccc2407056f7
 Size (ppp-2.4.3.tar.gz) = 688092 bytes
@@ -27,7 +27,7 @@
 SHA1 (patch-aw) = 7fb53f72216ffe34720b76fc122e87f4762a6696
 SHA1 (patch-ax) = 3641654b6b158ad65e9dd95247836fa8c07ec66e
 SHA1 (patch-ay) = 93ccd90f6efa58bfe31105526499308ed35b9522
-SHA1 (patch-az) = 250ce38e56be6e05719463c5a93b4b8acae78a43
+SHA1 (patch-az) = acd7680ccc537edf9e163d568ab0611fd762d747
 SHA1 (patch-ba) = 4293edb8b490fe31e07268a6d7001e1c9db8f323
 SHA1 (patch-bb) = 9b17b12b45d9857eea42c2a6dc3704392c4df7c0
 SHA1 (patch-bc) = d53a2226166e84fa9ea049cdbfb52c1dcd0f1ed9
diff -r a47a1d28b2ee -r 7c98e179cb75 net/pppd/patches/patch-az
--- a/net/pppd/patches/patch-az Sun Jan 02 17:16:00 2005 +0000
+++ b/net/pppd/patches/patch-az Sun Jan 02 17:26:09 2005 +0000
@@ -1,9 +1,9 @@
-$NetBSD: patch-az,v 1.1.1.1 2005/01/02 02:51:43 cube Exp $
+$NetBSD: patch-az,v 1.2 2005/01/02 17:26:09 cube Exp $
 
---- pppd/sys-bsd.c.orig        2004-12-31 23:51:00.000000000 +0100
+--- pppd/sys-bsd.c.orig        2005-01-02 17:58:02.000000000 +0100
 +++ pppd/sys-bsd.c
-@@ -0,0 +1,2147 @@
-+/*    NetBSD: sys-bsd.c,v 1.49 2004/02/28 19:27:49 itojun Exp         */
+@@ -0,0 +1,2172 @@
++/*    NetBSD: sys-bsd.c,v 1.50 2004/12/05 04:16:22 christos Exp       */
 +
 +/*
 + * sys-bsd.c - System-dependent procedures for setting up
@@ -84,7 +84,7 @@
 +#if 0
 +#define RCSID "Id: sys-bsd.c,v 1.47 2000/04/13 12:04:23 paulus Exp "
 +#else
-+__RCSID("NetBSD: sys-bsd.c,v 1.49 2004/02/28 19:27:49 itojun Exp ");
++__RCSID("NetBSD: sys-bsd.c,v 1.50 2004/12/05 04:16:22 christos Exp ");
 +#endif
 +#endif
 +
@@ -296,16 +296,41 @@
 +int
 +ppp_available()
 +{
-+    int s, ok;
-+    struct ifreq ifr;
++    struct if_clonereq ifcr;
++    char *cp, *buf;
++    int idx, s;
 +    extern char *no_ppp_msg;
 +
++    (void)memset(&ifcr, 0, sizeof(ifcr));
++
 +    if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
-+      return 1;               /* can't tell */
++      fatal("socket: %m");
++
++    if (ioctl(s, SIOCIFGCLONERS, &ifcr) == -1)
++      fatal("ioctl(get cloners): %m");
++
++    buf = malloc(ifcr.ifcr_total * IFNAMSIZ);
++    if (buf == NULL)
++      fatal("Unable to allocate cloner name buffer: %m");
++
++    ifcr.ifcr_count = ifcr.ifcr_total;
++    ifcr.ifcr_buffer = buf;
 +
-+    strlcpy(ifr.ifr_name, "ppp0", sizeof (ifr.ifr_name));
-+    ok = ioctl(s, SIOCGIFFLAGS, (caddr_t) &ifr) >= 0;
-+    close(s);
++    if (ioctl(s, SIOCIFGCLONERS, &ifcr) == -1)
++      fatal("ioctl(get cloners): %m");
++    (void)close(s);
++
++    /*
++     * In case some disappeared in the mean time, clamp it down.
++     */
++    if (ifcr.ifcr_count > ifcr.ifcr_total)
++      ifcr.ifcr_count = ifcr.ifcr_total;
++
++    for (cp = buf, idx = 0; idx < ifcr.ifcr_count; idx++, cp += IFNAMSIZ) {
++      if (strcmp(cp, "ppp") == 0)
++          break;
++    }
++    free(buf);
 +
 +#ifdef __NetBSD__
 +    no_ppp_msg = "\
@@ -317,7 +342,7 @@
 +in the kernel, please follow the steps detailed in the README.bsd\n\
 +file in the ppp-2.2 distribution.\n";
 +#endif
-+    return ok;
++    return idx != ifcr.ifcr_count;
 +}
 +
 +/*



Home | Main Index | Thread Index | Old Index