diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2005-10-26 16:41:59 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2005-10-26 16:41:59 +0000 |
commit | 1e34f3f20cab3d81a0b7bc263fbc580a0985893e (patch) | |
tree | 840b68c94ce5e0a7cabeb61126ce151b275fa53f /c/src | |
parent | Remove (diff) | |
download | rtems-1e34f3f20cab3d81a0b7bc263fbc580a0985893e.tar.bz2 |
Remove (Moved to cpukit).
Diffstat (limited to '')
51 files changed, 0 insertions, 20798 deletions
diff --git a/c/src/libnetworking/Makefile.am b/c/src/libnetworking/Makefile.am deleted file mode 100644 index 247c85953e..0000000000 --- a/c/src/libnetworking/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -## -## $Id$ -## - -SUBDIRS = pppd - -include $(top_srcdir)/automake/subdirs.am -include $(top_srcdir)/automake/local.am diff --git a/c/src/libnetworking/pppd/Makefile.am b/c/src/libnetworking/pppd/Makefile.am deleted file mode 100644 index 76411c23a1..0000000000 --- a/c/src/libnetworking/pppd/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -## -## $Id$ -## - -include $(top_srcdir)/automake/compile.am - -noinst_LIBRARIES = - -if HAS_NETWORKING -include_rtemsdir = $(includedir)/rtems -include_rtems_HEADERS = rtemspppd.h rtemsdialer.h - -noinst_LIBRARIES += libpppd.a -libpppd_a_SOURCES = auth.c ccp.c ccp.h chap.c chap.h chap_ms.c chap_ms.h \ - chat.c demand.c fsm.c fsm.h ipcp.c ipcp.h lcp.c lcp.h magic.c magic.h \ - options.c upap.c upap.h md4.c md4.h md5.c md5.h utils.c sys-rtems.c \ - rtemsmain.c rtemspppd.c pppd.h patchlevel.h pathnames.h -libpppd_a_CPPFLAGS = $(AM_CPPFLAGS) -D__BSD_VISIBLE -endif - -# FIXME: Move sources to libpppd_a_SOURCES, remove other files. -EXTRA_DIST = ipxcp.c ipxcp.h - -all-local: $(PREINSTALL_FILES) - -CLEANFILES = $(PREINSTALL_FILES) -DISTCLEANFILES = $(PREINSTALL_DIRS) - -include $(srcdir)/preinstall.am - -include $(top_srcdir)/automake/local.am diff --git a/c/src/libnetworking/pppd/README b/c/src/libnetworking/pppd/README deleted file mode 100644 index 28c9f7ef5d..0000000000 --- a/c/src/libnetworking/pppd/README +++ /dev/null @@ -1,29 +0,0 @@ -# -# $Id$ -# - -This directory contains a port of ppp-2.3.11. The official site for -the original source for this PPP implementation is: - -ftp://cs.anu.edu.au/pub/software/ppp - -================================================================ -History - -The original port was of 2.3.5 by Tomasz Domin <dot@comarch.pl> of -ComArch SA and was initially only tested on the mpc823. He -provided the modem driver as well. - -The port was updated to 2.3.11 by Mike Siers <mikes@poliac.com> -who added an example test. - -Updated the chat program to return the correct errors and support -the ABORT commands. Removed some dead code and did a lot of -testing on a new Coldfire BSP. Version seems to be very stable. - -Update code to use RTEMS pppd network drivers. Now the pppd -software is not dependent on using task driven mode. This -change improved stablity and performance. This was updated -by Mike Siers <mikes@poliac.com>. -================================================================= - diff --git a/c/src/libnetworking/pppd/STATUS b/c/src/libnetworking/pppd/STATUS deleted file mode 100644 index 4c0d35d423..0000000000 --- a/c/src/libnetworking/pppd/STATUS +++ /dev/null @@ -1,27 +0,0 @@ -# -# $Id$ -# - -The pppd application seems to very stable. It has been tested using -the example application with the i386/pc586 and m68k/sbc5206e BSPs. -The tests were executed using a null modem serial cable to connect -with a UNIX box running either the ppp or pppd application and with -an external modem to dial up a local ISP. - -If you have problems getting your target to make consistent connections -with an ISP, the problem is most likely with the ppp options. First -try using the "novj" and "noaccomp" options. If you have questions -about what other option values are available for the rtems_pppd_set_option -function, please look at the pppd.8 man page file or the the source code. -The majority of options that are documented in man page should work -with this function call. - -The pppd code had now been updated to use it's own RTEMS network -drivers. This removes the requirement for the task driven termios -support. This update has fixed the large packet ping problem. -Currently, I do not know of any problems with the port. - -If you find any other problems or fix some problems, please post your -changes to the RTEMS mailing list. - -Good Luck diff --git a/c/src/libnetworking/pppd/auth.c b/c/src/libnetworking/pppd/auth.c deleted file mode 100644 index a92654a650..0000000000 --- a/c/src/libnetworking/pppd/auth.c +++ /dev/null @@ -1,1121 +0,0 @@ -/* - * auth.c - PPP authentication and phase control. - * - * Copyright (c) 1993 The Australian National University. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the Australian National University. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Copyright (c) 1989 Carnegie Mellon University. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by Carnegie Mellon University. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#define RCSID "$Id$" - -#include <stdio.h> -#include <stddef.h> -#include <stdlib.h> -#include <unistd.h> -#include <pwd.h> -#include <grp.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/socket.h> -#include <fcntl.h> -#if defined(_PATH_LASTLOG) && defined(_linux_) -#include <lastlog.h> -#endif - -#include <netdb.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -#ifdef USE_PAM -#include <security/pam_appl.h> -#endif - -#ifdef HAS_SHADOW -#include <shadow.h> -#ifndef PW_PPP -#define PW_PPP PW_LOGIN -#endif -#endif - -#include "pppd.h" -#include "fsm.h" -#include "lcp.h" -#include "ipcp.h" -#include "upap.h" -#include "chap.h" -#ifdef CBCP_SUPPORT -#include "cbcp.h" -#endif -#include "pathnames.h" - -static const char rcsid[] = RCSID; - -/* The name by which the peer authenticated itself to us. */ -char peer_authname[MAXNAMELEN]; - -/* Records which authentication operations haven't completed yet. */ -static int auth_pending[NUM_PPP]; - -/* List of addresses which the peer may use. */ -static struct permitted_ip *addresses[NUM_PPP]; - -/* Wordlist giving addresses which the peer may use - without authenticating itself. */ -static struct wordlist *noauth_addrs; - -/* Extra options to apply, from the secrets file entry for the peer. */ -static struct wordlist *extra_options; - -/* Number of network protocols which we have opened. */ -static int num_np_open; - -/* Number of network protocols which have come up. */ -static int num_np_up; - -/* Set if we got the contents of passwd[] from the pap-secrets file. */ -static int passwd_from_file; - -/* Set if we require authentication only because we have a default route. */ -static bool default_auth; - -/* Hook for a link status */ -void (*auth_linkup_hook)__P((void)) = NULL; -void (*auth_linkdown_hook)__P((void)) = NULL; - -/* Hook to enable a plugin to control the idle time limit */ -int (*idle_time_hook) __P((struct ppp_idle *)) = NULL; - -/* Hook for a plugin to say whether we can possibly authenticate any peer */ -int (*pap_check_hook) __P((void)) = NULL; - -/* Hook for a plugin to check the PAP user and password */ -int (*pap_auth_hook) __P((char *user, char *passwd/*, char **msgp, - struct wordlist **paddrs, - struct wordlist **popts*/)) = NULL; - -/* Hook for a plugin to know about the PAP user logout */ -void (*pap_logout_hook) __P((void)) = NULL; - -/* Hook for a plugin to get the PAP password for authenticating us */ -int (*pap_passwd_hook) __P((char *user, char *passwd)) = NULL; - -/* - * This is used to ensure that we don't start an auth-up/down - * script while one is already running. - */ -enum script_state { - s_down, - s_up -}; - -static enum script_state auth_state = s_down; -static enum script_state auth_script_state = s_down; - -/* - * Option variables. - */ -bool uselogin = 0; /* Use /etc/passwd for checking PAP */ -bool cryptpap = 0; /* Passwords in pap-secrets are encrypted */ -bool refuse_pap = 0; /* Don't wanna auth. ourselves with PAP */ -bool refuse_chap = 0; /* Don't wanna auth. ourselves with CHAP */ -bool usehostname = 0; /* Use hostname for our_name */ -bool auth_required = 0; /* Always require authentication from peer */ -bool allow_any_ip = 0; /* Allow peer to use any IP address */ -bool explicit_remote = 0; /* User specified explicit remote name */ -char remote_name[MAXNAMELEN]; /* Peer's name for authentication */ - -/* Bits in auth_pending[] */ -#define PAP_WITHPEER 1 -#define PAP_PEER 2 -#define CHAP_WITHPEER 4 -#define CHAP_PEER 8 - -extern char *crypt __P((const char *, const char *)); - -/* Prototypes for procedures local to this file. */ - -static void network_phase __P((int)); -static void check_idle __P((void *)); -static void connect_time_expired __P((void *)); -static int null_login __P((int)); -static int get_pap_passwd __P((char *)); -static int have_pap_secret __P((int *)); -static int have_chap_secret __P((char *, char *, int, int *)); -#if 0 -static int ip_addr_check __P((u_int32_t, struct permitted_ip *)); -#endif -static void free_wordlist __P((struct wordlist *)); -static void auth_script __P((enum script_state s)); -static void set_allowed_addrs __P((int, struct wordlist *, struct wordlist *)); - - -/* - * Authentication-related options. - */ -option_t auth_options[] = { - { "require-pap", o_bool, &lcp_wantoptions[0].neg_upap, - "Require PAP authentication from peer", 1, &auth_required }, - { "+pap", o_bool, &lcp_wantoptions[0].neg_upap, - "Require PAP authentication from peer", 1, &auth_required }, - { "refuse-pap", o_bool, &refuse_pap, - "Don't agree to auth to peer with PAP", 1 }, - { "-pap", o_bool, &refuse_pap, - "Don't allow PAP authentication with peer", 1 }, - { "require-chap", o_bool, &lcp_wantoptions[0].neg_chap, - "Require CHAP authentication from peer", 1, &auth_required }, - { "+chap", o_bool, &lcp_wantoptions[0].neg_chap, - "Require CHAP authentication from peer", 1, &auth_required }, - { "refuse-chap", o_bool, &refuse_chap, - "Don't agree to auth to peer with CHAP", 1 }, - { "-chap", o_bool, &refuse_chap, - "Don't allow CHAP authentication with peer", 1 }, - { "name", o_string, our_name, - "Set local name for authentication", - OPT_PRIV|OPT_STATIC, NULL, MAXNAMELEN }, - { "user", o_string, user, - "Set name for auth with peer", OPT_STATIC, NULL, MAXNAMELEN }, - { "usehostname", o_bool, &usehostname, - "Must use hostname for authentication", 1 }, - { "remotename", o_string, remote_name, - "Set remote name for authentication", OPT_STATIC, - &explicit_remote, MAXNAMELEN }, - { "auth", o_bool, &auth_required, - "Require authentication from peer", 1 }, - { "noauth", o_bool, &auth_required, - "Don't require peer to authenticate", OPT_PRIV, &allow_any_ip }, - { "login", o_bool, &uselogin, - "Use system password database for PAP", 1 }, - { "papcrypt", o_bool, &cryptpap, - "PAP passwords are encrypted", 1 }, -/* Removed for RTEMS PORT - { "+ua", o_special, setupapfile, - "Get PAP user and password from file" }, -*/ - { "password", o_string, passwd, - "Password for authenticating us to the peer", OPT_STATIC, - NULL, MAXSECRETLEN }, -/* Removed for RTEMS_PORT - { "privgroup", o_special, privgroup, - "Allow group members to use privileged options", OPT_PRIV }, - { "allow-ip", o_special, set_noauth_addr, - "Set IP address(es) which can be used without authentication", - OPT_PRIV }, -*/ - { NULL } -}; - -/* - * An Open on LCP has requested a change from Dead to Establish phase. - * Do what's necessary to bring the physical layer up. - */ -void -link_required(unit) - int unit; -{ -} - -/* - * LCP has terminated the link; go to the Dead phase and take the - * physical layer down. - */ -void -link_terminated(unit) - int unit; -{ - if (pppd_phase == PHASE_DEAD) - return; - if (pap_logout_hook) { - pap_logout_hook(); - } - new_phase(PHASE_DEAD); - notice("Connection terminated."); -} - -/* - * LCP has gone down; it will either die or try to re-establish. - */ -void -link_down(unit) - int unit; -{ - int i; - struct protent *protp; - - auth_state = s_down; - if (auth_script_state == s_up) { - update_link_stats(unit); - auth_script(s_down); - } - for (i = 0; (protp = protocols[i]) != NULL; ++i) { - if (!protp->enabled_flag) - continue; - if (protp->protocol != PPP_LCP && protp->lowerdown != NULL) - (*protp->lowerdown)(unit); - if (protp->protocol < 0xC000 && protp->close != NULL) - (*protp->close)(unit, "LCP down"); - } - num_np_open = 0; - num_np_up = 0; - if (pppd_phase != PHASE_DEAD) - new_phase(PHASE_TERMINATE); -} - -/* - * The link is established. - * Proceed to the Dead, Authenticate or Network phase as appropriate. - */ -void -link_established(unit) - int unit; -{ - int auth; - lcp_options *wo = &lcp_wantoptions[unit]; - lcp_options *go = &lcp_gotoptions[unit]; - lcp_options *ho = &lcp_hisoptions[unit]; - int i; - struct protent *protp; - - /* - * Tell higher-level protocols that LCP is up. - */ - for (i = 0; (protp = protocols[i]) != NULL; ++i) - if (protp->protocol != PPP_LCP && protp->enabled_flag - && protp->lowerup != NULL) - (*protp->lowerup)(unit); - - if (auth_required && !(go->neg_chap || go->neg_upap)) { - /* - * We wanted the peer to authenticate itself, and it refused: - * if we have some address(es) it can use without auth, fine, - * otherwise treat it as though it authenticated with PAP using - * a username * of "" and a password of "". If that's not OK, - * boot it out. - */ - if (noauth_addrs != NULL) { - set_allowed_addrs(unit, noauth_addrs, NULL); - } else if (!wo->neg_upap || !null_login(unit)) { - warn("peer refused to authenticate: terminating link"); - lcp_close(unit, "peer refused to authenticate"); - pppd_status = EXIT_PEER_AUTH_FAILED; - return; - } - } - - new_phase(PHASE_AUTHENTICATE); - auth = 0; - if (go->neg_chap) { - ChapAuthPeer(unit, our_name, go->chap_mdtype); - auth |= CHAP_PEER; - } else if (go->neg_upap) { - upap_authpeer(unit); - auth |= PAP_PEER; - } - if (ho->neg_chap) { - ChapAuthWithPeer(unit, user, ho->chap_mdtype); - auth |= CHAP_WITHPEER; - } else if (ho->neg_upap) { - if (passwd[0] == 0) { - passwd_from_file = 1; - if (!get_pap_passwd(passwd)) - error("No secret found for PAP login"); - } - upap_authwithpeer(unit, user, passwd); - auth |= PAP_WITHPEER; - } - auth_pending[unit] = auth; - - if (!auth) - network_phase(unit); -} - -/* - * Proceed to the network phase. - */ -static void -network_phase(unit) - int unit; -{ -#ifdef CBCP_SUPPORT - lcp_options *go = &lcp_gotoptions[unit]; -#endif - - /* always run the auth-up script */ - auth_state = s_up; - if (auth_script_state == s_down) { - auth_script(s_up); - } - -#ifdef CBCP_SUPPORT - /* - * If we negotiated callback, do it now. - */ - if (go->neg_cbcp) { - new_phase(PHASE_CALLBACK); - (*cbcp_protent.open)(unit); - return; - } -#endif - - /* - * Process extra options from the secrets file - */ - if (extra_options) { - options_from_list(extra_options, 1); - free_wordlist(extra_options); - extra_options = 0; - } - start_networks(); -} - -void -start_networks() -{ - int i; - struct protent *protp; - - new_phase(PHASE_NETWORK); - for (i = 0; (protp = protocols[i]) != NULL; ++i) - if (protp->protocol < 0xC000 && protp->enabled_flag - && protp->open != NULL) { - (*protp->open)(0); - if (protp->protocol != PPP_CCP) - ++num_np_open; - } - - if (num_np_open == 0) - /* nothing to do */ - lcp_close(0, "No network protocols running"); -} - -/* - * The peer has failed to authenticate himself using `protocol'. - */ -void -auth_peer_fail(unit, protocol) - int unit, protocol; -{ - /* - * Authentication failure: take the link down - */ - lcp_close(unit, "Authentication failed"); - pppd_status = EXIT_PEER_AUTH_FAILED; -} - -/* - * The peer has been successfully authenticated using `protocol'. - */ -void -auth_peer_success(unit, protocol, name, namelen) - int unit, protocol; - char *name; - int namelen; -{ - int bit; - - switch (protocol) { - case PPP_CHAP: - bit = CHAP_PEER; - break; - case PPP_PAP: - bit = PAP_PEER; - break; - default: - warn("auth_peer_success: unknown protocol %x", protocol); - return; - } - - /* - * Save the authenticated name of the peer for later. - */ - if (namelen > sizeof(peer_authname) - 1) - namelen = sizeof(peer_authname) - 1; - BCOPY(name, peer_authname, namelen); - peer_authname[namelen] = 0; - - /* - * If there is no more authentication still to be done, - * proceed to the network (or callback) phase. - */ - if ((auth_pending[unit] &= ~bit) == 0) - network_phase(unit); -} - -/* - * We have failed to authenticate ourselves to the peer using `protocol'. - */ -void -auth_withpeer_fail(unit, protocol) - int unit, protocol; -{ - if (passwd_from_file) - BZERO(passwd, MAXSECRETLEN); - /* - * We've failed to authenticate ourselves to our peer. - * Some servers keep sending CHAP challenges, but there - * is no point in persisting without any way to get updated - * authentication secrets. - */ - lcp_close(unit, "Failed to authenticate ourselves to peer"); - pppd_status = EXIT_AUTH_TOPEER_FAILED; -} - -/* - * We have successfully authenticated ourselves with the peer using `protocol'. - */ -void -auth_withpeer_success(unit, protocol) - int unit, protocol; -{ - int bit; - - switch (protocol) { - case PPP_CHAP: - bit = CHAP_WITHPEER; - break; - case PPP_PAP: - if (passwd_from_file) - BZERO(passwd, MAXSECRETLEN); - bit = PAP_WITHPEER; - break; - default: - warn("auth_withpeer_success: unknown protocol %x", protocol); - bit = 0; - } - - /* - * If there is no more authentication still being done, - * proceed to the network (or callback) phase. - */ - if ((auth_pending[unit] &= ~bit) == 0) - network_phase(unit); -} - - -/* - * np_up - a network protocol has come up. - */ -void -np_up(unit, proto) - int unit, proto; -{ - int tlim; - - if (num_np_up == 0) { - /* - * At this point we consider that the link has come up successfully. - */ - pppd_status = EXIT_OK; - unsuccess = 0; - new_phase(PHASE_RUNNING); - - if (idle_time_hook != 0) - tlim = (*idle_time_hook)(NULL); - else - tlim = idle_time_limit; - if (tlim > 0) - TIMEOUT(check_idle, NULL, tlim); - - /* - * Set a timeout to close the connection once the maximum - * connect time has expired. - */ - if (maxconnect > 0) - TIMEOUT(connect_time_expired, 0, maxconnect); - } - ++num_np_up; -} - -/* - * np_down - a network protocol has gone down. - */ -void -np_down(unit, proto) - int unit, proto; -{ - if (--num_np_up == 0) { - UNTIMEOUT(check_idle, NULL); - new_phase(PHASE_NETWORK); - } -} - -/* - * np_finished - a network protocol has finished using the link. - */ -void -np_finished(unit, proto) - int unit, proto; -{ - if (--num_np_open <= 0) { - /* no further use for the link: shut up shop. */ - lcp_close(0, "No network protocols running"); - } -} - -/* - * check_idle - check whether the link has been idle for long - * enough that we can shut it down. - */ -static void -check_idle(arg) - void *arg; -{ - struct ppp_idle idle; - time_t itime; - int tlim; - - if (!get_idle_time(0, &idle)) - return; - if (idle_time_hook != 0) { - tlim = idle_time_hook(&idle); - } else { |