Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 29399 Details for
Bug 47574
problems with pppoatm plugin.
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
a patch against 2.4.2
pppoatm-2.4.2cln.patch (text/plain), 10.85 KB, created by
Ahmed Farid
on 2004-04-15 23:59:01 UTC
(
hide
)
Description:
a patch against 2.4.2
Filename:
MIME Type:
Creator:
Ahmed Farid
Created:
2004-04-15 23:59:01 UTC
Size:
10.85 KB
patch
obsolete
>diff -Naur ppp-2.4.2/pppd/plugins/Makefile ppp-2.4.2-patches/pppd/plugins/Makefile >--- ppp-2.4.2/pppd/plugins/Makefile 2004-01-13 05:56:24.000000000 +0200 >+++ ppp-2.4.2-patches/pppd/plugins/Makefile 2004-04-16 08:40:09.817245000 +0200 >@@ -7,7 +7,7 @@ > SUBDIRS := rp-pppoe > # Uncomment the next line to include the radius authentication plugin > # SUBDIRS += radius >-PLUGINS := minconn.so passprompt.so passwordfd.so >+PLUGINS := minconn.so passprompt.so passwordfd.so pppoatm.so > > # include dependencies if present > ifeq (.depend,$(wildcard .depend)) >diff -Naur ppp-2.4.2/pppd/plugins/Makefile.linux ppp-2.4.2-patches/pppd/plugins/Makefile.linux >--- ppp-2.4.2/pppd/plugins/Makefile.linux 2004-01-13 05:56:24.000000000 +0200 >+++ ppp-2.4.2-patches/pppd/plugins/Makefile.linux 2004-04-16 08:40:09.817245000 +0200 >@@ -7,7 +7,7 @@ > SUBDIRS := rp-pppoe > # Uncomment the next line to include the radius authentication plugin > # SUBDIRS += radius >-PLUGINS := minconn.so passprompt.so passwordfd.so >+PLUGINS := minconn.so passprompt.so passwordfd.so pppoatm.so > > # include dependencies if present > ifeq (.depend,$(wildcard .depend)) >diff -Naur ppp-2.4.2/pppd/plugins/pppoatm.c ppp-2.4.2-patches/pppd/plugins/pppoatm.c >--- ppp-2.4.2/pppd/plugins/pppoatm.c 1970-01-01 02:00:00.000000000 +0200 >+++ ppp-2.4.2-patches/pppd/plugins/pppoatm.c 2003-11-29 01:46:14.000000000 +0200 >@@ -0,0 +1,402 @@ >+/* pppoatm.c - pppd plugin to implement PPPoATM protocol. >+ * >+ * Copyright 2000 Mitchell Blank Jr. >+ * 2002 Clive Nicolson. >+ * Based in part on work from Jens Axboe and Paul Mackerras. >+ * >+ * This program is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU General Public License >+ * as published by the Free Software Foundation; either version >+ * 2 of the License, or (at your option) any later version. >+ */ >+#include <errno.h> >+#include <string.h> >+#include <stdlib.h> >+#include <sys/types.h> >+#include <unistd.h> >+ >+#include <atm.h> >+#include <linux/atmdev.h> >+#include <linux/atmppp.h> >+#include <sys/stat.h> >+#include <net/if.h> >+#include <sys/ioctl.h> >+ >+#include "pppd.h" >+#include "fsm.h" /* Needed for lcp.h to include cleanly */ >+#include "lcp.h" >+ >+#define Dinfo if (debug) info >+ >+static void pppoatm_process_extra_options __P((void)); >+static void pppoatm_check_options __P((void)); >+static int pppoatm_connect __P((void)); >+static void pppoatm_disconnect __P((void)); >+static int pppoatm_establish_ppp __P((int)); >+static void pppoatm_disestablish_ppp __P((int)); >+static void pppoatm_do_send_config __P((int, u_int32_t, int, int)); >+static void pppoatm_recv_config __P((int, u_int32_t, int, int)); >+static void pppoatm_cleanup __P((void)); >+static void pppoatm_close __P((void)); >+ >+char pppd_version[] = VERSION; >+ >+static struct pppoatm_globals { >+ struct sockaddr_atmpvc pvcaddr; >+ int pppoatm_max_mtu, pppoatm_max_mru; >+ int real_ttyfd; /* fd for actual serial port */ >+#ifndef OPT_UTILS >+ bool lockflag; /* Create lock file to lock the serial dev */ >+#endif >+#if 0 >+ bool pppoatm_accept; >+#endif >+ bool llc_encaps; >+ bool vc_encaps; >+ char *qosstr; >+ struct atm_qos qos; >+} glb; >+ >+extern uid_t uid; >+extern int kill_link; >+ >+static int pppoatm_setdevname __P((char *, char **, int)); >+ >+static option_t pppoatm_options[] = { >+ /* device name must be first, or change pppoatm_connect() below! */ >+ { "device name", o_wild, (void *) &pppoatm_setdevname, >+ "atm itf.vpi.vpc", >+ OPT_DEVNAM | OPT_PRIVFIX | OPT_NOARG | OPT_A2STRVAL | OPT_STATIC, >+ devnam}, >+ >+#ifdef OPT_UTILS >+ lock_option, >+ nolock_option, >+ record_option, >+#else >+ { "lock", o_bool, &glb.lockflag, /* We ignore glb.lockflag */ >+ "Lock serial device with UUCP-style lock file", OPT_PRIO | 1 }, >+ { "nolock", o_bool, &glb.lockflag, >+ "Don't lock serial device", OPT_PRIOSUB | OPT_PRIV }, >+#endif >+ >+#if 0 >+ { "accept", o_bool, &glb.pppoatm_accept, >+ "set PPPoATM socket to accept incoming connections", >+ 1 }, >+#endif >+ { "llc-encaps", o_bool, &glb.llc_encaps, >+ "use LLC encapsulation for PPPoATM", >+ 1}, >+ { "vc-encaps", o_bool, &glb.vc_encaps, >+ "use VC multiplexing for PPPoATM (default)", >+ 1}, >+ { "qos", o_string, &glb.qosstr, >+ "set QoS for PPPoATM connection", >+ 1}, >+ { NULL } >+}; >+ >+static >+struct channel pppoatm_channel = { >+ options: pppoatm_options, >+ process_extra_options: &pppoatm_process_extra_options, >+ check_options: &pppoatm_check_options, >+ connect: &pppoatm_connect, >+ disconnect: &pppoatm_disconnect, >+ establish_ppp: &pppoatm_establish_ppp, >+ disestablish_ppp: &pppoatm_disestablish_ppp, >+ send_config: &pppoatm_do_send_config, >+ recv_config: &pppoatm_recv_config, >+ cleanup: &pppoatm_cleanup, >+ close: &pppoatm_close >+}; >+ >+/* >+ * pppoatm_setdevname - Set the device name. >+ * If doit is 0, the call is to check whether this option is >+ * potentially a device name. >+ */ >+static >+int pppoatm_setdevname(char *cp, char **argv, int doit) >+{ >+ Dinfo("In %s doit=%d", __FUNCTION__, doit); >+ >+ if (*cp == 0) >+ return 0; >+ >+ if (doit == 0) { >+ struct sockaddr_atmpvc addr; >+ >+ memset(&addr, 0, sizeof(addr)); >+ if (text2atm(cp, (struct sockaddr *) &addr, sizeof(addr), >+ T2A_PVC | T2A_NAME) < 0) >+ return 0; >+ memcpy(&glb.pvcaddr, &addr, sizeof(glb.pvcaddr)); >+ } >+ >+ strlcpy(devnam, cp, sizeof(devnam)); >+ >+ if (doit) >+ default_device = 0; >+ >+ return 1; >+} >+ >+/* >+ * pppoatm_do_send_config - set transmit-side PPP configuration. >+ */ >+static >+void pppoatm_do_send_config(int mtu, u_int32_t accm, int pcomp, int accomp) >+{ >+ int sock; >+ struct ifreq ifr; >+ >+ Dinfo("In %s", __FUNCTION__); >+ >+ if (mtu > glb.pppoatm_max_mtu) { >+ warn("Couldn't increase MTU to %d", mtu); >+ mtu = glb.pppoatm_max_mtu; >+ } >+ >+ sock = socket(AF_INET, SOCK_DGRAM, 0); >+ if (sock < 0) >+ fatal("Couldn't create IP socket: %m"); >+ strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); >+ ifr.ifr_mtu = mtu; >+ if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0) >+ fatal("ioctl(SIOCSIFMTU): %m"); >+ (void) close (sock); >+} >+ >+static >+void pppoatm_recv_config(int mru, u_int32_t asyncmap, int pcomp, int accomp) >+{ >+ Dinfo("In %s", __FUNCTION__); >+ >+ if (mru > glb.pppoatm_max_mru) >+ error("Couldn't increase MRU to %d", mru); >+} >+ >+void plugin_init(void) >+{ >+ Dinfo("In %s", __FUNCTION__); >+ >+ the_channel = &pppoatm_channel; >+ >+ lcp_allowoptions[0].asyncmap = 0; >+ >+ lcp_wantoptions[0].neg_accompression = 0; >+ lcp_allowoptions[0].neg_accompression = 0; >+ >+ lcp_wantoptions[0].neg_asyncmap = 0; >+ lcp_allowoptions[0].neg_asyncmap = 0; >+ >+ lcp_wantoptions[0].neg_pcompression = 0; >+} >+ >+static >+int options_for_pppoatm(void) { >+ char atm_devnam[sizeof(devnam)]; >+ int res; >+ >+ Dinfo("In %s", __FUNCTION__); >+ >+ strcpy(atm_devnam, devnam); >+ strcpy(devnam, "atm"); >+ strlcat(devnam, atm_devnam, sizeof(devnam)); >+ res = options_for_tty(); >+ strcpy(devnam, atm_devnam); >+ return res; >+} >+ >+static >+void pppoatm_process_extra_options(void) >+{ >+ Dinfo("In %s", __FUNCTION__); >+ >+ if (!options_for_pppoatm()) >+ exit(EXIT_OPTION_ERROR); >+} >+ >+/* >+ * pppoatm_check_options - do consistency checks on the options we were given. >+ */ >+static >+void pppoatm_check_options(void) >+{ >+ Dinfo("In %s", __FUNCTION__); >+ >+#if defined(__linux__) >+ { >+ extern int new_style_driver; /* From sys-linux.c */ >+ >+ if (!new_style_driver) { >+ option_error("Kernel doesn't support ppp_generic - " >+ "needed for PPPoATM"); >+ exit(EXIT_OPTION_ERROR); >+ } >+ } >+#else >+ option_error("No PPPoATM support on this OS"); >+ exit(EXIT_OPTION_ERROR); >+#endif >+ >+ if (!devnam[0]) { >+ option_error("No [itf.]vpi.vci specified"); >+ exit(EXIT_OPTION_ERROR); >+ } >+ >+ memset(&glb.qos, 0, sizeof(glb.qos)); >+ glb.qos.txtp.traffic_class = glb.qos.rxtp.traffic_class = ATM_UBR; >+ >+ if (glb.qosstr != NULL) >+ if (text2qos(glb.qosstr, &glb.qos, 0)) { >+ option_error("Can't parse QoS: \"%s\"", glb.qosstr); >+ exit(EXIT_OPTION_ERROR); >+ } >+ >+ glb.qos.aal = ATM_AAL5; >+} >+ >+static >+int pppoatm_connect(void) >+{ >+ int state; >+ >+ Dinfo("In %s", __FUNCTION__); >+ >+ glb.real_ttyfd = -1; >+ >+ strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam)); >+ >+ hungup = 0; >+ kill_link = 0; >+ >+ for (state = 0;;) { >+ /* If the user specified the device name, become the >+ user before opening it. */ >+ >+ if (pppoatm_options[0].priority < OPRIO_ROOT) >+ seteuid(uid); >+ >+ errno = 0; >+ >+ switch (state) { >+ case 0: >+ if ((glb.real_ttyfd = socket(AF_ATMPVC, SOCK_DGRAM, 0)) == -1) { >+ error("socket(AF_ATMPVC, SOCK_DGRAM, 0): %m"); >+ break; >+ } >+ state++; >+ case 1: >+#define pppoatm_overhead() (glb.llc_encaps ? (4+2) : 2) >+ >+ glb.qos.txtp.max_sdu = lcp_allowoptions[0].mru + pppoatm_overhead(); >+ glb.qos.rxtp.max_sdu = lcp_wantoptions[0].mru + pppoatm_overhead(); >+ >+ if (setsockopt(glb.real_ttyfd, SOL_ATM, SO_ATMQOS, &glb.qos, sizeof(glb.qos)) < 0) { >+ error("setsockopt(SO_ATMQOS): %m"); >+ break; >+ } >+ state++; >+ case 2: >+ /* TODO: accept on SVCs... see glb.pppoatm_accept */ >+ if (connect(glb.real_ttyfd, (struct sockaddr *) &glb.pvcaddr, >+ sizeof(struct sockaddr_atmpvc))) { >+ error("connect(%s): %m", devnam); >+ break; >+ } >+ state++; >+ default: >+ case 3: >+ glb.pppoatm_max_mtu = lcp_allowoptions[0].mru; >+ glb.pppoatm_max_mru = lcp_wantoptions[0].mru; >+ >+ break; >+ } >+ >+ if (pppoatm_options[0].priority < OPRIO_ROOT) { >+ int err = errno; >+ >+ seteuid(0); >+ errno = err; >+ } >+ >+ if (state == 3) >+ break; >+ >+ if (!persist || errno != EINTR) { >+ if (glb.real_ttyfd >= 0) { >+ close(glb.real_ttyfd); >+ glb.real_ttyfd = -1; >+ } >+ >+ error("Failed to open %s: %m", devnam); >+ break; >+ } >+ } >+ >+ if (glb.real_ttyfd == -1) >+ status = EXIT_OPEN_FAILED; >+ >+ return glb.real_ttyfd; >+} >+ >+static >+void pppoatm_disconnect(void) { >+ Dinfo("In %s", __FUNCTION__); >+} >+ >+static >+int pppoatm_establish_ppp (int tty_fd) { >+ struct atm_backend_ppp be; >+ >+ Dinfo("In %s", __FUNCTION__); >+ >+ be.backend_num = ATM_BACKEND_PPP; >+ if (!glb.llc_encaps) >+ be.encaps = PPPOATM_ENCAPS_VC; >+ else if (!glb.vc_encaps) >+ be.encaps = PPPOATM_ENCAPS_LLC; >+ else >+ be.encaps = PPPOATM_ENCAPS_AUTODETECT; >+ if (ioctl(tty_fd, ATM_SETBACKEND, &be) < 0) { >+ error("ioctl(ATM_SETBACKEND): %m"); >+ return -1; >+ } >+ >+ return generic_establish_ppp(tty_fd); >+} >+ >+static >+void pppoatm_disestablish_ppp(int tty_fd) { >+ atm_backend_t be = ATM_BACKEND_RAW; >+ >+ Dinfo("In %s", __FUNCTION__); >+ >+ /* 2.4 doesn't support this yet */ >+ (void) ioctl(tty_fd, ATM_SETBACKEND, &be); >+ >+ generic_disestablish_ppp(tty_fd); >+} >+ >+static >+void pppoatm_cleanup(void) >+{ >+ Dinfo("In %s", __FUNCTION__); >+ >+ pppoatm_close(); >+} >+ >+static >+void pppoatm_close(void) >+{ >+ Dinfo("In %s", __FUNCTION__); >+ >+ if (glb.real_ttyfd >= 0) { >+ close(glb.real_ttyfd); >+ glb.real_ttyfd = -1; >+ } >+} >+/* The end */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 47574
:
29122
| 29399