| From: |
| Dan Eble <dane@aiinet.com> |
| To: |
| linux-net <linux-net@vger.kernel.org> |
| Subject: |
| [PATCH] Generic PPP for Generic HDLC [3/3] |
| Date: |
| Tue, 10 Jun 2003 11:48:10 -0400 (EDT) |
This is part 3 of a 3-message set that adds generic PPP support to the
generic HDLC layer. These changes were made in PPC Linux 2.4.21-pre4.
These 3 parts DO NOT include changes to the PPP daemon to enable it to
work with WAN HDLC devices. I shall post those changes to the
linux-ppp email list, under the subject "[PATCH] WAN HDLC Support".
I welcome comments and suggestions, polite or not. Eventually, this
will be used in the real world ;) and I would like it to work
properly.
______________________________________________________________________
Part 1 is a new drivers/net/wan/hdlc_ppp.c. I have included it
verbatim because I think it is easier to read than a patch (since
almost all of it is different from the previous version).
Part 2 patches the following:
* In include/linux/hdlc.h, the PPP state variables have changed
in accordance with the switch from syncppp.c to ppp_generic.
* In drivers/net/wan/Makefile, syncppp.c is no longer required
when CONFIG_HDLC_PPP is defined.
* In include/linux/hdlc/ioctl.h, there is now a structure
(ppp_proto) for retrieving PPP protocol information via
the SIOCWANDEV(IF_GET_PROTO) ioctl.
* In include/linux/if.h, ppp_proto is part of the union used in
SIOCWANDEV.
Part 3 patches the "sethdlc" program to use the new ppp_proto
structure.
--
Dan Eble <dane@aiinet.com> _____ .
| _ |/|
Applied Innovation Inc. | |_| | |
http://www.aiinet.com/ |__/|_|_|
--- sethdlc.c.old 2003-06-10 11:05:40.000000000 -0400
+++ sethdlc.c 2003-06-09 07:59:45.000000000 -0400
@@ -462,6 +462,36 @@
+static void set_proto_ppp(void)
+{
+ ppp_proto ppp;
+ memset(&ppp, 0, sizeof(ppp));
+
+ /* So far only IF_PROTO_PPP is set by ioctl. All PPP options are
+ * configured by pppd. (That's why there's so little here.) */
+
+ req.ifr_settings.ifs_ifsu.ppp = &ppp;
+ req.ifr_settings.size = sizeof(ppp);
+
+ if (ioctl(sock, SIOCWANDEV, &req))
+ error("Unable to set PPP protocol information: %s\n",
+ strerror(errno));
+}
+
+
+
+static void set_proto_x25(void)
+{
+ req.ifr_settings.ifs_ifsu.sync = NULL; /* FIXME */
+ req.ifr_settings.size = 0;
+
+ if (ioctl(sock, SIOCWANDEV, &req))
+ error("Unable to set X.25 protocol information: %s\n",
+ strerror(errno));
+}
+
+
+
static void set_proto(void)
{
if (checktab(protos, &req.ifr_settings.type))
@@ -472,19 +502,8 @@
case IF_PROTO_HDLC_ETH: set_proto_hdlc(1); break;
case IF_PROTO_CISCO: set_proto_cisco(); break;
case IF_PROTO_FR: set_proto_fr(); break;
-
- case IF_PROTO_PPP:
- case IF_PROTO_X25:
- req.ifr_settings.ifs_ifsu.sync = NULL; /* FIXME */
- req.ifr_settings.size = 0;
-
- if (!ioctl(sock, SIOCWANDEV, &req))
- break;
-
- error("Unable to set %s protocol information: %s\n",
- req.ifr_settings.type == IF_PROTO_PPP
- ? "PPP" : "X.25", strerror(errno));
-
+ case IF_PROTO_PPP: set_proto_ppp(); break;
+ case IF_PROTO_X25: set_proto_x25(); break;
default: error("Unknown protocol %u\n", req.ifr_settings.type);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html