fixed most PPP compilation warnings with -pedantic

This commit is contained in:
Sylvain Rochet 2012-06-02 21:25:58 +02:00
parent d143acfc76
commit 44c2a0a7fc
8 changed files with 106 additions and 78 deletions

View File

@ -223,15 +223,15 @@ struct notifier *link_down_notifier = NULL;
bool uselogin = 0; /* Use /etc/passwd for checking PAP */
bool session_mgmt = 0; /* Do session management (login records) */
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 refuse_eap = 0; /* Don't wanna auth. ourselves with EAP */
bool refuse_pap = 0; /* Don't wanna auth. ourselves with PAP */
bool refuse_chap = 0; /* Don't wanna auth. ourselves with CHAP */
bool refuse_eap = 0; /* Don't wanna auth. ourselves with EAP */
#if MSCHAP_SUPPORT
//bool refuse_mschap = 0; /* Don't wanna auth. ourselves with MS-CHAP */
//bool refuse_mschap_v2 = 0; /* Don't wanna auth. oif 0 /* UNUSED */urselves with MS-CHAPv2 */
bool refuse_mschap = 0; /* Don't wanna auth. ourselves with MS-CHAP */
bool refuse_mschap_v2 = 0; /* Don't wanna auth. ourselves with MS-CHAPv2 */
#else /* MSCHAP_SUPPORT */
//bool refuse_mschap = 1; /* Don't wanna auth. ourselves with MS-CHAP */
//bool refuse_mschap_v2 = 1; /* Don't wanna auth. ourselves with MS-CHAPv2 */
bool refuse_mschap = 1; /* Don't wanna auth. ourselves with MS-CHAP */
bool refuse_mschap_v2 = 1; /* Don't wanna auth. ourselves with MS-CHAPv2 */
#endif /* MSCHAP_SUPPORT */
#endif /* MOVED TO ppp_settings */
#if 0 /* UNUSED */
@ -1079,7 +1079,9 @@ auth_peer_success(unit, protocol, prot_flavor, name, namelen)
namelen = sizeof(peer_authname) - 1;
MEMCPY(peer_authname, name, namelen);
peer_authname[namelen] = 0;
//script_setenv("PEERNAME", peer_authname, 0);
#if 0 /* UNUSED */
script_setenv("PEERNAME", peer_authname, 0);
#endif /* UNUSED */
/* Save the authentication method for later. */
auth_done[unit] |= bit;
@ -1538,7 +1540,7 @@ auth_reset(unit)
#endif /* EAP_SUPPORT */
#if 0 /* OLD CODE */
//ao->neg_upap = !ppp_settings.refuse_pap && (ppp_settings.passwd[0] != 0 || get_pap_passwd(NULL));
ao->neg_upap = !ppp_settings.refuse_pap && (ppp_settings.passwd[0] != 0 || get_pap_passwd(NULL));
/*
ao->neg_chap = (!ppp_settings.refuse_chap || !refuse_mschap || !refuse_mschap_v2)
@ -1978,7 +1980,7 @@ get_secret(unit, client, server, secret, secret_len, am_server)
/* FIXME: clean that */
#if 0
// strlcpy(rname, ppp_settings.user, sizeof(rname));
strlcpy(rname, ppp_settings.user, sizeof(rname));
/*

View File

@ -304,7 +304,7 @@ struct protent ipcp_protent = {
#endif /* DEMAND_SUPPORT */
};
static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t, bool));
static void ipcp_clear_addrs(int unit, u_int32_t ouraddr, u_int32_t hisaddr, bool replacedefaultroute);
/*
* Lengths of configuration options.
@ -2038,13 +2038,8 @@ ipcp_down(f)
* ipcp_clear_addrs() - clear the interface addresses, routes,
* proxy arp entries, etc.
*/
static void
ipcp_clear_addrs(unit, ouraddr, hisaddr, replacedefaultroute)
int unit;
u_int32_t ouraddr; /* local address */
u_int32_t hisaddr; /* remote address */
bool replacedefaultroute;
{
static void ipcp_clear_addrs(int unit, u_int32_t ouraddr, u_int32_t hisaddr, bool replacedefaultroute) {
if (proxy_arp_set[unit]) {
cifproxyarp(unit, hisaddr);
proxy_arp_set[unit] = 0;

View File

@ -731,22 +731,27 @@ lcp_cilen(f)
#if EAP_SUPPORT
LENCISHORT(go->neg_eap) +
#endif /* EAP_SUPPORT */
#if CHAP_SUPPORT
LENCICHAP(
#if CHAP_SUPPORT /* cannot be improved, embedding a directive within macro arguments is not portable */
#if EAP_SUPPORT
!go->neg_eap &&
LENCICHAP(!go->neg_eap && go->neg_chap) +
#endif /* EAP_SUPPORT */
go->neg_chap) +
#if !EAP_SUPPORT
LENCICHAP(go->neg_chap) +
#endif /* !EAP_SUPPORT */
#endif /* CHAP_SUPPORT */
#if PAP_SUPPORT
LENCISHORT(
#if EAP_SUPPORT
!go->neg_eap &&
#endif /* EAP_SUPPORT */
#if CHAP_SUPPORT
!go->neg_chap &&
#endif /* CHAP_SUPPORT */
go->neg_upap) +
#if PAP_SUPPORT /* cannot be improved, embedding a directive within macro arguments is not portable */
#if EAP_SUPPORT && CHAP_SUPPORT
LENCISHORT(!go->neg_eap && !go->neg_chap && go->neg_upap) +
#endif /* EAP_SUPPORT && CHAP_SUPPORT */
#if EAP_SUPPORT && !CHAP_SUPPORT
LENCISHORT(!go->neg_eap && go->neg_upap) +
#endif /* EAP_SUPPORT && !CHAP_SUPPORT */
#if !EAP_SUPPORT && CHAP_SUPPORT
LENCISHORT(!go->neg_chap && go->neg_upap) +
#endif /* !EAP_SUPPORT && CHAP_SUPPORT */
#if !EAP_SUPPORT && !CHAP_SUPPORT
LENCISHORT(go->neg_upap) +
#endif /* !EAP_SUPPORT && !CHAP_SUPPORT */
#endif /* PAP_SUPPORT */
LENCILQR(go->neg_lqr) +
LENCICBCP(go->neg_cbcp) +
@ -826,22 +831,27 @@ lcp_addci(f, ucp, lenp)
#if EAP_SUPPORT
ADDCISHORT(CI_AUTHTYPE, go->neg_eap, PPP_EAP);
#endif /* EAP_SUPPORT */
#if CHAP_SUPPORT
ADDCICHAP(CI_AUTHTYPE,
#if CHAP_SUPPORT /* cannot be improved, embedding a directive within macro arguments is not portable */
#if EAP_SUPPORT
!go->neg_eap &&
ADDCICHAP(CI_AUTHTYPE, !go->neg_eap && go->neg_chap, go->chap_mdtype);
#endif /* EAP_SUPPORT */
go->neg_chap, go->chap_mdtype);
#if !EAP_SUPPORT
ADDCICHAP(CI_AUTHTYPE, go->neg_chap, go->chap_mdtype);
#endif /* !EAP_SUPPORT */
#endif /* CHAP_SUPPORT */
#if PAP_SUPPORT
ADDCISHORT(CI_AUTHTYPE,
#if EAP_SUPPORT
!go->neg_eap &&
#endif /* EAP_SUPPORT */
#if CHAP_SUPPORT
!go->neg_chap &&
#endif /* CHAP_SUPPORT */
go->neg_upap, PPP_PAP);
#if PAP_SUPPORT /* cannot be improved, embedding a directive within macro arguments is not portable */
#if EAP_SUPPORT && CHAP_SUPPORT
ADDCISHORT(CI_AUTHTYPE, !go->neg_eap && !go->neg_chap && go->neg_upap, PPP_PAP);
#endif /* EAP_SUPPORT && CHAP_SUPPORT */
#if EAP_SUPPORT && !CHAP_SUPPORT
ADDCISHORT(CI_AUTHTYPE, !go->neg_eap && go->neg_upap, PPP_PAP);
#endif /* EAP_SUPPORT && !CHAP_SUPPORT */
#if !EAP_SUPPORT && CHAP_SUPPORT
ADDCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP);
#endif /* !EAP_SUPPORT && CHAP_SUPPORT */
#if !EAP_SUPPORT && !CHAP_SUPPORT
ADDCISHORT(CI_AUTHTYPE, go->neg_upap, PPP_PAP);
#endif /* !EAP_SUPPORT && !CHAP_SUPPORT */
#endif /* PAP_SUPPORT */
ADDCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
ADDCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);
@ -993,22 +1003,27 @@ lcp_ackci(f, p, len)
#if EAP_SUPPORT
ACKCISHORT(CI_AUTHTYPE, go->neg_eap, PPP_EAP);
#endif /* EAP_SUPPORT */
#if CHAP_SUPPORT
ACKCICHAP(CI_AUTHTYPE,
#if CHAP_SUPPORT /* cannot be improved, embedding a directive within macro arguments is not portable */
#if EAP_SUPPORT
!go->neg_eap &&
ACKCICHAP(CI_AUTHTYPE, !go->neg_eap && go->neg_chap, go->chap_mdtype);
#endif /* EAP_SUPPORT */
go->neg_chap, go->chap_mdtype);
#if !EAP_SUPPORT
ACKCICHAP(CI_AUTHTYPE, go->neg_chap, go->chap_mdtype);
#endif /* !EAP_SUPPORT */
#endif /* CHAP_SUPPORT */
#if PAP_SUPPORT
ACKCISHORT(CI_AUTHTYPE,
#if EAP_SUPPORT
!go->neg_eap &&
#endif /* EAP_SUPPORT */
#if CHAP_SUPPORT
!go->neg_chap &&
#endif /* CHAP_SUPPORT */
go->neg_upap, PPP_PAP);
#if PAP_SUPPORT /* cannot be improved, embedding a directive within macro arguments is not portable */
#if EAP_SUPPORT && CHAP_SUPPORT
ACKCISHORT(CI_AUTHTYPE, !go->neg_eap && !go->neg_chap && go->neg_upap, PPP_PAP);
#endif /* EAP_SUPPORT && CHAP_SUPPORT */
#if EAP_SUPPORT && !CHAP_SUPPORT
ACKCISHORT(CI_AUTHTYPE, !go->neg_eap && go->neg_upap, PPP_PAP);
#endif /* EAP_SUPPORT && !CHAP_SUPPORT */
#if !EAP_SUPPORT && CHAP_SUPPORT
ACKCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP);
#endif /* !EAP_SUPPORT && CHAP_SUPPORT */
#if !EAP_SUPPORT && !CHAP_SUPPORT
ACKCISHORT(CI_AUTHTYPE, go->neg_upap, PPP_PAP);
#endif /* !EAP_SUPPORT && !CHAP_SUPPORT */
#endif /* PAP_SUPPORT */
ACKCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
ACKCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);

View File

@ -50,7 +50,9 @@
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
//#include <syslog.h>
#if 0
#include <syslog.h>
#endif
#include <string.h>
#include <pwd.h>
#ifdef PLUGIN
@ -94,12 +96,16 @@ struct option_value {
int debug = 0; /* Debug flag */
int kdebugflag = 0; /* Tell kernel to print debug messages */
int default_device = 1; /* Using /dev/tty or equivalent */
//char devnam[MAXPATHLEN]; /* Device name */
#if 0
char devnam[MAXPATHLEN]; /* Device name */
#endif
bool nodetach = 0; /* Don't detach from controlling tty */
bool updetach = 0; /* Detach once link is up */
int maxconnect = 0; /* Maximum connect time */
//char user[MAXNAMELEN]; /* Username for PAP */
//char passwd[MAXSECRETLEN]; /* Password for PAP */
#if 0
char user[MAXNAMELEN]; /* Username for PAP */
char passwd[MAXSECRETLEN]; /* Password for PAP */
#endif
bool persist = 0; /* Reopen link after it goes down */
char our_name[MAXNAMELEN]; /* Our name for authentication purposes */
#if DEMAND_SUPPORT
@ -114,14 +120,18 @@ int log_to_fd = 1; /* send log messages to this fd too */
#endif
bool log_default = 1; /* log_to_fd is default (stdout) */
int maxfail = 10; /* max # of unsuccessful connection attempts */
//char linkname[MAXPATHLEN]; /* logical name for link */
#if 0
char linkname[MAXPATHLEN]; /* logical name for link */
#endif
bool tune_kernel; /* may alter kernel settings */
int connect_delay = 1000; /* wait this many ms after connect script */
int req_unit = -1; /* requested interface unit */
bool multilink = 0; /* Enable multilink operation */
char *bundle_name = NULL; /* bundle name for multilink */
bool dump_options; /* print out option values */
//bool dryrun; /* print out option values and exit */
#if 0
bool dryrun; /* print out option values and exit */
#endif
char *domain; /* domain name set by domain option */
int child_wait = 5; /* # seconds to wait for children at exit */

View File

@ -736,7 +736,7 @@ void pppInProcOverEthernet(int pd, struct pbuf *pb) {
drop:
LINK_STATS_INC(link.drop);
// snmp_inc_ifindiscards(&pppControl[pd].netif);
snmp_inc_ifindiscards(&pppControl[pd].netif);
pbuf_free(pb);
return;
}
@ -744,8 +744,10 @@ drop:
void pppOverEthernetInitFailed(int pd) {
PPPControl* pc;
//pppHup(pd);
//pppStop(pd);
/* FIXME: re-enable that
* pppHup(pd);
* pppStop(pd);
*/
pc = &pppControl[pd];
pppoe_destroy(&pc->netif);
@ -827,7 +829,7 @@ static err_t pppifOutput(struct netif *netif, struct pbuf *pb, ip_addr_t *ipaddr
* and the peer will just drop it if it's not accepting it. */
if (pd < 0 || pd >= NUM_PPP || !pc->openFlag || !pb) {
PPPDEBUG(LOG_WARNING, ("pppifOutput[%d]: bad parms prot=%d pb=%p\n",
pd, PPP_IP, pb));
pd, PPP_IP, (void*)pb));
LINK_STATS_INC(link.opterr);
LINK_STATS_INC(link.drop);
snmp_inc_ifoutdiscards(netif);
@ -1168,8 +1170,10 @@ int sifaddr (int unit, u_int32_t our_adr, u_int32_t his_adr,
SMEMCPY(&pc->addrs.our_ipaddr, &our_adr, sizeof(our_adr));
SMEMCPY(&pc->addrs.his_ipaddr, &his_adr, sizeof(his_adr));
SMEMCPY(&pc->addrs.netmask, &net_mask, sizeof(net_mask));
// SMEMCPY(&pc->addrs.dns1, &ns1, sizeof(ns1));
// SMEMCPY(&pc->addrs.dns2, &ns2, sizeof(ns2));
/* FIXME: re-enable DNS
* SMEMCPY(&pc->addrs.dns1, &ns1, sizeof(ns1));
* SMEMCPY(&pc->addrs.dns2, &ns2, sizeof(ns2));
*/
}
return st;
}

View File

@ -281,8 +281,8 @@ struct ppp_settings {
char user [MAXNAMELEN + 1]; /* Username for PAP */
char passwd [MAXSECRETLEN + 1]; /* Password for PAP, secret for CHAP */
char our_name [MAXNAMELEN + 1]; /* Our name for authentication purposes */
// FIXME: re-enable that
// char remote_name[MAXNAMELEN + 1]; /* Peer's name for authentication */
/* FIXME: re-enable that */
/* char remote_name[MAXNAMELEN + 1]; */ /* Peer's name for authentication */
};
struct ppp_settings ppp_settings;
@ -315,12 +315,12 @@ int ppp_init(void);
*
*/
enum pppAuthType {
PPPAUTHTYPE_NONE,
PPPAUTHTYPE_ANY,
PPPAUTHTYPE_PAP,
#if CHAP_SUPPORT
PPPAUTHTYPE_CHAP,
#endif /* CHAP_SUPPORT */
PPPAUTHTYPE_PAP,
PPPAUTHTYPE_ANY,
PPPAUTHTYPE_NONE
};
int ppp_init(void);
@ -511,7 +511,7 @@ int get_secret __P((int, char *, char *, char *, int *, int));
/* get "secret" for chap */
/* Procedures exported from ipcp.c */
//int parse_dotted_ip __P((char *, u_int32_t *));
/* int parse_dotted_ip __P((char *, u_int32_t *)); */
/* Procedures exported from demand.c */
#if DEMAND_SUPPORT

View File

@ -950,7 +950,7 @@ start_charshunt(ifd, ofd)
{
int cpid;
cpid = -1; // safe_fork(ifd, ofd, (log_to_fd >= 0? log_to_fd: 2));
cpid = -1; /* safe_fork(ifd, ofd, (log_to_fd >= 0? log_to_fd: 2)); */
if (cpid == -1) {
error("Can't fork process for character shunt: %m");
return 0;

View File

@ -40,7 +40,9 @@
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
//#include <syslog.h>
#if 0
#include <syslog.h>
#endif
#include <netdb.h>
#include <time.h>
#include <utmp.h>
@ -678,7 +680,7 @@ log_write(level, buf)
char *buf;
{
/* FIXME: replace this with a log callback */
// if(level >= min_log_level) /* FIXME: add a minimum log level */
/* if(level >= min_log_level) */ /* FIXME: add a minimum log level */
printf("LOG: %s\n", buf);
#if 0
if (log_to_fd >= 0 && (level != LOG_DEBUG || debug)) {