diff options
author | brian <brian@FreeBSD.org> | 2004-09-05 01:46:52 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2004-09-05 01:46:52 +0000 |
commit | 6f864d0a973a7f3987d73132be311b7cfbd1ccfc (patch) | |
tree | fb5af1860e245ef67196527d9ba46e5c9e284bf6 | |
parent | 2f8e87b45e5735ee9774fce8bc8ffaf1fdc72657 (diff) | |
download | FreeBSD-src-6f864d0a973a7f3987d73132be311b7cfbd1ccfc.zip FreeBSD-src-6f864d0a973a7f3987d73132be311b7cfbd1ccfc.tar.gz |
Make ppp WARNS=5 clean
75 files changed, 608 insertions, 571 deletions
diff --git a/usr.sbin/ppp/Makefile b/usr.sbin/ppp/Makefile index 0739818..2937567 100644 --- a/usr.sbin/ppp/Makefile +++ b/usr.sbin/ppp/Makefile @@ -8,6 +8,7 @@ SRCS= acf.c arp.c async.c auth.c bundle.c cbcp.c ccp.c chap.c chat.c \ mbuf.c mp.c ncp.c ncpaddr.c pap.c physical.c pred.c probe.c prompt.c \ proto.c route.c server.c sig.c slcompress.c sync.c systems.c tcp.c \ tcpmss.c throughput.c timer.c tty.c tun.c udp.c vjcomp.c +WARNS?= 5 .if defined(RELEASE_CRUNCH) CFLAGS+=-DRELEASE_CRUNCH NOATM= true diff --git a/usr.sbin/ppp/acf.c b/usr.sbin/ppp/acf.c index 60e2de4..6c3ec05 100644 --- a/usr.sbin/ppp/acf.c +++ b/usr.sbin/ppp/acf.c @@ -56,8 +56,8 @@ acf_WrapperOctets(struct lcp *lcp, u_short proto) } static struct mbuf * -acf_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, - int pri, u_short *proto) +acf_LayerPush(struct bundle *b __unused, struct link *l, struct mbuf *bp, + int pri __unused, u_short *proto) { const u_char cp[2] = { HDLC_ADDR, HDLC_UI }; @@ -70,7 +70,8 @@ acf_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, } static struct mbuf * -acf_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, u_short *proto) +acf_LayerPull(struct bundle *b __unused, struct link *l, struct mbuf *bp, + u_short *proto __unused) { struct physical *p = link2physical(l); u_char cp[2]; diff --git a/usr.sbin/ppp/arp.c b/usr.sbin/ppp/arp.c index 2c51352..02dce51 100644 --- a/usr.sbin/ppp/arp.c +++ b/usr.sbin/ppp/arp.c @@ -97,7 +97,7 @@ static struct { } arpmsg; static int -arp_ProxySub(struct bundle *bundle, struct in_addr addr, int add, int s) +arp_ProxySub(struct bundle *bundle, struct in_addr addr, int add) { int routes; @@ -107,7 +107,7 @@ arp_ProxySub(struct bundle *bundle, struct in_addr addr, int add, int s) */ memset(&arpmsg, 0, sizeof arpmsg); - if (!arp_EtherAddr(s, addr, &arpmsg.hwa, 0)) { + if (!arp_EtherAddr(addr, &arpmsg.hwa, 0)) { log_Printf(LogWARN, "%s: Cannot determine ethernet address for proxy ARP\n", inet_ntoa(addr)); return 0; @@ -145,18 +145,18 @@ arp_ProxySub(struct bundle *bundle, struct in_addr addr, int add, int s) } int -arp_SetProxy(struct bundle *bundle, struct in_addr addr, int s) +arp_SetProxy(struct bundle *bundle, struct in_addr addr) { - return (arp_ProxySub(bundle, addr, 1, s)); + return (arp_ProxySub(bundle, addr, 1)); } /* * arp_ClearProxy - Delete the proxy ARP entry for the peer. */ int -arp_ClearProxy(struct bundle *bundle, struct in_addr addr, int s) +arp_ClearProxy(struct bundle *bundle, struct in_addr addr) { - return (arp_ProxySub(bundle, addr, 0, s)); + return (arp_ProxySub(bundle, addr, 0)); } #else /* RTM_VERSION */ @@ -179,7 +179,7 @@ arp_SetProxy(struct bundle *bundle, struct in_addr addr, int s) * Get the hardware address of an interface on the same subnet as our local * address. */ - if (!arp_EtherAddr(s, addr, &dls.sdl, 1)) { + if (!arp_EtherAddr(addr, &dls.sdl, 1)) { log_Printf(LOG_PHASE_BIT, "Cannot determine ethernet address for " "proxy ARP\n"); return 0; @@ -226,7 +226,7 @@ arp_ClearProxy(struct bundle *bundle, struct in_addr addr, int s) */ int -arp_EtherAddr(int s, struct in_addr ipaddr, struct sockaddr_dl *hwaddr, +arp_EtherAddr(struct in_addr ipaddr, struct sockaddr_dl *hwaddr, int verbose) { int mib[6], skip; diff --git a/usr.sbin/ppp/arp.h b/usr.sbin/ppp/arp.h index ac0a1ca..81e3fa6 100644 --- a/usr.sbin/ppp/arp.h +++ b/usr.sbin/ppp/arp.h @@ -31,6 +31,6 @@ struct sockaddr_dl; struct bundle; -extern int arp_ClearProxy(struct bundle *, struct in_addr, int); -extern int arp_SetProxy(struct bundle *, struct in_addr, int); -extern int arp_EtherAddr(int, struct in_addr, struct sockaddr_dl *, int); +extern int arp_ClearProxy(struct bundle *, struct in_addr); +extern int arp_SetProxy(struct bundle *, struct in_addr); +extern int arp_EtherAddr(struct in_addr, struct sockaddr_dl *, int); diff --git a/usr.sbin/ppp/async.c b/usr.sbin/ppp/async.c index b938e68..a2a8e04 100644 --- a/usr.sbin/ppp/async.c +++ b/usr.sbin/ppp/async.c @@ -100,14 +100,14 @@ async_Encode(struct async *async, u_char **cp, u_char c, int proto) } static struct mbuf * -async_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, - int pri, u_short *proto) +async_LayerPush(struct bundle *b __unused, struct link *l, struct mbuf *bp, + int pri __unused, u_short *proto) { struct physical *p = link2physical(l); u_char *cp, *sp, *ep; struct mbuf *wp; size_t oldcnt; - int cnt; + size_t cnt; if (!p || m_length(bp) > HDLCSIZE) { m_freem(bp); @@ -187,8 +187,8 @@ async_Decode(struct async *async, u_char c) } static struct mbuf * -async_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, - u_short *proto) +async_LayerPull(struct bundle *b __unused, struct link *l, struct mbuf *bp, + u_short *proto __unused) { struct mbuf *nbp, **last; struct physical *p = link2physical(l); diff --git a/usr.sbin/ppp/atm.c b/usr.sbin/ppp/atm.c index 0d51564..6e0ce75 100644 --- a/usr.sbin/ppp/atm.c +++ b/usr.sbin/ppp/atm.c @@ -68,7 +68,7 @@ struct atmdevice { #define device2atm(d) ((d)->type == ATM_DEVICE ? (struct atmdevice *)d : NULL) -int +unsigned atm_DeviceSize(void) { return sizeof(struct atmdevice); @@ -106,7 +106,7 @@ atm_Free(struct physical *p) static void atm_device2iov(struct device *d, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd __unused, int *nauxfd __unused) { int sz = physical_MaxDeviceSize(); @@ -142,7 +142,7 @@ static const struct device baseatmdevice = { struct device * atm_iov2device(int type, struct physical *p, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd __unused, int *nauxfd __unused) { if (type == ATM_DEVICE) { struct atmdevice *dev = (struct atmdevice *)iov[(*niov)++].iov_base; diff --git a/usr.sbin/ppp/atm.h b/usr.sbin/ppp/atm.h index 3fbc0c5..ccfad8d 100644 --- a/usr.sbin/ppp/atm.h +++ b/usr.sbin/ppp/atm.h @@ -32,4 +32,4 @@ struct device; extern struct device *atm_Create(struct physical *); extern struct device *atm_iov2device(int, struct physical *, struct iovec *, int *, int, int *, int *); -extern int atm_DeviceSize(void); +extern unsigned atm_DeviceSize(void); diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 54f0c1c..4617183 100644 --- a/usr.sbin/ppp/auth.c +++ b/usr.sbin/ppp/auth.c @@ -285,8 +285,7 @@ again: } int -auth_Validate(struct bundle *bundle, const char *name, - const char *key, struct physical *physical) +auth_Validate(struct bundle *bundle, const char *name, const char *key) { /* Used by PAP routines */ @@ -337,8 +336,7 @@ again: } char * -auth_GetSecret(struct bundle *bundle, const char *name, int len, - struct physical *physical) +auth_GetSecret(const char *name, size_t len) { /* Used by CHAP routines */ @@ -437,7 +435,7 @@ auth_StopTimer(struct authinfo *authp) struct mbuf * auth_ReadHeader(struct authinfo *authp, struct mbuf *bp) { - int len; + size_t len; len = m_length(bp); if (len >= sizeof authp->in.hdr) { @@ -445,11 +443,11 @@ auth_ReadHeader(struct authinfo *authp, struct mbuf *bp) if (len >= ntohs(authp->in.hdr.length)) return bp; authp->in.hdr.length = htons(0); - log_Printf(LogWARN, "auth_ReadHeader: Short packet (%d > %d) !\n", + log_Printf(LogWARN, "auth_ReadHeader: Short packet (%u > %u) !\n", ntohs(authp->in.hdr.length), len); } else { authp->in.hdr.length = htons(0); - log_Printf(LogWARN, "auth_ReadHeader: Short packet header (%d > %d) !\n", + log_Printf(LogWARN, "auth_ReadHeader: Short packet header (%u > %u) !\n", (int)(sizeof authp->in.hdr), len); } @@ -458,15 +456,15 @@ auth_ReadHeader(struct authinfo *authp, struct mbuf *bp) } struct mbuf * -auth_ReadName(struct authinfo *authp, struct mbuf *bp, int len) +auth_ReadName(struct authinfo *authp, struct mbuf *bp, size_t len) { if (len > sizeof authp->in.name - 1) - log_Printf(LogWARN, "auth_ReadName: Name too long (%d) !\n", len); + log_Printf(LogWARN, "auth_ReadName: Name too long (%u) !\n", len); else { - int mlen = m_length(bp); + size_t mlen = m_length(bp); if (len > mlen) - log_Printf(LogWARN, "auth_ReadName: Short packet (%d > %d) !\n", + log_Printf(LogWARN, "auth_ReadName: Short packet (%u > %u) !\n", len, mlen); else { bp = mbuf_Read(bp, (u_char *)authp->in.name, len); diff --git a/usr.sbin/ppp/auth.h b/usr.sbin/ppp/auth.h index bbc257c..3e1047d 100644 --- a/usr.sbin/ppp/auth.h +++ b/usr.sbin/ppp/auth.h @@ -60,11 +60,9 @@ extern void auth_Init(struct authinfo *, struct physical *, auth_func, auth_func, auth_func); extern void auth_StopTimer(struct authinfo *); extern void auth_StartReq(struct authinfo *); -extern int auth_Validate(struct bundle *, const char *, const char *, - struct physical *); -extern char *auth_GetSecret(struct bundle *, const char *, int, - struct physical *); +extern int auth_Validate(struct bundle *, const char *, const char *); +extern char *auth_GetSecret(const char *, size_t); extern int auth_SetPhoneList(const char *, char *, int); extern int auth_Select(struct bundle *, const char *); extern struct mbuf *auth_ReadHeader(struct authinfo *, struct mbuf *); -extern struct mbuf *auth_ReadName(struct authinfo *, struct mbuf *, int); +extern struct mbuf *auth_ReadName(struct authinfo *, struct mbuf *, size_t); diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c index be55a6a..fdaa830 100644 --- a/usr.sbin/ppp/bundle.c +++ b/usr.sbin/ppp/bundle.c @@ -164,7 +164,7 @@ bundle_NewPhase(struct bundle *bundle, u_int new) } static void -bundle_LayerStart(void *v, struct fsm *fp) +bundle_LayerStart(void *v __unused, struct fsm *fp __unused) { /* The given FSM is about to start up ! */ } @@ -529,7 +529,7 @@ bundle_IsSet(struct fdescriptor *d, const fd_set *fdset) } static void -bundle_DescriptorRead(struct fdescriptor *d, struct bundle *bundle, +bundle_DescriptorRead(struct fdescriptor *d __unused, struct bundle *bundle, const fd_set *fdset) { struct datalink *dl; @@ -641,7 +641,7 @@ bundle_DescriptorRead(struct fdescriptor *d, struct bundle *bundle, } static int -bundle_DescriptorWrite(struct fdescriptor *d, struct bundle *bundle, +bundle_DescriptorWrite(struct fdescriptor *d __unused, struct bundle *bundle, const fd_set *fdset) { struct datalink *dl; @@ -1092,7 +1092,7 @@ bundle_ShowStatus(struct cmdargs const *arg) else prompt_Printf(arg->prompt, "none\n"); - prompt_Printf(arg->prompt, " Choked Timer: %ds\n", + prompt_Printf(arg->prompt, " Choked Timer: %us\n", arg->bundle->cfg.choked.timeout); #ifndef NORADIUS @@ -1101,9 +1101,9 @@ bundle_ShowStatus(struct cmdargs const *arg) prompt_Printf(arg->prompt, " Idle Timer: "); if (arg->bundle->cfg.idle.timeout) { - prompt_Printf(arg->prompt, "%ds", arg->bundle->cfg.idle.timeout); + prompt_Printf(arg->prompt, "%us", arg->bundle->cfg.idle.timeout); if (arg->bundle->cfg.idle.min_timeout) - prompt_Printf(arg->prompt, ", min %ds", + prompt_Printf(arg->prompt, ", min %us", arg->bundle->cfg.idle.min_timeout); remaining = bundle_RemainingIdleTime(arg->bundle); if (remaining != -1) @@ -1173,9 +1173,10 @@ bundle_StartIdleTimer(struct bundle *bundle, unsigned secs) /* We want at least `secs' */ if (bundle->cfg.idle.min_timeout > secs && bundle->upat) { - int up = now - bundle->upat; + unsigned up = now - bundle->upat; - if ((long long)bundle->cfg.idle.min_timeout - up > (long long)secs) + if (bundle->cfg.idle.min_timeout > up && + bundle->cfg.idle.min_timeout - up > (long long)secs) /* Only increase from the current `remaining' value */ secs = bundle->cfg.idle.min_timeout - up; } @@ -1189,11 +1190,11 @@ bundle_StartIdleTimer(struct bundle *bundle, unsigned secs) } void -bundle_SetIdleTimer(struct bundle *bundle, int timeout, int min_timeout) +bundle_SetIdleTimer(struct bundle *bundle, unsigned timeout, + unsigned min_timeout) { bundle->cfg.idle.timeout = timeout; - if (min_timeout >= 0) - bundle->cfg.idle.min_timeout = min_timeout; + bundle->cfg.idle.min_timeout = min_timeout; if (ncp_LayersOpen(&bundle->ncp)) bundle_StartIdleTimer(bundle, 0); } @@ -1370,7 +1371,8 @@ void bundle_ReceiveDatalink(struct bundle *bundle, int s) { char cmsgbuf[sizeof(struct cmsghdr) + sizeof(int) * SEND_MAXFD]; - int niov, expect, f, *fd, nfd, onfd, got; + int niov, expect, f, *fd, nfd, onfd; + ssize_t got; struct iovec iov[SCATTER_SEGMENTS]; struct cmsghdr *cmsg; struct msghdr msg; @@ -1419,7 +1421,7 @@ bundle_ReceiveDatalink(struct bundle *bundle, int s) log_Printf(LogDEBUG, "Expecting %u scatter/gather bytes\n", (unsigned)iov[0].iov_len); - if ((got = recvmsg(s, &msg, MSG_WAITALL)) != iov[0].iov_len) { + if ((got = recvmsg(s, &msg, MSG_WAITALL)) != (ssize_t)iov[0].iov_len) { if (got == -1) log_Printf(LogERROR, "Failed recvmsg: %s\n", strerror(errno)); else @@ -1536,7 +1538,8 @@ bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun) struct cmsghdr *cmsg; struct msghdr msg; struct iovec iov[SCATTER_SEGMENTS]; - int niov, f, expect, newsid, fd[SEND_MAXFD], nfd, reply[2], got; + int niov, f, expect, newsid, fd[SEND_MAXFD], nfd, reply[2]; + ssize_t got; pid_t newpid; log_Printf(LogPHASE, "Transmitting datalink %s\n", dl->name); @@ -1608,7 +1611,7 @@ bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun) if ((got = sendmsg(s, &msg, 0)) == -1) log_Printf(LogERROR, "Failed sendmsg: %s: %s\n", sun->sun_path, strerror(errno)); - else if (got != iov[0].iov_len) + else if (got != (ssize_t)iov[0].iov_len) log_Printf(LogERROR, "%s: Failed initial sendmsg: Only sent %d of %u\n", sun->sun_path, got, (unsigned)iov[0].iov_len); else { @@ -1819,11 +1822,11 @@ bundle_setsid(struct bundle *bundle, int holdsession) } } -int +unsigned bundle_HighestState(struct bundle *bundle) { struct datalink *dl; - int result = DATALINK_CLOSED; + unsigned result = DATALINK_CLOSED; for (dl = bundle->links; dl; dl = dl->next) if (result < dl->state) @@ -1916,7 +1919,7 @@ bundle_CalculateBandwidth(struct bundle *bundle) #endif if (maxoverhead) { - log_Printf(LogLCP, "Reducing MTU from %d to %d (CCP requirement)\n", + log_Printf(LogLCP, "Reducing MTU from %lu to %lu (CCP requirement)\n", bundle->iface->mtu, bundle->iface->mtu - maxoverhead); bundle->iface->mtu -= maxoverhead; } diff --git a/usr.sbin/ppp/bundle.h b/usr.sbin/ppp/bundle.h index d27d3b0..f34e9bf 100644 --- a/usr.sbin/ppp/bundle.h +++ b/usr.sbin/ppp/bundle.h @@ -98,8 +98,8 @@ struct bundle { struct { struct { - int timeout; /* NCP Idle timeout value */ - int min_timeout; /* Don't idle out before this */ + unsigned timeout; /* NCP Idle timeout value */ + unsigned min_timeout; /* Don't idle out before this */ } idle; struct { char name[AUTHLEN]; /* PAP/CHAP system name */ @@ -110,7 +110,7 @@ struct bundle { u_short ifqueue; /* Interface queue size */ struct { - int timeout; /* How long to leave the output queue choked */ + unsigned timeout; /* How long to leave the output queue choked */ } choked; } cfg; @@ -169,7 +169,7 @@ extern void bundle_LinkClosed(struct bundle *, struct datalink *); extern int bundle_ShowLinks(struct cmdargs const *); extern int bundle_ShowStatus(struct cmdargs const *); extern void bundle_StartIdleTimer(struct bundle *, unsigned secs); -extern void bundle_SetIdleTimer(struct bundle *, int, int); +extern void bundle_SetIdleTimer(struct bundle *, unsigned, unsigned); extern void bundle_StopIdleTimer(struct bundle *); extern int bundle_IsDead(struct bundle *); extern struct datalink *bundle2datalink(struct bundle *, const char *); @@ -198,7 +198,7 @@ extern int bundle_RenameDatalink(struct bundle *, struct datalink *, const char *); extern void bundle_setsid(struct bundle *, int); extern void bundle_LockTun(struct bundle *); -extern int bundle_HighestState(struct bundle *); +extern unsigned bundle_HighestState(struct bundle *); extern int bundle_Exception(struct bundle *, int); extern void bundle_AdjustFilters(struct bundle *, struct ncpaddr *, struct ncpaddr *); diff --git a/usr.sbin/ppp/cbcp.c b/usr.sbin/ppp/cbcp.c index 674ea70..6a84ed1 100644 --- a/usr.sbin/ppp/cbcp.c +++ b/usr.sbin/ppp/cbcp.c @@ -150,7 +150,7 @@ static const char * const cbcpname[] = { }; static const char * -cbcpstate(int s) +cbcpstate(unsigned s) { if (s < sizeof cbcpname / sizeof cbcpname[0]) return cbcpname[s]; @@ -210,7 +210,7 @@ cbcp_Output(struct cbcp *cbcp, u_char code, struct cbcp_data *data) } static const char * -cbcp_data_Type(int type) +cbcp_data_Type(unsigned type) { static const char * const types[] = { "No callback", "User-spec", "Server-spec", "list" @@ -615,13 +615,13 @@ cbcp_SendAck(struct cbcp *cbcp) } extern struct mbuf * -cbcp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) +cbcp_Input(struct bundle *bundle __unused, struct link *l, struct mbuf *bp) { struct physical *p = link2physical(l); struct cbcp_header *head; struct cbcp_data *data; struct cbcp *cbcp = &p->dl->cbcp; - int len; + size_t len; if (p == NULL) { log_Printf(LogERROR, "cbcp_Input: Not a physical link - dropped\n"); @@ -637,7 +637,7 @@ cbcp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) } head = (struct cbcp_header *)MBUF_CTOP(bp); if (ntohs(head->length) != len) { - log_Printf(LogWARN, "Corrupt CBCP packet (code %d, length %d not %d)" + log_Printf(LogWARN, "Corrupt CBCP packet (code %d, length %u not %u)" " - ignored\n", head->code, ntohs(head->length), len); m_freem(bp); return NULL; diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c index 78ea13a..2ec2ca2 100644 --- a/usr.sbin/ppp/ccp.c +++ b/usr.sbin/ppp/ccp.c @@ -133,7 +133,7 @@ protoname(int proto) "DEFLATE", /* 26: Deflate (rfc1979) */ }; - if (proto < 0 || proto > sizeof cftypes / sizeof *cftypes || + if (proto < 0 || (unsigned)proto > sizeof cftypes / sizeof *cftypes || cftypes[proto] == NULL) { if (proto == -1) return "none"; @@ -297,7 +297,7 @@ ccp_Setup(struct ccp *ccp) int ccp_Required(struct ccp *ccp) { - int f; + unsigned f; for (f = 0; f < NALGORITHMS; f++) if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg]) && @@ -347,7 +347,8 @@ CcpSendConfigReq(struct fsm *fp) struct ccp *ccp = fsm2ccp(fp); struct ccp_opt **o; u_char *cp, buff[100]; - int f, alloc; + unsigned f; + int alloc; cp = buff; o = &ccp->out.opt; @@ -361,7 +362,7 @@ CcpSendConfigReq(struct fsm *fp) if (!alloc) for (o = &ccp->out.opt; *o != NULL; o = &(*o)->next) - if ((*o)->val.hdr.id == algorithm[f]->id && (*o)->algorithm == f) + if ((*o)->val.hdr.id == algorithm[f]->id && (*o)->algorithm == (int)f) break; if (alloc || *o == NULL) { @@ -402,7 +403,7 @@ ccp_SendResetReq(struct fsm *fp) } static void -CcpSentTerminateReq(struct fsm *fp) +CcpSentTerminateReq(struct fsm *fp __unused) { /* Term REQ just sent by FSM */ } @@ -495,12 +496,12 @@ CcpLayerUp(struct fsm *fp) /* We're now up */ struct ccp *ccp = fsm2ccp(fp); struct ccp_opt **o; - int f, fail; + unsigned f, fail; for (f = fail = 0; f < NALGORITHMS; f++) if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg]) && (*algorithm[f]->Required)(&ccp->fsm) && - (ccp->in.algorithm != f || ccp->out.algorithm != f)) { + (ccp->in.algorithm != (int)f || ccp->out.algorithm != (int)f)) { /* Blow it all away - we haven't negotiated a required algorithm */ log_Printf(LogWARN, "%s: Failed to negotiate (required) %s\n", fp->link->name, protoname(algorithm[f]->id)); @@ -517,7 +518,7 @@ CcpLayerUp(struct fsm *fp) log_Printf(LogCCP, "%s: LayerUp.\n", fp->link->name); if (ccp->in.state == NULL && ccp->in.algorithm >= 0 && - ccp->in.algorithm < NALGORITHMS) { + ccp->in.algorithm < (int)NALGORITHMS) { ccp->in.state = (*algorithm[ccp->in.algorithm]->i.Init) (fp->bundle, &ccp->in.opt); if (ccp->in.state == NULL) { @@ -530,12 +531,13 @@ CcpLayerUp(struct fsm *fp) } o = &ccp->out.opt; - for (f = 0; f < ccp->out.algorithm; f++) - if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg])) - o = &(*o)->next; + if (ccp->out.algorithm > 0) + for (f = 0; f < (unsigned)ccp->out.algorithm; f++) + if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg])) + o = &(*o)->next; if (ccp->out.state == NULL && ccp->out.algorithm >= 0 && - ccp->out.algorithm < NALGORITHMS) { + ccp->out.algorithm < (int)NALGORITHMS) { ccp->out.state = (*algorithm[ccp->out.algorithm]->o.Init) (fp->bundle, &(*o)->val); if (ccp->out.state == NULL) { @@ -569,7 +571,7 @@ CcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, if (mode_type == MODE_REQ) ccp->in.algorithm = -1; /* In case we've received two REQs in a row */ - while (end - cp >= sizeof(opt->hdr)) { + while (end >= cp + sizeof(opt->hdr)) { if ((opt = fsm_readopt(&cp)) == NULL) break; @@ -609,7 +611,7 @@ CcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, case MODE_ACK: fsm_ack(dec, &ccp->in.opt); ccp->his_proto = opt->hdr.id; - ccp->in.algorithm = f; /* This one'll do :-) */ + ccp->in.algorithm = (int)f; /* This one'll do :-) */ break; } } else { @@ -709,7 +711,7 @@ CcpRecvResetAck(struct fsm *fp, u_char id) } static struct mbuf * -ccp_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, +ccp_LayerPush(struct bundle *b __unused, struct link *l, struct mbuf *bp, int pri, u_short *proto) { if (PROTO_COMPRESSIBLE(*proto)) { @@ -739,7 +741,8 @@ ccp_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, } static struct mbuf * -ccp_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, u_short *proto) +ccp_LayerPull(struct bundle *b __unused, struct link *l, struct mbuf *bp, + u_short *proto) { /* * If proto isn't PROTO_[I]COMPD, we still want to pass it to the @@ -805,13 +808,13 @@ ccp_SetOpenMode(struct ccp *ccp) } int -ccp_DefaultUsable(struct fsm *fp) +ccp_DefaultUsable(struct fsm *fp __unused) { return 1; } int -ccp_DefaultRequired(struct fsm *fp) +ccp_DefaultRequired(struct fsm *fp __unused) { return 0; } diff --git a/usr.sbin/ppp/chap.c b/usr.sbin/ppp/chap.c index 305e5c7..75de650 100644 --- a/usr.sbin/ppp/chap.c +++ b/usr.sbin/ppp/chap.c @@ -35,6 +35,7 @@ #include <sys/socket.h> #include <sys/un.h> +#include <ctype.h> #include <errno.h> #include <fcntl.h> #ifndef NODES @@ -121,9 +122,10 @@ ChapOutput(struct physical *physical, u_int code, u_int id, } static char * -chap_BuildAnswer(char *name, char *key, u_char id, char *challenge, u_char type +chap_BuildAnswer(char *name, char *key, u_char id, char *challenge #ifndef NODES - , char *peerchallenge, char *authresponse, int lanman + , u_char type, char *peerchallenge, char *authresponse, + int lanman #endif ) { @@ -137,7 +139,7 @@ chap_BuildAnswer(char *name, char *key, u_char id, char *challenge, u_char type if (type == 0x80) { char expkey[AUTHLEN << 2]; MD4_CTX MD4context; - int f; + size_t f; if ((result = malloc(1 + nlen + MS_CHAP_RESPONSE_LEN)) == NULL) return result; @@ -184,7 +186,7 @@ chap_BuildAnswer(char *name, char *key, u_char id, char *challenge, u_char type char pwdhash[CHAP81_HASH_LEN]; char pwdhashhash[CHAP81_HASH_LEN]; char *ntresponse; - int f; + size_t f; if ((result = malloc(1 + nlen + CHAP81_RESPONSE_LEN)) == NULL) return result; @@ -210,7 +212,7 @@ chap_BuildAnswer(char *name, char *key, u_char id, char *challenge, u_char type HashNtPasswordHash(pwdhash, pwdhashhash); /* Generate NTRESPONSE to respond on challenge call */ - GenerateNTResponse(challenge + 1, peerchallenge + 1, name, nlen, + GenerateNTResponse(challenge + 1, peerchallenge + 1, name, expkey, klen * 2, ntresponse); /* Generate MPPE MASTERKEY */ @@ -218,7 +220,7 @@ chap_BuildAnswer(char *name, char *key, u_char id, char *challenge, u_char type /* Generate AUTHRESPONSE to verify on auth success */ GenerateAuthenticatorResponse(expkey, klen * 2, ntresponse, - peerchallenge + 1, challenge + 1, name, nlen, + peerchallenge + 1, challenge + 1, name, authresponse); authresponse[CHAP81_AUTHRESPONSE_LEN] = 0; @@ -363,17 +365,17 @@ chap_Cleanup(struct chap *chap, int sig) } static void -chap_Respond(struct chap *chap, char *name, char *key, u_char type +chap_Respond(struct chap *chap, char *name, char *key #ifndef NODES - , int lm + , u_char type, int lm #endif ) { u_char *ans; - ans = chap_BuildAnswer(name, key, chap->auth.id, chap->challenge.peer, type + ans = chap_BuildAnswer(name, key, chap->auth.id, chap->challenge.peer #ifndef NODES - , chap->challenge.local, chap->authresponse, lm + , type, chap->challenge.local, chap->authresponse, lm #endif ); @@ -391,7 +393,8 @@ chap_Respond(struct chap *chap, char *name, char *key, u_char type } static int -chap_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) +chap_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w __unused, + fd_set *e __unused, int *n) { struct chap *chap = descriptor2chap(d); @@ -415,7 +418,8 @@ chap_IsSet(struct fdescriptor *d, const fd_set *fdset) } static void -chap_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +chap_Read(struct fdescriptor *d, struct bundle *bundle __unused, + const fd_set *fdset __unused) { struct chap *chap = descriptor2chap(d); int got; @@ -460,9 +464,9 @@ chap_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) *end-- = '\0'; key += strspn(key, " \t"); - chap_Respond(chap, name, key, chap->auth.physical->link.lcp.his_authtype + chap_Respond(chap, name, key #ifndef NODES - , lanman + , chap->auth.physical->link.lcp.his_authtype, lanman #endif ); chap_Cleanup(chap, 0); @@ -471,7 +475,8 @@ chap_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) } static int -chap_Write(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +chap_Write(struct fdescriptor *d __unused, struct bundle *bundle __unused, + const fd_set *fdset __unused) { /* We never want to write here ! */ log_Printf(LogALERT, "chap_Write: Internal error: Bad call !\n"); @@ -618,9 +623,9 @@ chap_Failure(struct authinfo *authp) } static int -chap_Cmp(u_char type, char *myans, int mylen, char *hisans, int hislen +chap_Cmp(char *myans, int mylen, char *hisans, int hislen #ifndef NODES - , int lm + , u_char type, int lm #endif ) { @@ -690,7 +695,8 @@ chap_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) struct physical *p = link2physical(l); struct chap *chap = &p->dl->chap; char *name, *key, *ans; - int len, nlen; + int len; + size_t nlen; u_char alen; #ifndef NODES int lanman; @@ -833,10 +839,10 @@ chap_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) bundle->cfg.auth.name); else chap_Respond(chap, bundle->cfg.auth.name, bundle->cfg.auth.key + - (*bundle->cfg.auth.key == '!' ? 1 : 0), - p->link.lcp.his_authtype + (*bundle->cfg.auth.key == '!' ? 1 : 0) + #ifndef NODES - , lanman + , p->link.lcp.his_authtype, lanman #endif ); break; @@ -872,7 +878,7 @@ chap_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) "CHAP81 RESPONSE\n", l->name); resp->Flags = '\0'; /* rfc2759 says it *MUST* be zero */ } - key = auth_GetSecret(bundle, name, nlen, p); + key = auth_GetSecret(name, nlen); if (key) { #ifndef NODES if (p->link.lcp.want_authtype == 0x80 && @@ -895,11 +901,11 @@ chap_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) #endif { char *myans = chap_BuildAnswer(name, key, chap->auth.id, - chap->challenge.local, - p->link.lcp.want_authtype + chap->challenge.local #ifndef NODES - , chap->challenge.peer, - chap->authresponse, lanman); + , p->link.lcp.want_authtype, + chap->challenge.peer, + chap->authresponse, lanman); MPPE_IsServer = 1; /* XXX Global ! */ #else ); @@ -907,10 +913,9 @@ chap_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) if (myans == NULL) key = NULL; else { - if (!chap_Cmp(p->link.lcp.want_authtype, myans + 1, *myans, - ans + 1, alen + if (!chap_Cmp(myans + 1, *myans, ans + 1, alen #ifndef NODES - , lanman + , p->link.lcp.want_authtype, lanman #endif )) key = NULL; diff --git a/usr.sbin/ppp/chap_ms.c b/usr.sbin/ppp/chap_ms.c index 74ac199..24e959c 100644 --- a/usr.sbin/ppp/chap_ms.c +++ b/usr.sbin/ppp/chap_ms.c @@ -150,9 +150,9 @@ HashNtPasswordHash(char *hash, char *hashhash) MD4Final(hashhash, &MD4context); } -void +static void ChallengeHash(char *PeerChallenge, char *AuthenticatorChallenge, - char *UserName, int UserNameLen, char *Challenge) + char *UserName, char *Challenge) { SHA_CTX Context; char Digest[SHA_DIGEST_LENGTH]; @@ -176,14 +176,13 @@ ChallengeHash(char *PeerChallenge, char *AuthenticatorChallenge, void GenerateNTResponse(char *AuthenticatorChallenge, char *PeerChallenge, - char *UserName, int UserNameLen, char *Password, + char *UserName, char *Password, int PasswordLen, char *Response) { char Challenge[8]; char PasswordHash[16]; - ChallengeHash(PeerChallenge, AuthenticatorChallenge, UserName, UserNameLen, - Challenge); + ChallengeHash(PeerChallenge, AuthenticatorChallenge, UserName, Challenge); NtPasswordHash(Password, PasswordLen, PasswordHash); ChallengeResponse(Challenge, PasswordHash, Response); } @@ -215,7 +214,7 @@ void GenerateAuthenticatorResponse(char *Password, int PasswordLen, char *NTResponse, char *PeerChallenge, char *AuthenticatorChallenge, char *UserName, - int UserNameLen, char *AuthenticatorResponse) + char *AuthenticatorResponse) { SHA_CTX Context; char PasswordHash[16]; @@ -254,8 +253,7 @@ GenerateAuthenticatorResponse(char *Password, int PasswordLen, SHA1_Update(&Context, NTResponse, 24); SHA1_Update(&Context, Magic1, 39); SHA1_Final(Digest, &Context); - ChallengeHash(PeerChallenge, AuthenticatorChallenge, UserName, UserNameLen, - Challenge); + ChallengeHash(PeerChallenge, AuthenticatorChallenge, UserName, Challenge); SHA1_Init(&Context); SHA1_Update(&Context, Digest, 20); SHA1_Update(&Context, Challenge, 8); diff --git a/usr.sbin/ppp/chap_ms.h b/usr.sbin/ppp/chap_ms.h index 35ee978..8a69f93 100644 --- a/usr.sbin/ppp/chap_ms.h +++ b/usr.sbin/ppp/chap_ms.h @@ -43,11 +43,10 @@ extern void mschap_NT(char *, char *); extern void mschap_LANMan(char *, char *, char *); -extern void GenerateNTResponse(char *, char *, char *, int, char *, int , char *); +extern void GenerateNTResponse(char *, char *, char *, char *, int , char *); extern void HashNtPasswordHash(char *, char *); extern void NtPasswordHash(char *, int, char *); -extern void ChallengeHash(char *, char *, char *UserName, int, char *); -extern void GenerateAuthenticatorResponse(char *, int, char *, char *, char *, char *, int, char *); +extern void GenerateAuthenticatorResponse(char *, int, char *, char *, char *, char *, char *); extern void GetAsymetricStartKey(char *, char *, int, int, int); extern void GetMasterKey(char *, char *, char *); extern void GetNewKeyFromSHA(char *, char *, long, char *); diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c index 79e41ea..7e27487 100644 --- a/usr.sbin/ppp/chat.c +++ b/usr.sbin/ppp/chat.c @@ -370,7 +370,8 @@ chat_UpdateLog(struct chat *c, int in) } static void -chat_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +chat_Read(struct fdescriptor *d, struct bundle *bundle __unused, + const fd_set *fdset __unused) { struct chat *c = descriptor2chat(d); @@ -384,7 +385,7 @@ chat_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) * swallow any ppp talk from the peer ? */ in = BUFLEFT(c); - if (in > sizeof c->buf / 2) + if (in > (ssize_t)sizeof c->buf / 2) in = sizeof c->buf / 2; in = physical_Read(c->physical, c->bufend, in); @@ -484,7 +485,8 @@ chat_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) } static int -chat_Write(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +chat_Write(struct fdescriptor *d, struct bundle *bundle __unused, + const fd_set *fdset __unused) { struct chat *c = descriptor2chat(d); int result = 0; diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 034a306..3703958 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -167,7 +167,7 @@ #define NEG_MPPE 54 #define NEG_CHAP81 55 -const char Version[] = "3.2"; +const char Version[] = "3.3"; static int ShowCommand(struct cmdargs const *); static int TerminalCommand(struct cmdargs const *); @@ -364,7 +364,7 @@ LogCommand(struct cmdargs const *arg) char *argv[MAXARGS]; int argc = arg->argc - arg->argn; - if (argc >= sizeof argv / sizeof argv[0]) { + if (argc >= (int)(sizeof argv / sizeof argv[0])) { argc = sizeof argv / sizeof argv[0] - 1; log_Printf(LogWARN, "Truncating log command to %d args\n", argc); } @@ -379,7 +379,7 @@ LogCommand(struct cmdargs const *arg) } static int -SaveCommand(struct cmdargs const *arg) +SaveCommand(struct cmdargs const *arg __unused) { log_Printf(LogWARN, "save command is not yet implemented.\n"); return 1; @@ -673,7 +673,7 @@ ShellCommand(struct cmdargs const *arg, int bg) char *argv[MAXARGS]; int argc = arg->argc - arg->argn; - if (argc >= sizeof argv / sizeof argv[0]) { + if (argc >= (int)(sizeof argv / sizeof argv[0])) { argc = sizeof argv / sizeof argv[0] - 1; log_Printf(LogWARN, "Truncating shell command to %d args\n", argc); } @@ -756,32 +756,32 @@ ResolvCommand(struct cmdargs const *arg) static struct cmdtab const NatCommands[] = { {"addr", NULL, nat_RedirectAddr, LOCAL_AUTH, - "static address translation", "nat addr [addr_local addr_alias]"}, + "static address translation", "nat addr [addr_local addr_alias]", NULL}, {"deny_incoming", NULL, NatOption, LOCAL_AUTH, "stop incoming connections", "nat deny_incoming yes|no", (const void *) PKT_ALIAS_DENY_INCOMING}, {"enable", NULL, NatEnable, LOCAL_AUTH, - "enable NAT", "nat enable yes|no"}, + "enable NAT", "nat enable yes|no", NULL}, {"log", NULL, NatOption, LOCAL_AUTH, "log NAT link creation", "nat log yes|no", (const void *) PKT_ALIAS_LOG}, {"port", NULL, nat_RedirectPort, LOCAL_AUTH, "port redirection", - "nat port proto localaddr:port[-port] aliasport[-aliasport]"}, + "nat port proto localaddr:port[-port] aliasport[-aliasport]", NULL}, {"proto", NULL, nat_RedirectProto, LOCAL_AUTH, "protocol redirection", - "nat proto proto localIP [publicIP [remoteIP]]"}, + "nat proto proto localIP [publicIP [remoteIP]]", NULL}, {"proxy", NULL, nat_ProxyRule, LOCAL_AUTH, - "proxy control", "nat proxy server host[:port] ..."}, + "proxy control", "nat proxy server host[:port] ...", NULL}, #ifndef NO_FW_PUNCH {"punch_fw", NULL, nat_PunchFW, LOCAL_AUTH, - "firewall control", "nat punch_fw [base count]"}, + "firewall control", "nat punch_fw [base count]", NULL}, #endif {"skinny_port", NULL, nat_SkinnyPort, LOCAL_AUTH, - "TCP port used by Skinny Station protocol", "nat skinny_port [port]"}, + "TCP port used by Skinny Station protocol", "nat skinny_port [port]", NULL}, {"same_ports", NULL, NatOption, LOCAL_AUTH, "try to leave port numbers unchanged", "nat same_ports yes|no", (const void *) PKT_ALIAS_SAME_PORTS}, {"target", NULL, nat_SetTarget, LOCAL_AUTH, - "Default address for incoming connections", "nat target addr" }, + "Default address for incoming connections", "nat target addr", NULL}, {"unregistered_only", NULL, NatOption, LOCAL_AUTH, "translate unregistered (private) IP address space only", "nat unregistered_only yes|no", @@ -791,18 +791,18 @@ static struct cmdtab const NatCommands[] = (const void *) PKT_ALIAS_USE_SOCKETS}, {"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH, "Display this message", "nat help|? [command]", NatCommands}, - {NULL, NULL, NULL}, + {NULL, NULL, NULL, 0, NULL, NULL, NULL}, }; #endif static struct cmdtab const AllowCommands[] = { {"modes", "mode", AllowModes, LOCAL_AUTH, - "Only allow certain ppp modes", "allow modes mode..."}, + "Only allow certain ppp modes", "allow modes mode...", NULL}, {"users", "user", AllowUsers, LOCAL_AUTH, - "Only allow ppp access to certain users", "allow users logname..."}, + "Only allow ppp access to certain users", "allow users logname...", NULL}, {"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH, "Display this message", "allow help|? [command]", AllowCommands}, - {NULL, NULL, NULL}, + {NULL, NULL, NULL, 0, NULL, NULL, NULL}, }; static struct cmdtab const IfaceCommands[] = @@ -813,7 +813,7 @@ static struct cmdtab const IfaceCommands[] = "Add or change an iface address", "iface add! addr[/bits| mask] peer", (void *)1}, {"clear", NULL, IfaceClearCommand, LOCAL_AUTH, - "Clear iface address(es)", "iface clear [INET | INET6]"}, + "Clear iface address(es)", "iface clear [INET | INET6]", NULL}, {"delete", "rm", IfaceDeleteCommand, LOCAL_AUTH, "Delete iface address", "iface delete addr", NULL}, {NULL, "rm!", IfaceDeleteCommand, LOCAL_AUTH, @@ -821,15 +821,15 @@ static struct cmdtab const IfaceCommands[] = {NULL, "delete!", IfaceDeleteCommand, LOCAL_AUTH, "Delete iface address", "iface delete addr", (void *)1}, {"show", NULL, iface_Show, LOCAL_AUTH, - "Show iface address(es)", "iface show"}, + "Show iface address(es)", "iface show", NULL}, {"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH, "Display this message", "nat help|? [command]", IfaceCommands}, - {NULL, NULL, NULL}, + {NULL, NULL, NULL, 0, NULL, NULL, NULL}, }; static struct cmdtab const Commands[] = { {"accept", NULL, NegotiateCommand, LOCAL_AUTH | LOCAL_CX_OPT, - "accept option request", "accept option .."}, + "accept option request", "accept option ..", NULL}, {"add", NULL, AddCommand, LOCAL_AUTH, "add route", "add dest mask gateway", NULL}, {NULL, "add!", AddCommand, LOCAL_AUTH, @@ -837,38 +837,38 @@ static struct cmdtab const Commands[] = { {"allow", "auth", RunListCommand, LOCAL_AUTH, "Allow ppp access", "allow users|modes ....", AllowCommands}, {"bg", "!bg", BgShellCommand, LOCAL_AUTH, - "Run a background command", "[!]bg command"}, + "Run a background command", "[!]bg command", NULL}, {"clear", NULL, ClearCommand, LOCAL_AUTH | LOCAL_CX_OPT, "Clear throughput statistics", - "clear ipcp|ipv6cp|physical [current|overall|peak]..."}, + "clear ipcp|ipv6cp|physical [current|overall|peak]...", NULL}, {"clone", NULL, CloneCommand, LOCAL_AUTH | LOCAL_CX, - "Clone a link", "clone newname..."}, + "Clone a link", "clone newname...", NULL}, {"close", NULL, CloseCommand, LOCAL_AUTH | LOCAL_CX_OPT, - "Close an FSM", "close [lcp|ccp]"}, + "Close an FSM", "close [lcp|ccp]", NULL}, {"delete", NULL, DeleteCommand, LOCAL_AUTH, "delete route", "delete dest", NULL}, {NULL, "delete!", DeleteCommand, LOCAL_AUTH, "delete a route if it exists", "delete! dest", (void *)1}, {"deny", NULL, NegotiateCommand, LOCAL_AUTH | LOCAL_CX_OPT, - "Deny option request", "deny option .."}, + "Deny option request", "deny option ..", NULL}, {"dial", "call", DialCommand, LOCAL_AUTH | LOCAL_CX_OPT, "Dial and login", "dial|call [system ...]", NULL}, {"disable", NULL, NegotiateCommand, LOCAL_AUTH | LOCAL_CX_OPT, - "Disable option", "disable option .."}, + "Disable option", "disable option ..", NULL}, {"down", NULL, DownCommand, LOCAL_AUTH | LOCAL_CX_OPT, - "Generate a down event", "down [ccp|lcp]"}, + "Generate a down event", "down [ccp|lcp]", NULL}, {"enable", NULL, NegotiateCommand, LOCAL_AUTH | LOCAL_CX_OPT, - "Enable option", "enable option .."}, + "Enable option", "enable option ..", NULL}, {"ident", NULL, IdentCommand, LOCAL_AUTH | LOCAL_CX, - "Set the link identity", "ident text..."}, + "Set the link identity", "ident text...", NULL}, {"iface", "interface", RunListCommand, LOCAL_AUTH, "interface control", "iface option ...", IfaceCommands}, {"link", "datalink", LinkCommand, LOCAL_AUTH, - "Link specific commands", "link name command ..."}, + "Link specific commands", "link name command ...", NULL}, {"load", NULL, LoadCommand, LOCAL_AUTH | LOCAL_CX_OPT, - "Load settings", "load [system ...]"}, + "Load settings", "load [system ...]", NULL}, {"log", NULL, LogCommand, LOCAL_AUTH | LOCAL_CX_OPT, - "log information", "log word ..."}, + "log information", "log word ...", NULL}, #ifndef NONAT {"nat", "alias", RunListCommand, LOCAL_AUTH, "NAT control", "nat option yes|no", NatCommands}, @@ -876,30 +876,31 @@ static struct cmdtab const Commands[] = { {"open", NULL, OpenCommand, LOCAL_AUTH | LOCAL_CX_OPT, "Open an FSM", "open! [lcp|ccp|ipcp]", (void *)1}, {"passwd", NULL, PasswdCommand, LOCAL_NO_AUTH, - "Password for manipulation", "passwd LocalPassword"}, + "Password for manipulation", "passwd LocalPassword", NULL}, {"quit", "bye", QuitCommand, LOCAL_AUTH | LOCAL_NO_AUTH, - "Quit PPP program", "quit|bye [all]"}, + "Quit PPP program", "quit|bye [all]", NULL}, {"remove", "rm", RemoveCommand, LOCAL_AUTH | LOCAL_CX, - "Remove a link", "remove"}, + "Remove a link", "remove", NULL}, {"rename", "mv", RenameCommand, LOCAL_AUTH | LOCAL_CX, - "Rename a link", "rename name"}, + "Rename a link", "rename name", NULL}, {"resolv", NULL, ResolvCommand, LOCAL_AUTH, - "Manipulate resolv.conf", "resolv readonly|reload|restore|rewrite|writable"}, + "Manipulate resolv.conf", "resolv readonly|reload|restore|rewrite|writable", + NULL}, {"save", NULL, SaveCommand, LOCAL_AUTH, - "Save settings", "save"}, + "Save settings", "save", NULL}, {"sendident", NULL, SendIdentification, LOCAL_AUTH | LOCAL_CX, - "Transmit the link identity", "sendident"}, + "Transmit the link identity", "sendident", NULL}, {"set", "setup", SetCommand, LOCAL_AUTH | LOCAL_CX_OPT, - "Set parameters", "set[up] var value"}, + "Set parameters", "set[up] var value", NULL}, {"shell", "!", FgShellCommand, LOCAL_AUTH, - "Run a subshell", "shell|! [sh command]"}, + "Run a subshell", "shell|! [sh command]", NULL}, {"show", NULL, ShowCommand, LOCAL_AUTH | LOCAL_CX_OPT, - "Show status and stats", "show var"}, + "Show status and stats", "show var", NULL}, {"term", NULL, TerminalCommand, LOCAL_AUTH | LOCAL_CX, - "Enter terminal mode", "term"}, + "Enter terminal mode", "term", NULL}, {"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH, "Display this message", "help|? [command]", Commands}, - {NULL, NULL, NULL}, + {NULL, NULL, NULL, 0, NULL, NULL, NULL}, }; static int @@ -969,58 +970,58 @@ ShowProtocolStats(struct cmdargs const *arg) static struct cmdtab const ShowCommands[] = { {"bundle", NULL, bundle_ShowStatus, LOCAL_AUTH, - "bundle details", "show bundle"}, + "bundle details", "show bundle", NULL}, {"ccp", NULL, ccp_ReportStatus, LOCAL_AUTH | LOCAL_CX_OPT, - "CCP status", "show cpp"}, + "CCP status", "show cpp", NULL}, {"compress", NULL, sl_Show, LOCAL_AUTH, - "VJ compression stats", "show compress"}, + "VJ compression stats", "show compress", NULL}, {"escape", NULL, ShowEscape, LOCAL_AUTH | LOCAL_CX, - "escape characters", "show escape"}, + "escape characters", "show escape", NULL}, {"filter", NULL, filter_Show, LOCAL_AUTH, - "packet filters", "show filter [in|out|dial|alive]"}, + "packet filters", "show filter [in|out|dial|alive]", NULL}, {"hdlc", NULL, hdlc_ReportStatus, LOCAL_AUTH | LOCAL_CX, - "HDLC errors", "show hdlc"}, + "HDLC errors", "show hdlc", NULL}, {"iface", "interface", iface_Show, LOCAL_AUTH, - "Interface status", "show iface"}, + "Interface status", "show iface", NULL}, {"ipcp", NULL, ipcp_Show, LOCAL_AUTH, - "IPCP status", "show ipcp"}, + "IPCP status", "show ipcp", NULL}, #ifndef NOINET6 {"ipv6cp", NULL, ipv6cp_Show, LOCAL_AUTH, - "IPV6CP status", "show ipv6cp"}, + "IPV6CP status", "show ipv6cp", NULL}, #endif {"layers", NULL, link_ShowLayers, LOCAL_AUTH | LOCAL_CX_OPT, - "Protocol layers", "show layers"}, + "Protocol layers", "show layers", NULL}, {"lcp", NULL, lcp_ReportStatus, LOCAL_AUTH | LOCAL_CX, - "LCP status", "show lcp"}, + "LCP status", "show lcp", NULL}, {"link", "datalink", datalink_Show, LOCAL_AUTH | LOCAL_CX, - "(high-level) link info", "show link"}, + "(high-level) link info", "show link", NULL}, {"links", NULL, bundle_ShowLinks, LOCAL_AUTH, - "available link names", "show links"}, + "available link names", "show links", NULL}, {"log", NULL, log_ShowLevel, LOCAL_AUTH, - "log levels", "show log"}, + "log levels", "show log", NULL}, {"mem", NULL, mbuf_Show, LOCAL_AUTH, - "mbuf allocations", "show mem"}, + "mbuf allocations", "show mem", NULL}, {"ncp", NULL, ncp_Show, LOCAL_AUTH, - "NCP status", "show ncp"}, + "NCP status", "show ncp", NULL}, {"physical", NULL, physical_ShowStatus, LOCAL_AUTH | LOCAL_CX, - "(low-level) link info", "show physical"}, + "(low-level) link info", "show physical", NULL}, {"mp", "multilink", mp_ShowStatus, LOCAL_AUTH, - "multilink setup", "show mp"}, + "multilink setup", "show mp", NULL}, {"proto", NULL, ShowProtocolStats, LOCAL_AUTH | LOCAL_CX_OPT, - "protocol summary", "show proto"}, + "protocol summary", "show proto", NULL}, {"route", NULL, route_Show, LOCAL_AUTH, - "routing table", "show route"}, + "routing table", "show route", NULL}, {"stopped", NULL, ShowStopped, LOCAL_AUTH | LOCAL_CX, - "STOPPED timeout", "show stopped"}, + "STOPPED timeout", "show stopped", NULL}, {"timers", NULL, ShowTimerList, LOCAL_AUTH, - "alarm timers", "show timers"}, + "alarm timers", "show timers", NULL}, {"version", NULL, ShowVersion, LOCAL_NO_AUTH | LOCAL_AUTH, - "version string", "show version"}, + "version string", "show version", NULL}, {"who", NULL, log_ShowWho, LOCAL_AUTH, - "client list", "show who"}, + "client list", "show who", NULL}, {"help", "?", HelpCommand, LOCAL_NO_AUTH | LOCAL_AUTH, "Display this message", "show help|? [command]", ShowCommands}, - {NULL, NULL, NULL}, + {NULL, NULL, NULL, 0, NULL, NULL, NULL}, }; static struct cmdtab const * @@ -1152,7 +1153,7 @@ command_Interpret(char *buff, int nb, char *argv[MAXARGS]) } static int -arghidden(int argc, char const *const *argv, int n) +arghidden(char const *const *argv, int n) { /* Is arg n of the given command to be hidden from the log ? */ @@ -1181,7 +1182,8 @@ command_Run(struct bundle *bundle, int argc, char const *const *argv, if (argc > 0) { if (log_IsKept(LogCOMMAND)) { char buf[LINE_LEN]; - int f, n; + int f; + size_t n; if (label) { strncpy(buf, label, sizeof buf - 3); @@ -1197,7 +1199,7 @@ command_Run(struct bundle *bundle, int argc, char const *const *argv, for (f = 0; f < argc; f++) { if (n < sizeof buf - 1 && f) buf[n++] = ' '; - if (arghidden(argc, argv, f)) + if (arghidden(argv, f)) strncpy(buf+n, "********", sizeof buf - n - 1); else strncpy(buf+n, argv[f], sizeof buf - n - 1); @@ -1262,7 +1264,7 @@ QuitCommand(struct cmdargs const *arg) if (!arg->prompt || prompt_IsController(arg->prompt) || (arg->argc > arg->argn && !strcasecmp(arg->argv[arg->argn], "all") && (arg->prompt->auth & LOCAL_AUTH))) - Cleanup(EX_NORMAL); + Cleanup(); if (arg->prompt) prompt_Destroy(arg->prompt, 1); @@ -1389,7 +1391,7 @@ SetModemSpeed(struct cmdargs const *arg) } end = NULL; speed = strtol(arg->argv[arg->argn], &end, 10); - if (*end) { + if (*end || speed < 0) { log_Printf(LogWARN, "SetModemSpeed: Bad argument \"%s\"", arg->argv[arg->argn]); return -1; @@ -1428,7 +1430,7 @@ SetServer(struct cmdargs const *arg) if (arg->argc > arg->argn && arg->argc < arg->argn+4) { const char *port, *passwd, *mask; - int mlen; + size_t mlen; /* What's what ? */ port = arg->argv[arg->argn]; @@ -2021,10 +2023,12 @@ SetVariable(struct cmdargs const *arg) log_Printf(LogWARN, "Too few idle timeout values\n"); res = 1; } else { - int timeout, min; + unsigned long timeout, min; - timeout = atoi(argp); - min = arg->argc == arg->argn + 2 ? atoi(arg->argv[arg->argn + 1]) : -1; + timeout = strtoul(argp, NULL, 10); + min = arg->bundle->cfg.idle.min_timeout; + if (arg->argc == arg->argn + 2) + min = strtoul(arg->argv[arg->argn + 1], NULL, 10); bundle_SetIdleTimer(arg->bundle, timeout, min); } break; @@ -2323,7 +2327,7 @@ static struct cmdtab const SetCommands[] = { "auto link [de]activation", "set autoload maxtime maxload mintime minload", (const void *)VAR_AUTOLOAD}, {"bandwidth", NULL, mp_SetDatalinkBandwidth, LOCAL_AUTH | LOCAL_CX, - "datalink bandwidth", "set bandwidth value"}, + "datalink bandwidth", "set bandwidth value", NULL}, {"callback", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX, "callback control", "set callback [none|auth|cbcp|" "E.164 *|number[,number]...]...", (const void *)VAR_CALLBACK}, @@ -2358,17 +2362,17 @@ static struct cmdtab const SetCommands[] = { {"dns", NULL, SetVariable, LOCAL_AUTH, "Domain Name Server", "set dns pri-addr [sec-addr]", (const void *)VAR_DNS}, {"enddisc", NULL, mp_SetEnddisc, LOCAL_AUTH, - "Endpoint Discriminator", "set enddisc [IP|magic|label|psn value]"}, + "Endpoint Discriminator", "set enddisc [IP|magic|label|psn value]", NULL}, {"escape", NULL, SetEscape, LOCAL_AUTH | LOCAL_CX, - "escape characters", "set escape hex-digit ..."}, + "escape characters", "set escape hex-digit ...", NULL}, {"filter", NULL, filter_Set, LOCAL_AUTH, "packet filters", "set filter alive|dial|in|out rule-no permit|deny " "[src_addr[/width]] [dst_addr[/width]] [proto " - "[src [lt|eq|gt port]] [dst [lt|eq|gt port]] [estab] [syn] [finrst]]"}, + "[src [lt|eq|gt port]] [dst [lt|eq|gt port]] [estab] [syn] [finrst]]", NULL}, {"hangup", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX, "hangup script", "set hangup chat-script", (const void *) VAR_HANGUP}, {"ifaddr", NULL, SetInterfaceAddr, LOCAL_AUTH, "destination address", - "set ifaddr [src-addr [dst-addr [netmask [trg-addr]]]]"}, + "set ifaddr [src-addr [dst-addr [netmask [trg-addr]]]]", NULL}, {"ifqueue", NULL, SetVariable, LOCAL_AUTH, "interface queue", "set ifqueue packets", (const void *)VAR_IFQUEUE}, {"ipcpretry", "ipcpretries", SetVariable, LOCAL_AUTH, "IPCP retries", @@ -2379,7 +2383,7 @@ static struct cmdtab const SetCommands[] = { "set lcpretry value [attempts]", (const void *)VAR_LCPRETRY}, {"log", NULL, log_SetLevel, LOCAL_AUTH, "log level", "set log [local] [+|-]all|async|cbcp|ccp|chat|command|connect|debug|dns|hdlc|" - "id0|ipcp|lcp|lqm|phase|physical|radius|sync|tcp/ip|timer|tun..."}, + "id0|ipcp|lcp|lqm|phase|physical|radius|sync|tcp/ip|timer|tun...", NULL}, {"login", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX, "login script", "set login chat-script", (const void *) VAR_LOGIN}, {"logout", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX, @@ -2405,7 +2409,7 @@ static struct cmdtab const SetCommands[] = { {"phone", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX, "telephone number(s)", "set phone phone1[:phone2[...]]", (const void *)VAR_PHONE}, {"proctitle", "title", SetProcTitle, LOCAL_AUTH, - "Process title", "set proctitle [value]"}, + "Process title", "set proctitle [value]", NULL}, #ifndef NORADIUS {"radius", NULL, SetVariable, LOCAL_AUTH, "RADIUS Config", "set radius cfgfile", (const void *)VAR_RADIUS}, @@ -2414,31 +2418,32 @@ static struct cmdtab const SetCommands[] = { (const void *)VAR_RAD_ALIVE}, #endif {"reconnect", NULL, datalink_SetReconnect, LOCAL_AUTH | LOCAL_CX, - "Reconnect timeout", "set reconnect value ntries"}, + "Reconnect timeout", "set reconnect value ntries", NULL}, {"recvpipe", NULL, SetVariable, LOCAL_AUTH, "RECVPIPE value", "set recvpipe value", (const void *)VAR_RECVPIPE}, {"redial", NULL, datalink_SetRedial, LOCAL_AUTH | LOCAL_CX, - "Redial timeout", "set redial secs[+inc[-incmax]][.next] [attempts]"}, + "Redial timeout", "set redial secs[+inc[-incmax]][.next] [attempts]", NULL}, {"sendpipe", NULL, SetVariable, LOCAL_AUTH, "SENDPIPE value", "set sendpipe value", (const void *)VAR_SENDPIPE}, {"server", "socket", SetServer, LOCAL_AUTH, "diagnostic port", - "set server|socket TcpPort|LocalName|none|open|closed [password [mask]]"}, + "set server|socket TcpPort|LocalName|none|open|closed [password [mask]]", + NULL}, {"speed", NULL, SetModemSpeed, LOCAL_AUTH | LOCAL_CX, - "physical speed", "set speed value|sync"}, + "physical speed", "set speed value|sync", NULL}, {"stopped", NULL, SetStoppedTimeout, LOCAL_AUTH | LOCAL_CX, - "STOPPED timeouts", "set stopped [LCPseconds [CCPseconds]]"}, + "STOPPED timeouts", "set stopped [LCPseconds [CCPseconds]]", NULL}, {"timeout", NULL, SetVariable, LOCAL_AUTH, "Idle timeout", "set timeout idletime", (const void *)VAR_IDLETIMEOUT}, {"urgent", NULL, SetVariable, LOCAL_AUTH, "urgent ports", "set urgent [tcp|udp] [+|-]port...", (const void *)VAR_URGENTPORTS}, {"vj", NULL, ipcp_vjset, LOCAL_AUTH, - "vj values", "set vj slots|slotcomp [value]"}, + "vj values", "set vj slots|slotcomp [value]", NULL}, {"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH, "Display this message", "set help|? [command]", SetCommands}, {"pppoe", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX, "Connect using standard/3Com mode", "set pppoe [standard|3Com]", (const char *)VAR_PPPOE}, - {NULL, NULL, NULL}, + {NULL, NULL, NULL, 0, NULL, NULL, NULL}, }; static int @@ -2995,7 +3000,7 @@ static struct cmdtab const NegotiateCommands[] = { {"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH, "Display this message", "accept|deny|disable|enable help|? [value]", NegotiateCommands}, - {NULL, NULL, NULL}, + {NULL, NULL, NULL, 0, NULL, NULL, NULL}, }; static int @@ -3228,12 +3233,12 @@ SetProcTitle(struct cmdargs const *arg) char *argv[MAXARGS]; int argc = arg->argc - arg->argn; - if (arg->argc == arg->argn) { + if (arg->argc <= arg->argn) { SetTitle(NULL); return 0; } - if (argc >= sizeof argv / sizeof argv[0]) { + if ((unsigned)argc >= sizeof argv / sizeof argv[0]) { argc = sizeof argv / sizeof argv[0] - 1; log_Printf(LogWARN, "Truncating proc title to %d args\n", argc); } diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c index 085e9c4..c554202 100644 --- a/usr.sbin/ppp/datalink.c +++ b/usr.sbin/ppp/datalink.c @@ -79,7 +79,7 @@ #include "datalink.h" static void datalink_LoginDone(struct datalink *); -static void datalink_NewState(struct datalink *, int); +static void datalink_NewState(struct datalink *, unsigned); static void datalink_OpenTimeout(void *v) @@ -274,7 +274,7 @@ datalink_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, if (dl->dial.timer.state != TIMER_RUNNING) { if (--dl->dial.tries < 0) dl->dial.tries = 0; - if (physical_Open(dl->physical, dl->bundle) >= 0) { + if (physical_Open(dl->physical) >= 0) { log_WritePrompts(dl, "%s: Entering terminal mode on %s\r\n" "Type `~?' for help\r\n", dl->name, dl->physical->name.full); @@ -1269,16 +1269,16 @@ static const char * const states[] = { const char * datalink_State(struct datalink *dl) { - if (dl->state < 0 || dl->state >= sizeof states / sizeof states[0]) + if (dl->state >= sizeof states / sizeof states[0]) return "unknown"; return states[dl->state]; } static void -datalink_NewState(struct datalink *dl, int state) +datalink_NewState(struct datalink *dl, unsigned state) { if (state != dl->state) { - if (state >= 0 && state < sizeof states / sizeof states[0]) { + if (state < sizeof states / sizeof states[0]) { log_Printf(LogPHASE, "%s: %s -> %s\n", dl->name, datalink_State(dl), states[state]); dl->state = state; diff --git a/usr.sbin/ppp/datalink.h b/usr.sbin/ppp/datalink.h index 64b3c16..060063d 100644 --- a/usr.sbin/ppp/datalink.h +++ b/usr.sbin/ppp/datalink.h @@ -53,7 +53,7 @@ struct bundle; struct datalink { struct fdescriptor desc; /* We play either a physical or a chat */ - int state; /* Our DATALINK_* state */ + unsigned state; /* Our DATALINK_* state */ struct physical *physical; /* Our link */ struct chat chat; /* For bringing the link up & down */ diff --git a/usr.sbin/ppp/deflate.c b/usr.sbin/ppp/deflate.c index 3e6198d..57c9004 100644 --- a/usr.sbin/ppp/deflate.c +++ b/usr.sbin/ppp/deflate.c @@ -66,8 +66,8 @@ DeflateResetOutput(void *v) } static struct mbuf * -DeflateOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, - struct mbuf *mp) +DeflateOutput(void *v, struct ccp *ccp, struct link *l __unused, + int pri __unused, u_short *proto, struct mbuf *mp) { struct deflate_state *state = (struct deflate_state *)v; u_char *wp, *rp; @@ -440,7 +440,7 @@ DeflateDispOpts(struct fsm_opt *o) } static void -DeflateInitOptsOutput(struct bundle *bundle, struct fsm_opt *o, +DeflateInitOptsOutput(struct bundle *bundle __unused, struct fsm_opt *o, const struct ccp_config *cfg) { o->hdr.len = 4; @@ -449,8 +449,8 @@ DeflateInitOptsOutput(struct bundle *bundle, struct fsm_opt *o, } static int -DeflateSetOptsOutput(struct bundle *bundle, struct fsm_opt *o, - const struct ccp_config *cfg) +DeflateSetOptsOutput(struct bundle *bundle __unused, struct fsm_opt *o, + const struct ccp_config *cfg __unused) { if (o->hdr.len != 4 || (o->data[0] & 15) != 8 || o->data[1] != '\0') return MODE_REJ; @@ -464,7 +464,7 @@ DeflateSetOptsOutput(struct bundle *bundle, struct fsm_opt *o, } static int -DeflateSetOptsInput(struct bundle *bundle, struct fsm_opt *o, +DeflateSetOptsInput(struct bundle *bundle __unused, struct fsm_opt *o, const struct ccp_config *cfg) { int want; @@ -486,7 +486,7 @@ DeflateSetOptsInput(struct bundle *bundle, struct fsm_opt *o, } static void * -DeflateInitInput(struct bundle *bundle, struct fsm_opt *o) +DeflateInitInput(struct bundle *bundle __unused, struct fsm_opt *o) { struct deflate_state *state; @@ -509,7 +509,7 @@ DeflateInitInput(struct bundle *bundle, struct fsm_opt *o) } static void * -DeflateInitOutput(struct bundle *bundle, struct fsm_opt *o) +DeflateInitOutput(struct bundle *bundle __unused, struct fsm_opt *o) { struct deflate_state *state; diff --git a/usr.sbin/ppp/defs.c b/usr.sbin/ppp/defs.c index f29eff6..dcd9e47 100644 --- a/usr.sbin/ppp/defs.c +++ b/usr.sbin/ppp/defs.c @@ -168,7 +168,7 @@ GetIpAddr(const char *cp) } static const struct speeds { - int nspeed; + unsigned nspeed; speed_t speed; } speeds[] = { #ifdef B50 @@ -254,8 +254,8 @@ static const struct speeds { { 0, 0 } }; -int -SpeedToInt(speed_t speed) +unsigned +SpeedToUnsigned(speed_t speed) { const struct speeds *sp; @@ -268,7 +268,7 @@ SpeedToInt(speed_t speed) } speed_t -IntToSpeed(int nspeed) +UnsignedToSpeed(unsigned nspeed) { const struct speeds *sp; @@ -373,7 +373,7 @@ ex_desc(int ex) "redial", "reconnect" }; - if (ex >= 0 && ex < sizeof desc / sizeof *desc) + if (ex >= 0 && ex < (int)(sizeof desc / sizeof *desc)) return desc[ex]; snprintf(num, sizeof num, "%d", ex); return num; @@ -405,7 +405,8 @@ zerofdset(fd_set *s) void Concatinate(char *buf, size_t sz, int argc, const char *const *argv) { - int i, n, pos; + int i, n; + unsigned pos; *buf = '\0'; for (pos = i = 0; i < argc; i++) { @@ -419,11 +420,11 @@ Concatinate(char *buf, size_t sz, int argc, const char *const *argv) } } +#if defined(__FreeBSD__) && !defined(NOKLDLOAD) int loadmodules(int how, const char *module, ...) { int loaded = 0; -#if defined(__FreeBSD__) && !defined(NOKLDLOAD) va_list ap; va_start(ap, module); @@ -438,6 +439,12 @@ loadmodules(int how, const char *module, ...) module = va_arg(ap, const char *); } va_end(ap); -#endif return loaded; } +#else +int +loadmodules(int how __unused, const char *module __unused, ...) +{ + return 0; +} +#endif diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h index 2be7686..47acb9e 100644 --- a/usr.sbin/ppp/defs.h +++ b/usr.sbin/ppp/defs.h @@ -128,8 +128,8 @@ extern ssize_t fullread(int, void *, size_t); extern const char *mode2Nam(int); extern int Nam2mode(const char *); extern struct in_addr GetIpAddr(const char *); -extern int SpeedToInt(speed_t); -extern speed_t IntToSpeed(int); +extern unsigned SpeedToUnsigned(speed_t); +extern speed_t UnsignedToSpeed(unsigned); extern char *findblank(char *, int); extern int MakeArgs(char *, char **, int, int); extern const char *NumStr(long, char *, size_t); diff --git a/usr.sbin/ppp/ether.c b/usr.sbin/ppp/ether.c index ce0bfd2..c1461c9 100644 --- a/usr.sbin/ppp/ether.c +++ b/usr.sbin/ppp/ether.c @@ -110,7 +110,7 @@ struct etherdevice { #define device2ether(d) \ ((d)->type == ETHER_DEVICE ? (struct etherdevice *)d : NULL) -int +unsigned ether_DeviceSize(void) { return sizeof(struct etherdevice); @@ -121,7 +121,7 @@ ether_Write(struct physical *p, const void *v, size_t n) { struct etherdevice *dev = device2ether(p->handler); - return NgSendData(p->fd, dev->hook, v, n) == -1 ? -1 : n; + return NgSendData(p->fd, dev->hook, v, n) == -1 ? -1 : (ssize_t)n; } static ssize_t @@ -191,7 +191,7 @@ ether_Slot(struct physical *p) static void ether_device2iov(struct device *d, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd, int *nauxfd) { struct etherdevice *dev = device2ether(d); int sz = physical_MaxDeviceSize(); @@ -343,7 +343,7 @@ static const struct device baseetherdevice = { struct device * ether_iov2device(int type, struct physical *p, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd, int *nauxfd) { if (type == ETHER_DEVICE) { struct etherdevice *dev = (struct etherdevice *)iov[(*niov)++].iov_base; @@ -443,8 +443,10 @@ ether_Create(struct physical *p) struct ng_mesg *resp; const struct hooklist *hlist; const struct nodeinfo *ninfo; - char *path, *sessionid, *mode; - int ifacelen, f; + char *path, *sessionid; + const char *mode; + size_t ifacelen; + unsigned f; dev = NULL; path = NULL; diff --git a/usr.sbin/ppp/ether.h b/usr.sbin/ppp/ether.h index 16c9a9e..94511bd 100644 --- a/usr.sbin/ppp/ether.h +++ b/usr.sbin/ppp/ether.h @@ -34,4 +34,4 @@ struct device; extern struct device *ether_Create(struct physical *); extern struct device *ether_iov2device(int, struct physical *, struct iovec *, int *, int, int *, int *); -extern int ether_DeviceSize(void); +extern unsigned ether_DeviceSize(void); diff --git a/usr.sbin/ppp/exec.c b/usr.sbin/ppp/exec.c index 67d00ac..7c80034 100644 --- a/usr.sbin/ppp/exec.c +++ b/usr.sbin/ppp/exec.c @@ -88,7 +88,8 @@ static struct device execdevice = { struct device * exec_iov2device(int type, struct physical *p, struct iovec *iov, - int *niov, int maxiov, int *auxfd, int *nauxfd) + int *niov, int maxiov __unused, int *auxfd __unused, + int *nauxfd __unused) { if (type == EXEC_DEVICE) { free(iov[(*niov)++].iov_base); diff --git a/usr.sbin/ppp/filter.c b/usr.sbin/ppp/filter.c index 994c090..f59848e 100644 --- a/usr.sbin/ppp/filter.c +++ b/usr.sbin/ppp/filter.c @@ -70,7 +70,7 @@ #include "ncp.h" #include "bundle.h" -static int filter_Nam2Op(const char *); +static unsigned filter_Nam2Op(const char *); static int ParsePort(const char *service, const char *proto) @@ -96,8 +96,7 @@ ParsePort(const char *service, const char *proto) * ICMP Syntax: src eq icmp_message_type */ static int -ParseIcmp(int argc, char const *const *argv, const struct protoent *pe, - struct filterent *tgt) +ParseIcmp(int argc, char const *const *argv, struct filterent *tgt) { int type; char *cp; @@ -189,8 +188,7 @@ ParseUdpOrTcp(int argc, char const *const *argv, const struct protoent *pe, } static int -ParseGeneric(int argc, char const * const *argv, const struct protoent *pe, - struct filterent *tgt) +ParseGeneric(int argc, struct filterent *tgt) { /* * Filter currently is a catch-all. Requests are either permitted or @@ -382,10 +380,10 @@ filter_Parse(struct ncp *ncp, int argc, char const *const *argv, #ifndef NOINET6 case IPPROTO_ICMPV6: #endif - val = ParseIcmp(argc, argv, pe, &fe); + val = ParseIcmp(argc, argv, &fe); break; default: - val = ParseGeneric(argc, argv, pe, &fe); + val = ParseGeneric(argc, &fe); break; } @@ -435,12 +433,12 @@ filter_Set(struct cmdargs const *arg) } const char * -filter_Action2Nam(int act) +filter_Action2Nam(unsigned act) { static const char * const actname[] = { " none ", "permit ", " deny " }; - static char buf[8]; + static char buf[8]; - if (act >= 0 && act < MAXFILTERS) { + if (act < MAXFILTERS) { snprintf(buf, sizeof buf, "%6d ", act); return buf; } else if (act >= A_NONE && act < A_NONE + sizeof(actname)/sizeof(char *)) @@ -539,7 +537,7 @@ filter_Show(struct cmdargs const *arg) static const char * const opname[] = {"none", "eq", "gt", "lt"}; const char * -filter_Op2Nam(int op) +filter_Op2Nam(unsigned op) { if (op >= sizeof opname / sizeof opname[0]) return "unknown"; @@ -547,10 +545,10 @@ filter_Op2Nam(int op) } -static int +static unsigned filter_Nam2Op(const char *cp) { - int op; + unsigned op; for (op = sizeof opname / sizeof opname[0] - 1; op; op--) if (!strcasecmp(cp, opname[op])) diff --git a/usr.sbin/ppp/filter.h b/usr.sbin/ppp/filter.h index f994f4b..ce67420 100644 --- a/usr.sbin/ppp/filter.h +++ b/usr.sbin/ppp/filter.h @@ -95,7 +95,7 @@ struct cmdargs; extern int filter_Show(struct cmdargs const *); extern int filter_Set(struct cmdargs const *); -extern const char * filter_Action2Nam(int); -extern const char *filter_Op2Nam(int); +extern const char * filter_Action2Nam(unsigned); +extern const char *filter_Op2Nam(unsigned); extern void filter_AdjustAddr(struct filter *, struct ncpaddr *, struct ncpaddr *, struct in_addr *); diff --git a/usr.sbin/ppp/fsm.c b/usr.sbin/ppp/fsm.c index 685e5f1..120f3cb 100644 --- a/usr.sbin/ppp/fsm.c +++ b/usr.sbin/ppp/fsm.c @@ -185,7 +185,7 @@ NewState(struct fsm *fp, int new) } void -fsm_Output(struct fsm *fp, u_int code, u_int id, u_char *ptr, int count, +fsm_Output(struct fsm *fp, u_int code, u_int id, u_char *ptr, unsigned count, int mtype) { int plen; @@ -492,7 +492,7 @@ FsmRecvConfigReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) dec.rejend = dec.rej; cp = MBUF_CTOP(bp); (*fp->fn->DecodeConfig)(fp, cp, cp + flen, MODE_REQ, &dec); - if (flen < sizeof(struct fsm_opt_hdr)) + if (flen < (int)sizeof(struct fsm_opt_hdr)) log_Printf(fp->LogLevel, " [EMPTY]\n"); if (dec.nakend == dec.nak && dec.rejend == dec.rej) @@ -626,7 +626,7 @@ FsmRecvConfigAck(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) dec.rejend = dec.rej; cp = MBUF_CTOP(bp); (*fp->fn->DecodeConfig)(fp, cp, cp + flen, MODE_ACK, &dec); - if (flen < sizeof(struct fsm_opt_hdr)) + if (flen < (int)sizeof(struct fsm_opt_hdr)) log_Printf(fp->LogLevel, " [EMPTY]\n"); switch (fp->state) { @@ -710,7 +710,7 @@ FsmRecvConfigNak(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) dec.rejend = dec.rej; cp = MBUF_CTOP(bp); (*fp->fn->DecodeConfig)(fp, cp, cp + flen, MODE_NAK, &dec); - if (flen < sizeof(struct fsm_opt_hdr)) + if (flen < (int)sizeof(struct fsm_opt_hdr)) log_Printf(fp->LogLevel, " [EMPTY]\n"); switch (fp->state) { @@ -771,7 +771,7 @@ FsmRecvTermReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) } static void -FsmRecvTermAck(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) +FsmRecvTermAck(struct fsm *fp, struct fsmheader *lhp __unused, struct mbuf *bp) /* RTA */ { switch (fp->state) { @@ -803,12 +803,13 @@ FsmRecvConfigRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) /* RCJ */ { struct fsm_decode dec; - int plen, flen; + size_t plen; + int flen; u_char *cp; plen = m_length(bp); flen = ntohs(lhp->length) - sizeof *lhp; - if (plen < flen) { + if ((int)plen < flen) { m_freem(bp); return; } @@ -842,7 +843,7 @@ FsmRecvConfigRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) dec.rejend = dec.rej; cp = MBUF_CTOP(bp); (*fp->fn->DecodeConfig)(fp, cp, cp + flen, MODE_REJ, &dec); - if (flen < sizeof(struct fsm_opt_hdr)) + if (flen < (int)sizeof(struct fsm_opt_hdr)) log_Printf(fp->LogLevel, " [EMPTY]\n"); switch (fp->state) { @@ -866,13 +867,14 @@ FsmRecvConfigRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) } static void -FsmRecvCodeRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) +FsmRecvCodeRej(struct fsm *fp __unused, struct fsmheader *lhp __unused, + struct mbuf *bp) { m_freem(bp); } static void -FsmRecvProtoRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) +FsmRecvProtoRej(struct fsm *fp, struct fsmheader *lhp __unused, struct mbuf *bp) { struct physical *p = link2physical(fp->link); u_short proto; @@ -972,7 +974,7 @@ FsmRecvEchoReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) } static void -FsmRecvEchoRep(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) +FsmRecvEchoRep(struct fsm *fp, struct fsmheader *lhp __unused, struct mbuf *bp) { if (fsm2lcp(fp)) bp = lqr_RecvEcho(fp, bp); @@ -981,7 +983,8 @@ FsmRecvEchoRep(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) } static void -FsmRecvDiscReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) +FsmRecvDiscReq(struct fsm *fp __unused, struct fsmheader *lhp __unused, + struct mbuf *bp) { m_freem(bp); } @@ -1009,7 +1012,8 @@ FsmRecvIdent(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) } static void -FsmRecvTimeRemain(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) +FsmRecvTimeRemain(struct fsm *fp __unused, struct fsmheader *lhp __unused, + struct mbuf *bp) { m_freem(bp); } @@ -1039,7 +1043,7 @@ FsmRecvResetAck(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp) void fsm_Input(struct fsm *fp, struct mbuf *bp) { - int len; + size_t len; struct fsmheader lh; const struct fsmcodedesc *codep; @@ -1051,7 +1055,7 @@ fsm_Input(struct fsm *fp, struct mbuf *bp) bp = mbuf_Read(bp, &lh, sizeof lh); if (ntohs(lh.length) > len) { - log_Printf(LogWARN, "%s: Oops: Got %d bytes but %d byte payload " + log_Printf(LogWARN, "%s: Oops: Got %u bytes but %d byte payload " "- dropped\n", fp->link->name, len, (int)ntohs(lh.length)); m_freem(bp); return; @@ -1099,7 +1103,7 @@ fsm_NullRecvResetReq(struct fsm *fp) } void -fsm_NullRecvResetAck(struct fsm *fp, u_char id) +fsm_NullRecvResetAck(struct fsm *fp, u_char id __unused) { log_Printf(fp->LogLevel, "%s: Oops - received unexpected reset ack\n", fp->link->name); @@ -1155,12 +1159,12 @@ fsm_readopt(u_char **cp) static int fsm_opt(u_char *opt, int optlen, const struct fsm_opt *o) { - int cplen = o->hdr.len; + unsigned cplen = o->hdr.len; - if (optlen < sizeof(struct fsm_opt_hdr)) + if (optlen < (int)sizeof(struct fsm_opt_hdr)) optlen = 0; - if (cplen > optlen) { + if ((int)cplen > optlen) { log_Printf(LogERROR, "Can't REJ length %d - trunating to %d\n", cplen, optlen); cplen = optlen; diff --git a/usr.sbin/ppp/fsm.h b/usr.sbin/ppp/fsm.h index 3280ba0..b35c623 100644 --- a/usr.sbin/ppp/fsm.h +++ b/usr.sbin/ppp/fsm.h @@ -104,7 +104,7 @@ struct fsm { u_short min_code; u_short max_code; int open_mode; /* Delay before config REQ (-1 forever) */ - int state; /* State of the machine */ + unsigned state; /* State of the machine */ u_char reqid; /* Next request id */ int restart; /* Restart counter value */ @@ -183,7 +183,7 @@ struct fsm_opt { extern void fsm_Init(struct fsm *, const char *, u_short, int, int, int, struct bundle *, struct link *, const struct fsm_parent *, struct fsm_callbacks *, const char * const [3]); -extern void fsm_Output(struct fsm *, u_int, u_int, u_char *, int, int); +extern void fsm_Output(struct fsm *, u_int, u_int, u_char *, unsigned, int); extern void fsm_Open(struct fsm *); extern void fsm_Up(struct fsm *); extern void fsm_Down(struct fsm *); diff --git a/usr.sbin/ppp/hdlc.c b/usr.sbin/ppp/hdlc.c index 81b537d..517c3c5 100644 --- a/usr.sbin/ppp/hdlc.c +++ b/usr.sbin/ppp/hdlc.c @@ -137,15 +137,9 @@ HdlcFcsBuf(u_short fcs, struct mbuf *m) return (fcs); } -int -hdlc_WrapperOctets(struct lcp *lcp, u_short proto) -{ - return 2; -} - static struct mbuf * -hdlc_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, - int pri, u_short *proto) +hdlc_LayerPush(struct bundle *bundle __unused, struct link *l __unused, + struct mbuf *bp, int pri __unused, u_short *proto __unused) { struct mbuf *last; u_char *cp; @@ -293,7 +287,7 @@ static struct { const char * hdlc_Protocol2Nam(u_short proto) { - int f; + unsigned f; for (f = 0; f < NPROTOCOLS; f++) if (proto >= protocols[f].from && proto <= protocols[f].to) @@ -304,8 +298,8 @@ hdlc_Protocol2Nam(u_short proto) } static struct mbuf * -hdlc_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, - u_short *proto) +hdlc_LayerPull(struct bundle *b __unused, struct link *l, struct mbuf *bp, + u_short *proto __unused) { struct physical *p = link2physical(l); u_short fcs; @@ -364,7 +358,7 @@ static const struct frameheader { }; int -hdlc_Detect(u_char const **cp, int n, int issync) +hdlc_Detect(u_char const **cp, unsigned n, int issync) { const struct frameheader *fh; const u_char *h; diff --git a/usr.sbin/ppp/hdlc.h b/usr.sbin/ppp/hdlc.h index 839d83c..b9211a6 100644 --- a/usr.sbin/ppp/hdlc.h +++ b/usr.sbin/ppp/hdlc.h @@ -110,7 +110,7 @@ extern void hdlc_DecodePacket(struct bundle *, u_short, struct mbuf *, struct link *); extern u_short hdlc_Fcs(u_char *, size_t); -extern int hdlc_Detect(u_char const **, int, int); -extern int hdlc_WrapperOctets(struct lcp *, u_short); +extern int hdlc_Detect(u_char const **, unsigned, int); +#define hdlc_WrapperOctets() (2) extern struct layer hdlclayer; diff --git a/usr.sbin/ppp/i4b.c b/usr.sbin/ppp/i4b.c index 5744e89..95c686f 100644 --- a/usr.sbin/ppp/i4b.c +++ b/usr.sbin/ppp/i4b.c @@ -91,7 +91,7 @@ struct i4bdevice { #define device2i4b(d) ((d)->type == I4B_DEVICE ? (struct i4bdevice *)d : NULL) -int +unsigned i4b_DeviceSize(void) { return sizeof(struct i4bdevice); @@ -248,14 +248,14 @@ i4b_Free(struct physical *p) free(dev); } -static int +static unsigned i4b_Speed(struct physical *p) { struct termios ios; - int ret; + unsigned ret; if (tcgetattr(p->fd, &ios) == -1 || - (ret = SpeedToInt(cfgetispeed(&ios))) == 0) + (ret = SpeedToUnsigned(cfgetispeed(&ios))) == 0) ret = 64000; return ret; @@ -288,7 +288,7 @@ i4b_Slot(struct physical *p) static void i4b_device2iov(struct device *d, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd __unused, int *nauxfd __unused) { struct i4bdevice *dev = device2i4b(d); int sz = physical_MaxDeviceSize(); @@ -330,7 +330,7 @@ static struct device basei4bdevice = { struct device * i4b_iov2device(int type, struct physical *p, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd __unused, int *nauxfd __unused) { if (type == I4B_DEVICE) { struct i4bdevice *dev = (struct i4bdevice *)iov[(*niov)++].iov_base; diff --git a/usr.sbin/ppp/i4b.h b/usr.sbin/ppp/i4b.h index 984535c..3545c84 100644 --- a/usr.sbin/ppp/i4b.h +++ b/usr.sbin/ppp/i4b.h @@ -34,4 +34,4 @@ struct device; extern struct device *i4b_Create(struct physical *); extern struct device *i4b_iov2device(int, struct physical *, struct iovec *, int *, int, int *, int *); -extern int i4b_DeviceSize(void); +extern unsigned i4b_DeviceSize(void); diff --git a/usr.sbin/ppp/iface.c b/usr.sbin/ppp/iface.c index 8a23742..67768da 100644 --- a/usr.sbin/ppp/iface.c +++ b/usr.sbin/ppp/iface.c @@ -373,7 +373,8 @@ iface_addr_Add(const char *name, struct iface_addr *addr, int s) void iface_Clear(struct iface *iface, struct ncp *ncp, int family, int how) { - int addrs, af, inskip, in6skip, n, s4 = -1, s6 = -1, *s; + int addrs, af, inskip, in6skip, s4 = -1, s6 = -1, *s; + unsigned n; if (iface->addrs) { inskip = in6skip = how == IFACE_CLEAR_ALL ? 0 : 1; @@ -431,7 +432,8 @@ int iface_Add(struct iface *iface, struct ncp *ncp, const struct ncprange *ifa, const struct ncpaddr *peer, int how) { - int af, n, removed, s; + int af, removed, s; + unsigned n; struct ncpaddr ncplocal; struct iface_addr *addr, newaddr; @@ -515,7 +517,8 @@ int iface_Delete(struct iface *iface, struct ncp *ncp, const struct ncpaddr *del) { struct ncpaddr found; - int n, res, s; + unsigned n; + int res, s; if ((s = ID0socket(ncpaddr_family(del), SOCK_DGRAM, 0)) == -1) { log_Printf(LogERROR, "iface_Delete: socket(): %s\n", strerror(errno)); @@ -642,7 +645,8 @@ iface_Show(struct cmdargs const *arg) { struct ncpaddr ncpaddr; struct iface *iface = arg->bundle->iface, *current; - int f, flags; + unsigned f; + int flags; #ifndef NOINET6 int scopeid, width; #endif @@ -666,7 +670,7 @@ iface_Show(struct cmdargs const *arg) flags); #endif - prompt_Printf(arg->prompt, "> mtu %d has %d address%s:\n", iface->mtu, + prompt_Printf(arg->prompt, "> mtu %lu has %d address%s:\n", iface->mtu, iface->addrs, iface->addrs == 1 ? "" : "es"); for (f = 0; f < iface->addrs; f++) { diff --git a/usr.sbin/ppp/iface.h b/usr.sbin/ppp/iface.h index 28c3761..1fd0a70 100644 --- a/usr.sbin/ppp/iface.h +++ b/usr.sbin/ppp/iface.h @@ -38,9 +38,9 @@ struct iface { char *name; /* Interface name (malloc'd) */ int index; /* Interface index */ int flags; /* Interface flags (IFF_*) */ - int mtu; /* struct tuninfo MTU */ + unsigned long mtu; /* struct tuninfo MTU */ - int addrs; /* How many in_addr's */ + unsigned addrs; /* How many in_addr's */ struct iface_addr *addr; /* Array of addresses (malloc'd) */ }; diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index 9c5a98b..e3ec20d 100644 --- a/usr.sbin/ppp/ip.c +++ b/usr.sbin/ppp/ip.c @@ -110,7 +110,7 @@ dns_Qclass2Txt(u_short qclass) /* rfc1035 */ { 1, "IN" }, { 2, "CS" }, { 3, "CH" }, { 4, "HS" }, { 255, "*" } }; - int f; + unsigned f; for (f = 0; f < sizeof qtxt / sizeof *qtxt; f++) if (qtxt[f].id == qclass) @@ -137,7 +137,7 @@ dns_Qtype2Txt(u_short qtype) { 27, "GPOS" }, { 28, "AAAA" }, { 252, "AXFR" }, { 253, "MAILB" }, { 254, "MAILA" }, { 255, "*" } }; - int f; + unsigned f; for (f = 0; f < sizeof qtxt / sizeof *qtxt; f++) if (qtxt[f].id == qtype) @@ -494,7 +494,7 @@ ip_LogDNS(const struct udphdr *uh, const char *direction) const u_short *pktptr; const u_char *ptr; u_short *hptr, tmp; - int len; + unsigned len; ptr = (const char *)uh + sizeof *uh; len = ntohs(uh->uh_ulen) - sizeof *uh; @@ -519,11 +519,11 @@ ip_LogDNS(const struct udphdr *uh, const char *direction) n = namewithdot; end = ptr + len - 4; - if (end - ptr >= sizeof namewithdot) + if (end - ptr >= (int)sizeof namewithdot) end = ptr + sizeof namewithdot - 1; while (ptr < end) { len = *ptr++; - if (len > end - ptr) + if ((int)len > end - ptr) len = end - ptr; if (n != namewithdot) *n++ = '.'; @@ -554,6 +554,7 @@ PacketCheck(struct bundle *bundle, u_int32_t family, const unsigned char *packet, int nb, struct filter *filter, const char *prefix, unsigned *psecs) { + char logbuf[200]; static const char *const TcpFlags[] = { "FIN", "SYN", "RST", "PSH", "ACK", "URG" }; @@ -565,9 +566,8 @@ PacketCheck(struct bundle *bundle, u_int32_t family, #endif const unsigned char *payload; struct ncpaddr srcaddr, dstaddr; - int cproto, mask, len, n, pri, logit, loglen, result; - char logbuf[200]; - int datalen, frag; + int cproto, mask, len, n, pri, logit, result, datalen, frag; + unsigned loglen; u_char tos; logit = (log_IsKept(LogTCPIP) || log_IsKept(LogDNS)) && @@ -764,6 +764,7 @@ PacketCheck(struct bundle *bundle, u_int32_t family, snprintf(logbuf + loglen, sizeof logbuf - loglen, " contains "); result = PacketCheck(bundle, AF_INET, payload, nb - (payload - packet), filter, logbuf, psecs); + loglen += strlen(logbuf + loglen); if (result != -2) return result; } @@ -896,10 +897,11 @@ PacketCheck(struct bundle *bundle, u_int32_t family, return result; } -static int +static size_t ip_Input(struct bundle *bundle, struct link *l, struct mbuf *bp, u_int32_t af) { - int nb, nw; + ssize_t nw; + size_t nb; struct tun_data tun; char *data; unsigned secs, alivesecs; @@ -933,7 +935,7 @@ ip_Input(struct bundle *bundle, struct link *l, struct mbuf *bp, u_int32_t af) data = tun.data; nw = write(bundle->dev.fd, data, nb); - if (nw != nb) { + if (nw != (ssize_t)nb) { if (nw == -1) log_Printf(LogERROR, "ip_Input: %s: wrote %d, got %s\n", l->name, nb, strerror(errno)); diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index 6b41f8f..9094845 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -148,7 +148,7 @@ protoname(int proto) { 131, "SECDNS" }, /* 131: Secondary DNS Server Address */ { 132, "SECNBNS" } /* 132: Secondary NBNS Server Address */ }; - int f; + unsigned f; for (f = 0; f < sizeof cftypes / sizeof *cftypes; f++) if (cftypes[f].id == proto) @@ -319,8 +319,7 @@ void ipcp_RestoreDNS(struct ipcp *ipcp) { if (ipcp->ns.resolver) { - ssize_t got; - size_t len; + ssize_t got, len; int fd; if ((fd = ID0open(_PATH_RESCONF, O_WRONLY|O_TRUNC, 0644)) != -1) { @@ -330,8 +329,8 @@ ipcp_RestoreDNS(struct ipcp *ipcp) log_Printf(LogERROR, "Failed rewriting %s: write: %s\n", _PATH_RESCONF, strerror(errno)); else - log_Printf(LogERROR, "Failed rewriting %s: wrote %lu of %lu\n", - _PATH_RESCONF, (unsigned long)got, (unsigned long)len); + log_Printf(LogERROR, "Failed rewriting %s: wrote %ld of %ld\n", + _PATH_RESCONF, (long)got, (long)len); } close(fd); } else @@ -511,7 +510,8 @@ ipcp_Setup(struct ipcp *ipcp, u_int32_t mask) struct iface *iface = ipcp->fsm.bundle->iface; struct ncpaddr ipaddr; struct in_addr peer; - int pos, n; + int pos; + unsigned n; ipcp->fsm.open_mode = 0; ipcp->ifmask.s_addr = mask == INADDR_NONE ? ipcp->cfg.netmask.s_addr : mask; @@ -605,24 +605,18 @@ numaddresses(struct in_addr mask) static int ipcp_proxyarp(struct ipcp *ipcp, - int (*proxyfun)(struct bundle *, struct in_addr, int), + int (*proxyfun)(struct bundle *, struct in_addr), const struct iface_addr *addr) { struct bundle *bundle = ipcp->fsm.bundle; struct in_addr peer, mask, ip; - int n, ret, s; + int n, ret; if (!ncpaddr_getip4(&addr->peer, &peer)) { log_Printf(LogERROR, "Oops, ipcp_proxyarp() called with unexpected addr\n"); return 0; } - if ((s = ID0socket(PF_INET, SOCK_DGRAM, 0)) == -1) { - log_Printf(LogERROR, "ipcp_proxyarp: socket: %s\n", - strerror(errno)); - return 0; - } - ret = 0; if (Enabled(bundle, OPT_PROXYALL)) { @@ -639,7 +633,7 @@ ipcp_proxyarp(struct ipcp *ipcp, } while (n) { if (!((ip.s_addr ^ peer.s_addr) & mask.s_addr)) { - if (!(ret = (*proxyfun)(bundle, ip, s))) + if (!(ret = (*proxyfun)(bundle, ip))) break; n--; } @@ -647,9 +641,7 @@ ipcp_proxyarp(struct ipcp *ipcp, } ret = !n; } else if (Enabled(bundle, OPT_PROXY)) - ret = (*proxyfun)(bundle, peer, s); - - close(s); + ret = (*proxyfun)(bundle, peer); return ret; } @@ -798,7 +790,7 @@ IpcpSendConfigReq(struct fsm *fp) } static void -IpcpSentTerminateReq(struct fsm *fp) +IpcpSentTerminateReq(struct fsm *fp __unused) { /* Term REQ just sent by FSM */ } @@ -974,7 +966,7 @@ ipcp_ValidateReq(struct ipcp *ipcp, struct in_addr ip, struct fsm_decode *dec) struct bundle *bundle = ipcp->fsm.bundle; struct iface *iface = bundle->iface; struct in_addr myaddr, peer; - int n; + unsigned n; if (iplist_isvalid(&ipcp->cfg.peer_list)) { ncprange_getip4addr(&ipcp->cfg.my_range, &myaddr); @@ -1060,7 +1052,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, gotdnsnak = 0; - while (end - cp >= sizeof(opt->hdr)) { + while (end - cp >= (int)sizeof(opt->hdr)) { if ((opt = fsm_readopt(&cp)) == NULL) break; @@ -1102,7 +1094,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, case TY_COMPPROTO: pcomp = (struct compreq *)opt->data; - compproto = (ntohs(pcomp->proto) << 16) + (pcomp->slots << 8) + + compproto = (ntohs(pcomp->proto) << 16) + ((int)pcomp->slots << 8) + pcomp->compcid; log_Printf(LogIPCP, "%s %s\n", tbuff, vj2asc(compproto)); @@ -1129,8 +1121,8 @@ IpcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, break; case 6: /* RFC1332 */ if (ntohs(pcomp->proto) == PROTO_VJCOMP) { - if (pcomp->slots <= MAX_VJ_STATES - && pcomp->slots >= MIN_VJ_STATES) { + /* We know pcomp->slots' max value == MAX_VJ_STATES */ + if (pcomp->slots >= MIN_VJ_STATES) { /* Ok, we can do that */ ipcp->peer_compproto = compproto; ipcp->heis1172 = 0; @@ -1138,8 +1130,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, } else { /* Get as close as we can to what he wants */ ipcp->heis1172 = 0; - pcomp->slots = pcomp->slots < MIN_VJ_STATES ? - MIN_VJ_STATES : MAX_VJ_STATES; + pcomp->slots = MIN_VJ_STATES; nak.hdr.id = TY_COMPPROTO; nak.hdr.len = 4; memcpy(nak.data, &pcomp, 2); @@ -1165,9 +1156,8 @@ IpcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, case MODE_NAK: if (ntohs(pcomp->proto) == PROTO_VJCOMP) { - if (pcomp->slots > MAX_VJ_STATES) - pcomp->slots = MAX_VJ_STATES; - else if (pcomp->slots < MIN_VJ_STATES) + /* We know pcomp->slots' max value == MAX_VJ_STATES */ + if (pcomp->slots < MIN_VJ_STATES) pcomp->slots = MIN_VJ_STATES; compproto = (ntohs(pcomp->proto) << 16) + (pcomp->slots << 8) + pcomp->compcid; diff --git a/usr.sbin/ppp/iplist.c b/usr.sbin/ppp/iplist.c index 4ef00e4..a7fae6e 100644 --- a/usr.sbin/ppp/iplist.c +++ b/usr.sbin/ppp/iplist.c @@ -172,7 +172,7 @@ iplist_reset(struct iplist *list) struct in_addr iplist_setcurpos(struct iplist *list, long pos) { - if (pos < 0 || pos >= list->nItems) { + if (pos < 0 || (unsigned)pos >= list->nItems) { list->cur.pos = -1; list->cur.ip.s_addr = INADDR_ANY; return list->cur.ip; @@ -182,7 +182,7 @@ iplist_setcurpos(struct iplist *list, long pos) list->cur.pos = 0; while (1) { iplist_nextrange(list); - if (pos < list->cur.nItems) { + if (pos < (int)list->cur.nItems) { if (pos) { list->cur.srcitem = pos; list->cur.pos += pos; diff --git a/usr.sbin/ppp/ipv6cp.c b/usr.sbin/ppp/ipv6cp.c index 543a75d..e7ba5a5 100644 --- a/usr.sbin/ppp/ipv6cp.c +++ b/usr.sbin/ppp/ipv6cp.c @@ -375,12 +375,14 @@ ipv6cp_AddOutOctets(struct ipv6cp *ipv6cp, int n) } void -ipv6cp_IfaceAddrAdded(struct ipv6cp *ipv6cp, const struct iface_addr *addr) +ipv6cp_IfaceAddrAdded(struct ipv6cp *ipv6cp __unused, + const struct iface_addr *addr __unused) { } void -ipv6cp_IfaceAddrDeleted(struct ipv6cp *ipv6cp, const struct iface_addr *addr) +ipv6cp_IfaceAddrDeleted(struct ipv6cp *ipv6cp __unused, + const struct iface_addr *addr __unused) { } @@ -629,7 +631,7 @@ ipv6cp_SendConfigReq(struct fsm *fp) } static void -ipv6cp_SentTerminateReq(struct fsm *fp) +ipv6cp_SentTerminateReq(struct fsm *fp __unused) { /* Term REQ just sent by FSM */ } @@ -642,7 +644,7 @@ ipv6cp_SendTerminateAck(struct fsm *fp, u_char id) } static const char * -protoname(int proto) +protoname(unsigned proto) { static const char *cftypes[] = { "IFACEID", "COMPPROTO" }; @@ -687,7 +689,7 @@ ipv6cp_DecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, memset(zero, 0, IPV6CP_IFIDLEN); - while (end - cp >= sizeof(opt->hdr)) { + while (end - cp >= (int)sizeof(opt->hdr)) { if ((opt = fsm_readopt(&cp)) == NULL) break; diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c index bfc7376..d1ca15a 100644 --- a/usr.sbin/ppp/lcp.c +++ b/usr.sbin/ppp/lcp.c @@ -116,7 +116,7 @@ static const char * const lcp_TimerNames[] = {"LCP restart", "LCP openmode", "LCP stopped"}; static const char * -protoname(int proto) +protoname(unsigned proto) { static const char * const cftypes[] = { /* Check out the latest ``Assigned numbers'' rfc (1700) */ @@ -146,8 +146,7 @@ protoname(int proto) "LDBACP", /* 23: Link Discriminator for BACP */ }; - if (proto < 0 || proto > sizeof cftypes / sizeof *cftypes || - cftypes[proto] == NULL) + if (proto > sizeof cftypes / sizeof *cftypes || cftypes[proto] == NULL) return HexStr(proto, NULL, 0); return cftypes[proto]; @@ -453,11 +452,11 @@ LcpSendConfigReq(struct fsm *fp) *o->data = CALLBACK_CBCP; INC_FSM_OPT(TY_CALLBACK, 3, o); } else if (lcp->want_callback.opmask & CALLBACK_BIT(CALLBACK_E164)) { - int sz = strlen(lcp->want_callback.msg); + size_t sz = strlen(lcp->want_callback.msg); if (sz > sizeof o->data - 1) { sz = sizeof o->data - 1; - log_Printf(LogWARN, "Truncating E164 data to %d octets (oops!)\n", sz); + log_Printf(LogWARN, "Truncating E164 data to %u octets (oops!)\n", sz); } *o->data = CALLBACK_E164; memcpy(o->data + 1, lcp->want_callback.msg, sz); @@ -529,7 +528,7 @@ lcp_RecvIdentification(struct lcp *lcp, char *data) } static void -LcpSentTerminateReq(struct fsm *fp) +LcpSentTerminateReq(struct fsm *fp __unused) { /* Term REQ just sent by FSM */ } @@ -658,7 +657,8 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, { /* Deal with incoming PROTO_LCP */ struct lcp *lcp = fsm2lcp(fp); - int sz, pos, op, callback_req, chap_type; + int pos, op, callback_req, chap_type; + size_t sz; u_int32_t magic, accmap; u_short mru, phmtu, maxmtu, maxmru, wantmtu, wantmru, proto; struct lqrreq *req; @@ -667,9 +667,10 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, struct physical *p = link2physical(fp->link); struct fsm_opt *opt, nak; - sz = op = callback_req = 0; + sz = 0; + op = callback_req = 0; - while (end - cp >= sizeof(opt->hdr)) { + while (end - cp >= (int)sizeof(opt->hdr)) { if ((opt = fsm_readopt(&cp)) == NULL) break; @@ -1055,11 +1056,13 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, break; case TY_CALLBACK: - if (opt->hdr.len == 2) + if (opt->hdr.len == 2) { op = CALLBACK_NONE; - else + sz = 0; + } else { op = (int)opt->data[0]; - sz = opt->hdr.len - 3; + sz = opt->hdr.len - 3; + } switch (op) { case CALLBACK_AUTH: log_Printf(LogLCP, "%s Auth\n", request); @@ -1101,7 +1104,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, lcp->his_callback.opmask = CALLBACK_BIT(op); if (sz > sizeof lcp->his_callback.msg - 1) { sz = sizeof lcp->his_callback.msg - 1; - log_Printf(LogWARN, "Truncating option arg to %d octets\n", sz); + log_Printf(LogWARN, "Truncating option arg to %u octets\n", sz); } memcpy(lcp->his_callback.msg, opt->data + 1, sz); lcp->his_callback.msg[sz] = '\0'; @@ -1194,7 +1197,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, } else if (!IsAccepted(mp->cfg.negenddisc)) { lcp->my_reject |= (1 << opt->hdr.id); fsm_rej(dec, opt); - } else if (opt->hdr.len - 3 < sizeof p->dl->peer.enddisc.address && + } else if (opt->hdr.len < sizeof p->dl->peer.enddisc.address + 3 && opt->data[0] <= MAX_ENDDISC_CLASS) { p->dl->peer.enddisc.class = opt->data[0]; p->dl->peer.enddisc.len = opt->hdr.len - 3; @@ -1223,7 +1226,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, default: sz = (sizeof desc - 2) / 2; - if (sz > opt->hdr.len - 2) + if (sz + 2 > opt->hdr.len) sz = opt->hdr.len - 2; pos = 0; desc[0] = sz ? ' ' : '\0'; @@ -1283,7 +1286,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, } extern struct mbuf * -lcp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) +lcp_Input(struct bundle *bundle __unused, struct link *l, struct mbuf *bp) { /* Got PROTO_LCP from link */ m_settype(bp, MB_LCPIN); diff --git a/usr.sbin/ppp/link.c b/usr.sbin/ppp/link.c index 1667e8a..dc5507d 100644 --- a/usr.sbin/ppp/link.c +++ b/usr.sbin/ppp/link.c @@ -118,7 +118,7 @@ link_DeleteQueue(struct link *l) size_t link_QueueLen(struct link *l) { - int i; + unsigned i; size_t len; for (i = 0, len = 0; i < LINK_QUEUES(l); i++) @@ -130,7 +130,7 @@ link_QueueLen(struct link *l) size_t link_QueueBytes(struct link *l) { - int i; + unsigned i; size_t len, bytes; struct mbuf *m; @@ -257,7 +257,7 @@ link_PushPacket(struct link *l, struct mbuf *bp, struct bundle *b, int pri, * packet (as we do with ``pull''s). */ - if(pri < 0 || pri >= LINK_QUEUES(l)) + if(pri < 0 || (unsigned)pri >= LINK_QUEUES(l)) pri = 0; bp->priv = 0; /* Adjusted by the async layer ! */ @@ -372,7 +372,7 @@ static const struct { static void Despatch(struct bundle *bundle, struct link *l, struct mbuf *bp, u_short proto) { - int f; + unsigned f; for (f = 0; f < DSIZE; f++) if (despatcher[f].proto == proto) { diff --git a/usr.sbin/ppp/lqr.c b/usr.sbin/ppp/lqr.c index 073379a..30b0530 100644 --- a/usr.sbin/ppp/lqr.c +++ b/usr.sbin/ppp/lqr.c @@ -127,7 +127,7 @@ void lqr_ChangeOrder(struct lqrdata *src, struct lqrdata *dst) { u_int32_t *sp, *dp; - int n; + unsigned n; sp = (u_int32_t *) src; dp = (u_int32_t *) dst; @@ -198,7 +198,7 @@ SendLqrReport(void *v) } struct mbuf * -lqr_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) +lqr_Input(struct bundle *bundle __unused, struct link *l, struct mbuf *bp) { struct physical *p = link2physical(l); struct lcp *lcp = p->hdlc.lqm.owner; @@ -411,8 +411,8 @@ lqr_Analyse(const struct hdlc *hdlc, const struct lqrdata *oldlqr, } static struct mbuf * -lqr_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, - int pri, u_short *proto) +lqr_LayerPush(struct bundle *b __unused, struct link *l, struct mbuf *bp, + int pri __unused, u_short *proto) { struct physical *p = link2physical(l); int len, layer, extra_async_bytes; @@ -455,7 +455,7 @@ lqr_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, /* Not included - see rfc1989 */ break; case LAYER_HDLC: - p->hdlc.lqm.ifOutOctets += hdlc_WrapperOctets(&l->lcp, *proto); + p->hdlc.lqm.ifOutOctets += hdlc_WrapperOctets(); break; case LAYER_LQR: layer = l->nlayers; @@ -508,7 +508,8 @@ lqr_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, } static struct mbuf * -lqr_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, u_short *proto) +lqr_LayerPull(struct bundle *b __unused, struct link *l __unused, + struct mbuf *bp, u_short *proto) { /* * This is the ``Rx'' process from rfc1989, although a part of it is diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 7517663..6f68b7f 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -109,7 +109,7 @@ static struct bundle *SignalBundle; static struct prompt *SignalPrompt; void -Cleanup(int excode) +Cleanup() { SignalBundle->CleaningUp = 1; bundle_Close(SignalBundle, NULL, CLOSE_STAYDOWN); @@ -143,7 +143,7 @@ static void CloseSession(int signo) { log_Printf(LogPHASE, "Signal %d, terminate.\n", signo); - Cleanup(EX_TERM); + Cleanup(); } static pid_t BGPid = 0; @@ -157,14 +157,14 @@ KillChild(int signo) } static void -TerminalCont(int signo) +TerminalCont(int signo __unused) { signal(SIGCONT, SIG_DFL); prompt_Continue(SignalPrompt); } static void -TerminalStop(int signo) +TerminalStop(int signo __unused) { prompt_Suspend(SignalPrompt); signal(SIGCONT, TerminalCont); @@ -172,7 +172,7 @@ TerminalStop(int signo) } static void -BringDownServer(int signo) +BringDownServer(int signo __unused) { /* Drops all child prompts too ! */ if (server_Close(SignalBundle)) @@ -180,7 +180,7 @@ BringDownServer(int signo) } static void -RestartServer(int signo) +RestartServer(int signo __unused) { /* Drops all child prompts and re-opens the socket */ server_Reopen(SignalBundle); @@ -302,7 +302,8 @@ main(int argc, char **argv) { char *name; const char *lastlabel; - int arg, f, holdfd[3], label; + int arg, holdfd[3], label; + unsigned f; struct bundle *bundle; struct prompt *prompt; struct switches sw; diff --git a/usr.sbin/ppp/main.h b/usr.sbin/ppp/main.h index 46e63b1..0c7399a 100644 --- a/usr.sbin/ppp/main.h +++ b/usr.sbin/ppp/main.h @@ -28,5 +28,5 @@ * $FreeBSD$ */ -extern void Cleanup(int); +extern void Cleanup(void); extern void AbortProgram(int); diff --git a/usr.sbin/ppp/mbuf.c b/usr.sbin/ppp/mbuf.c index 0edf1b9..4773224 100644 --- a/usr.sbin/ppp/mbuf.c +++ b/usr.sbin/ppp/mbuf.c @@ -74,10 +74,10 @@ static struct memmap { static unsigned long long mbuf_Mallocs, mbuf_Frees; -int +size_t m_length(struct mbuf *bp) { - int len; + size_t len; for (len = 0; bp; bp = bp->m_next) len += bp->m_len; @@ -240,7 +240,7 @@ mbuf_View(struct mbuf *bp, void *v, size_t len) } struct mbuf * -m_prepend(struct mbuf *bp, const void *ptr, size_t len, size_t extra) +m_prepend(struct mbuf *bp, const void *ptr, size_t len, u_short extra) { struct mbuf *head; @@ -274,7 +274,7 @@ m_adj(struct mbuf *bp, ssize_t n) { if (n > 0) { while (bp) { - if (n < bp->m_len) { + if ((size_t)n < bp->m_len) { bp->m_len = n; bp->m_offset += n; return bp; @@ -288,7 +288,7 @@ m_adj(struct mbuf *bp, ssize_t n) return NULL; } for (; bp; bp = bp->m_next, n -= bp->m_len) - if (n < bp->m_len) { + if ((size_t)n < bp->m_len) { bp->m_len = n; m_freem(bp->m_next); bp->m_next = NULL; @@ -302,7 +302,7 @@ m_adj(struct mbuf *bp, ssize_t n) void mbuf_Write(struct mbuf *bp, const void *ptr, size_t m_len) { - int plen; + size_t plen; int nb; plen = m_length(bp); diff --git a/usr.sbin/ppp/mbuf.h b/usr.sbin/ppp/mbuf.h index 34fe6c3..980d649 100644 --- a/usr.sbin/ppp/mbuf.h +++ b/usr.sbin/ppp/mbuf.h @@ -30,7 +30,7 @@ struct mbuf { size_t m_size; /* size allocated (excluding header) */ - short m_offset; /* offset from header end to start position */ + u_short m_offset; /* offset from header end to start position */ size_t m_len; /* available byte count in buffer */ short m_type; /* MB_* below */ struct mbuf *m_next; /* link to next mbuf */ @@ -46,10 +46,10 @@ struct mqueue { }; #define MBUF_CTOP(bp) \ - ((bp) ? (u_char *)((bp)+1) + (bp)->m_offset : NULL) + ((bp) ? (u_char *)((bp)+1) + (bp)->m_offset : (u_char *)bp) #define CONST_MBUF_CTOP(bp) \ - ((bp) ? (const u_char *)((bp)+1) + (bp)->m_offset : NULL) + ((bp) ? (const u_char *)((bp)+1) + (bp)->m_offset : (const u_char *)bp) #define MB_IPIN 0 #define MB_IPOUT 1 @@ -100,14 +100,14 @@ struct mqueue { struct cmdargs; -extern int m_length(struct mbuf *); +extern size_t m_length(struct mbuf *); extern struct mbuf *m_get(size_t, int); extern struct mbuf *m_free(struct mbuf *); extern void m_freem(struct mbuf *); extern void mbuf_Write(struct mbuf *, const void *, size_t); extern struct mbuf *mbuf_Read(struct mbuf *, void *, size_t); extern size_t mbuf_View(struct mbuf *, void *, size_t); -extern struct mbuf *m_prepend(struct mbuf *, const void *, size_t, size_t); +extern struct mbuf *m_prepend(struct mbuf *, const void *, size_t, u_short); extern struct mbuf *m_adj(struct mbuf *, ssize_t); extern struct mbuf *m_pullup(struct mbuf *); extern void m_settype(struct mbuf *, int); diff --git a/usr.sbin/ppp/mp.c b/usr.sbin/ppp/mp.c index 3fd9b95..21232b7 100644 --- a/usr.sbin/ppp/mp.c +++ b/usr.sbin/ppp/mp.c @@ -161,13 +161,13 @@ mp_ReadHeader(struct mp *mp, struct mbuf *m, struct mp_header *header) } static void -mp_LayerStart(void *v, struct fsm *fp) +mp_LayerStart(void *v __unused, struct fsm *fp __unused) { /* The given FSM (ccp) is about to start up ! */ } static void -mp_LayerUp(void *v, struct fsm *fp) +mp_LayerUp(void *v __unused, struct fsm *fp) { /* The given fsm (ccp) is now up */ @@ -175,13 +175,13 @@ mp_LayerUp(void *v, struct fsm *fp) } static void -mp_LayerDown(void *v, struct fsm *fp) +mp_LayerDown(void *v __unused, struct fsm *fp __unused) { /* The given FSM (ccp) has been told to come down */ } static void -mp_LayerFinish(void *v, struct fsm *fp) +mp_LayerFinish(void *v __unused, struct fsm *fp) { /* The given fsm (ccp) is now down */ if (fp->state == ST_CLOSED && fp->open_mode == OPEN_PASSIVE) @@ -416,7 +416,7 @@ mp_Assemble(struct mp *mp, struct mbuf *m, struct physical *p) { struct mp_header mh, h; struct mbuf *q, *last; - int32_t seq; + u_int32_t seq; /* * When `m' and `p' are NULL, it means our oldest link has gone down. @@ -445,7 +445,7 @@ mp_Assemble(struct mp *mp, struct mbuf *m, struct physical *p) mp->seq.min_in = (u_int32_t)-1; for (dl = mp->bundle->links; dl; dl = dl->next) if (dl->state == DATALINK_OPEN && - (mp->seq.min_in == -1 || + (mp->seq.min_in == (u_int32_t)-1 || isbefore(mp->local_is12bit, dl->mp.seq, mp->seq.min_in))) mp->seq.min_in = dl->mp.seq; } @@ -535,7 +535,7 @@ mp_Assemble(struct mp *mp, struct mbuf *m, struct physical *p) /* We've got something, reassemble */ struct mbuf **frag = &q; int len; - u_long first = -1; + long long first = -1; do { *frag = mp->inbufs; @@ -574,8 +574,8 @@ mp_Assemble(struct mp *mp, struct mbuf *m, struct physical *p) if (q) { q = m_pullup(q); - log_Printf(LogDEBUG, "MP: Reassembled frags %ld-%lu, length %d\n", - first, (u_long)h.seq, m_length(q)); + log_Printf(LogDEBUG, "MP: Reassembled frags %lu-%lu, length %d\n", + (u_long)first, (u_long)h.seq, m_length(q)); link_PullPacket(&mp->link, MBUF_CTOP(q), q->m_len, mp->bundle); m_freem(q); } @@ -896,10 +896,10 @@ mp_ShowStatus(struct cmdargs const *arg) } const char * -mp_Enddisc(u_char c, const char *address, int len) +mp_Enddisc(u_char c, const char *address, size_t len) { static char result[100]; /* Used immediately after it's returned */ - int f, header; + unsigned f, header; switch (c) { case ENDDISC_NULL: @@ -930,7 +930,7 @@ mp_Enddisc(u_char c, const char *address, int len) case ENDDISC_MAGIC: sprintf(result, "Magic: 0x"); header = strlen(result); - if (len > sizeof result - header - 1) + if (len + header + 1 > sizeof result) len = sizeof result - header - 1; for (f = 0; f < len; f++) sprintf(result + header + 2 * f, "%02x", address[f]); @@ -940,10 +940,10 @@ mp_Enddisc(u_char c, const char *address, int len) snprintf(result, sizeof result, "PSN: %.*s", len, address); break; - default: + default: sprintf(result, "%d: ", (int)c); header = strlen(result); - if (len > sizeof result - header - 1) + if (len + header + 1 > sizeof result) len = sizeof result - header - 1; for (f = 0; f < len; f++) sprintf(result + header + 2 * f, "%02x", address[f]); @@ -993,19 +993,13 @@ mp_SetEnddisc(struct cmdargs const *arg) mp->cfg.enddisc.len = sizeof arg->bundle->ncp.ipcp.my_ip.s_addr; } else if (!strcasecmp(arg->argv[arg->argn], "mac")) { struct sockaddr_dl hwaddr; - int s; if (arg->bundle->ncp.ipcp.my_ip.s_addr == INADDR_ANY) ncprange_getip4addr(&arg->bundle->ncp.ipcp.cfg.my_range, &addr); else addr = arg->bundle->ncp.ipcp.my_ip; - s = ID0socket(PF_INET, SOCK_DGRAM, 0); - if (s < 0) { - log_Printf(LogERROR, "set enddisc: socket(): %s\n", strerror(errno)); - return 2; - } - if (arp_EtherAddr(s, addr, &hwaddr, 1)) { + if (arp_EtherAddr(addr, &hwaddr, 1)) { mp->cfg.enddisc.class = ENDDISC_MAC; memcpy(mp->cfg.enddisc.address, hwaddr.sdl_data + hwaddr.sdl_nlen, hwaddr.sdl_alen); @@ -1013,10 +1007,8 @@ mp_SetEnddisc(struct cmdargs const *arg) } else { log_Printf(LogWARN, "set enddisc: Can't locate MAC address for %s\n", inet_ntoa(addr)); - close(s); return 4; } - close(s); } else if (!strcasecmp(arg->argv[arg->argn], "magic")) { int f; @@ -1082,7 +1074,8 @@ mpserver_IsSet(struct fdescriptor *d, const fd_set *fdset) } static void -mpserver_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +mpserver_Read(struct fdescriptor *d, struct bundle *bundle, + const fd_set *fdset __unused) { struct mpserver *s = descriptor2mpserver(d); @@ -1090,8 +1083,8 @@ mpserver_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) } static int -mpserver_Write(struct fdescriptor *d, struct bundle *bundle, - const fd_set *fdset) +mpserver_Write(struct fdescriptor *d __unused, struct bundle *bundle __unused, + const fd_set *fdset __unused) { /* We never want to write here ! */ log_Printf(LogALERT, "mpserver_Write: Internal error: Bad call !\n"); @@ -1129,7 +1122,9 @@ mpserver_Open(struct mpserver *s, struct peerid *peer) return MPSERVER_FAILED; } - for (f = 0; f < peer->enddisc.len && l < sizeof s->socket.sun_path - 2; f++) { + for (f = 0; + f < peer->enddisc.len && (size_t)l < sizeof s->socket.sun_path - 2; + f++) { snprintf(s->socket.sun_path + l, sizeof s->socket.sun_path - l, "%02x", *(u_char *)(peer->enddisc.address+f)); l += 2; diff --git a/usr.sbin/ppp/mp.h b/usr.sbin/ppp/mp.h index 525ee29..7cf5a8e 100644 --- a/usr.sbin/ppp/mp.h +++ b/usr.sbin/ppp/mp.h @@ -137,7 +137,7 @@ extern struct mbuf *mp_Input(struct bundle *, struct link *, struct mbuf *); extern int mp_FillPhysicalQueues(struct bundle *); extern int mp_SetDatalinkBandwidth(struct cmdargs const *); extern int mp_ShowStatus(struct cmdargs const *); -extern const char *mp_Enddisc(u_char, const char *, int); +extern const char *mp_Enddisc(u_char, const char *, size_t); extern int mp_SetEnddisc(struct cmdargs const *); extern void mp_LinkLost(struct mp *, struct datalink *); extern void mp_RestartAutoloadTimer(struct mp *); diff --git a/usr.sbin/ppp/mppe.c b/usr.sbin/ppp/mppe.c index 606ad0f..ede5bd0 100644 --- a/usr.sbin/ppp/mppe.c +++ b/usr.sbin/ppp/mppe.c @@ -98,7 +98,7 @@ struct mppe_state { unsigned flushnext : 1; unsigned flushrequired : 1; int cohnum; - int keylen; /* 8 or 16 bytes */ + unsigned keylen; /* 8 or 16 bytes */ int keybits; /* 40, 56 or 128 bits */ char sesskey[MPPE_KEY_LEN]; char mastkey[MPPE_KEY_LEN]; @@ -155,8 +155,8 @@ MPPEKeyChange(struct mppe_state *mp) } static struct mbuf * -MPPEOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, - struct mbuf *mp) +MPPEOutput(void *v, struct ccp *ccp, struct link *l __unused, int pri __unused, + u_short *proto, struct mbuf *mp) { struct mppe_state *mop = (struct mppe_state *)v; struct mbuf *mo; @@ -232,7 +232,7 @@ MPPEOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, } static void -MPPEResetInput(void *v) +MPPEResetInput(void *v __unused) { log_Printf(LogCCP, "MPPE: Unexpected input channel ack\n"); } @@ -372,8 +372,10 @@ MPPEInput(void *v, struct ccp *ccp, u_short *proto, struct mbuf *mp) } static void -MPPEDictSetup(void *v, struct ccp *ccp, u_short proto, struct mbuf *mi) +MPPEDictSetup(void *v __unused, struct ccp *ccp __unused, + u_short proto __unused, struct mbuf *mp __unused) { + /* Nothing to see here */ } static const char * diff --git a/usr.sbin/ppp/nat_cmd.c b/usr.sbin/ppp/nat_cmd.c index 8172fd6..0388168 100644 --- a/usr.sbin/ppp/nat_cmd.c +++ b/usr.sbin/ppp/nat_cmd.c @@ -244,7 +244,8 @@ nat_RedirectProto(struct cmdargs const *arg) struct in_addr localIP, publicIP, remoteIP; struct alias_link *link; struct protoent *pe; - int error, len; + int error; + unsigned len; len = strlen(arg->argv[arg->argn]); if (len == 0) { @@ -494,8 +495,8 @@ nat_SkinnyPort(struct cmdargs const *arg) } static struct mbuf * -nat_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, - int pri, u_short *proto) +nat_LayerPush(struct bundle *bundle, struct link *l __unused, struct mbuf *bp, + int pri __unused, u_short *proto) { if (!bundle->NatEnabled || *proto != PROTO_IP) return bp; @@ -511,7 +512,7 @@ nat_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, } static struct mbuf * -nat_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp, +nat_LayerPull(struct bundle *bundle, struct link *l __unused, struct mbuf *bp, u_short *proto) { static int gfrags; diff --git a/usr.sbin/ppp/ncp.c b/usr.sbin/ppp/ncp.c index e1acafb..79a3000 100644 --- a/usr.sbin/ppp/ncp.c +++ b/usr.sbin/ppp/ncp.c @@ -89,12 +89,8 @@ static u_short default_urgent_tcp_ports[] = { 544 /* kshell */ }; -static u_short default_urgent_udp_ports[] = { }; - #define NDEFTCPPORTS \ (sizeof default_urgent_tcp_ports / sizeof default_urgent_tcp_ports[0]) -#define NDEFUDPPORTS \ - (sizeof default_urgent_udp_ports / sizeof default_urgent_udp_ports[0]) void ncp_Init(struct ncp *ncp, struct bundle *bundle) @@ -108,11 +104,8 @@ ncp_Init(struct ncp *ncp, struct bundle *bundle) NDEFTCPPORTS * sizeof(u_short)); ncp->cfg.urgent.tos = 1; - ncp->cfg.urgent.udp.nports = ncp->cfg.urgent.udp.maxports = NDEFUDPPORTS; - ncp->cfg.urgent.udp.port = (u_short *)malloc(NDEFUDPPORTS * sizeof(u_short)); - memcpy(ncp->cfg.urgent.udp.port, default_urgent_udp_ports, - NDEFUDPPORTS * sizeof(u_short)); - + ncp->cfg.urgent.udp.nports = ncp->cfg.urgent.udp.maxports = 0; + ncp->cfg.urgent.udp.port = NULL; mp_Init(&ncp->mp, bundle); @@ -205,7 +198,7 @@ ncp_SetLink(struct ncp *ncp, struct link *l) * down to the physical link level 'till ncp_FillPhysicalQueues() is used. */ void -ncp_Enqueue(struct ncp *ncp, int af, int pri, char *ptr, int count) +ncp_Enqueue(struct ncp *ncp, int af, unsigned pri, char *ptr, int count) { #ifndef NOINET6 struct ipv6cp *ipv6cp = &ncp->ipv6cp; @@ -222,8 +215,8 @@ ncp_Enqueue(struct ncp *ncp, int af, int pri, char *ptr, int count) switch (af) { case AF_INET: - if (pri < 0 || pri >= IPCP_QUEUES(ipcp)) { - log_Printf(LogERROR, "Can't store in ip queue %d\n", pri); + if (pri >= IPCP_QUEUES(ipcp)) { + log_Printf(LogERROR, "Can't store in ip queue %u\n", pri); break; } @@ -236,8 +229,8 @@ ncp_Enqueue(struct ncp *ncp, int af, int pri, char *ptr, int count) #ifndef NOINET6 case AF_INET6: - if (pri < 0 || pri >= IPV6CP_QUEUES(ipcp)) { - log_Printf(LogERROR, "Can't store in ipv6 queue %d\n", pri); + if (pri >= IPV6CP_QUEUES(ipcp)) { + log_Printf(LogERROR, "Can't store in ipv6 queue %u\n", pri); break; } @@ -333,7 +326,7 @@ ncp_FillPhysicalQueues(struct ncp *ncp, struct bundle *bundle) * of what is to be pushed next, coming either from mp->out or ncp->afq. */ int -ncp_PushPacket(struct ncp *ncp, int *af, struct link *l) +ncp_PushPacket(struct ncp *ncp __unused, int *af, struct link *l) { struct bundle *bundle = l->lcp.fsm.bundle; int res; @@ -360,7 +353,7 @@ ncp_PushPacket(struct ncp *ncp, int *af, struct link *l) int ncp_IsUrgentPort(struct port_range *range, u_short src, u_short dst) { - int f; + unsigned f; for (f = 0; f < range->nports; f++) if (range->port[f] == src || range->port[f] == dst) @@ -373,7 +366,7 @@ void ncp_AddUrgentPort(struct port_range *range, u_short port) { u_short *newport; - int p; + unsigned p; if (range->nports == range->maxports) { range->maxports += 10; @@ -407,11 +400,11 @@ ncp_AddUrgentPort(struct port_range *range, u_short port) void ncp_RemoveUrgentPort(struct port_range *range, u_short port) { - int p; + unsigned p; for (p = 0; p < range->nports; p++) if (range->port[p] == port) { - if (p != range->nports - 1) + if (p + 1 != range->nports) memmove(range->port + p, range->port + p + 1, (range->nports - p - 1) * sizeof(u_short)); range->nports--; @@ -432,7 +425,7 @@ int ncp_Show(struct cmdargs const *arg) { struct ncp *ncp = &arg->bundle->ncp; - int p; + unsigned p; #ifndef NOINET6 prompt_Printf(arg->prompt, "Next queued AF: %s\n", diff --git a/usr.sbin/ppp/ncp.h b/usr.sbin/ppp/ncp.h index c9c3be5..99580cf 100644 --- a/usr.sbin/ppp/ncp.h +++ b/usr.sbin/ppp/ncp.h @@ -60,7 +60,7 @@ extern int ncp_fsmStart(struct ncp *, struct bundle *); extern void ncp_IfaceAddrAdded(struct ncp *, const struct iface_addr *); extern void ncp_IfaceAddrDeleted(struct ncp *, const struct iface_addr *); extern void ncp_SetLink(struct ncp *, struct link *); -extern void ncp_Enqueue(struct ncp *, int, int, char *, int); +extern void ncp_Enqueue(struct ncp *, int, unsigned, char *, int); extern void ncp_DeleteQueues(struct ncp *); extern size_t ncp_QueueLen(struct ncp *); extern size_t ncp_FillPhysicalQueues(struct ncp *, struct bundle *); diff --git a/usr.sbin/ppp/ncpaddr.c b/usr.sbin/ppp/ncpaddr.c index 112cfbc..ec20d39 100644 --- a/usr.sbin/ppp/ncpaddr.c +++ b/usr.sbin/ppp/ncpaddr.c @@ -159,11 +159,11 @@ mask62bits(const struct in6_addr *mask) return masklen; } +#if 0 static void adjust_linklocal(struct sockaddr_in6 *sin6) { /* XXX: ?????!?!?!!!!! This is horrible ! */ -#if 0 /* * The kernel does not understand sin6_scope_id for routing at this moment. * We should rather keep the embedded ID. @@ -175,9 +175,9 @@ adjust_linklocal(struct sockaddr_in6 *sin6) ntohs(*(u_short *)&sin6->sin6_addr.s6_addr[2]); *(u_short *)&sin6->sin6_addr.s6_addr[2] = 0; } -#endif } #endif +#endif void ncpaddr_init(struct ncpaddr *addr) @@ -385,7 +385,9 @@ ncpaddr_ntowa(const struct ncpaddr *addr) sin6.sin6_len = sizeof(sin6); sin6.sin6_family = AF_INET6; sin6.sin6_addr = addr->ncpaddr_ip6addr; +#if 0 adjust_linklocal(&sin6); +#endif #ifdef NI_WITHSCOPEID if (getnameinfo((struct sockaddr *)&sin6, sizeof sin6, res, sizeof(res), NULL, 0, NI_WITHSCOPEID | NI_NUMERICHOST) != 0) diff --git a/usr.sbin/ppp/netgraph.c b/usr.sbin/ppp/netgraph.c index 15ace22..471dc0d 100644 --- a/usr.sbin/ppp/netgraph.c +++ b/usr.sbin/ppp/netgraph.c @@ -98,18 +98,19 @@ struct ngdevice { #define NG_MSGBUFSZ 4096 #define NETGRAPH_PREFIX "netgraph:" -int +unsigned ng_DeviceSize(void) { return sizeof(struct ngdevice); } static int -ng_MessageOut(struct ngdevice *dev, struct physical *p, const char *data) +ng_MessageOut(struct ngdevice *dev, const char *data) { char path[NG_PATHSIZ]; - int len, pos, dpos; char *fmt; + size_t len; + int pos, dpos; /* * We expect a node path, one or more spaces, a command, one or more @@ -141,7 +142,7 @@ ng_MessageOut(struct ngdevice *dev, struct physical *p, const char *data) * This is probably a waste of time, but we really don't want to end * up stuffing unexpected % escapes into the kernel.... */ - for (pos = dpos = 0; pos < len;) { + for (pos = dpos = 0; pos < (int)len;) { if (data[dpos] == '%') fmt[pos++] = '%'; fmt[pos++] = data[dpos++]; @@ -169,7 +170,7 @@ ng_MessageIn(struct physical *p, char *buf, size_t sz) struct ngdevice *dev = device2ng(p->handler); struct ng_mesg *rep = (struct ng_mesg *)msgbuf; char path[NG_PATHSIZ]; - int len; + size_t len; #ifdef BROKEN_SELECT struct timeval t; @@ -224,9 +225,9 @@ ng_Write(struct physical *p, const void *v, size_t n) switch (p->dl->state) { case DATALINK_DIAL: case DATALINK_LOGIN: - return ng_MessageOut(dev, p, v) ? n : -1; + return ng_MessageOut(dev, v) ? (ssize_t)n : -1; } - return NgSendData(p->fd, dev->hook, v, n) == -1 ? -1 : n; + return NgSendData(p->fd, dev->hook, v, n) == -1 ? -1 : (ssize_t)n; } static ssize_t @@ -279,7 +280,7 @@ ng_Free(struct physical *p) static void ng_device2iov(struct device *d, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd, int *nauxfd) { struct ngdevice *dev = device2ng(d); int sz = physical_MaxDeviceSize(); @@ -319,7 +320,7 @@ static const struct device basengdevice = { struct device * ng_iov2device(int type, struct physical *p, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd, int *nauxfd) { if (type == NG_DEVICE) { struct ngdevice *dev = (struct ngdevice *)iov[(*niov)++].iov_base; @@ -427,7 +428,7 @@ static int getsegment(const char *what, char *word, size_t sz, const char *from, const char *sep, const char **endp) { - int len; + size_t len; if ((len = strcspn(from, sep)) == 0) { log_Printf(LogWARN, "%s name should not be empty !\n", what); @@ -468,7 +469,8 @@ ng_Create(struct physical *p) char modname[NG_TYPESIZ + 3]; char path[NG_PATHSIZ]; char *nodename; - int len, sz, done, f; + int len, sz, done; + unsigned f; dev = NULL; if (p->fd < 0 && !strncasecmp(p->name.full, NETGRAPH_PREFIX, diff --git a/usr.sbin/ppp/netgraph.h b/usr.sbin/ppp/netgraph.h index ffa012a..a5b4082 100644 --- a/usr.sbin/ppp/netgraph.h +++ b/usr.sbin/ppp/netgraph.h @@ -34,4 +34,4 @@ struct device; extern struct device *ng_Create(struct physical *); extern struct device *ng_iov2device(int, struct physical *, struct iovec *, int *, int, int *, int *); -extern int ng_DeviceSize(void); +extern unsigned ng_DeviceSize(void); diff --git a/usr.sbin/ppp/pap.c b/usr.sbin/ppp/pap.c index 8a1d112..8eda020 100644 --- a/usr.sbin/ppp/pap.c +++ b/usr.sbin/ppp/pap.c @@ -270,7 +270,7 @@ pap_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) pap_Failure(authp); } else #endif - if (auth_Validate(bundle, authp->in.name, key, p)) + if (auth_Validate(bundle, authp->in.name, key)) pap_Success(authp); else pap_Failure(authp); diff --git a/usr.sbin/ppp/physical.c b/usr.sbin/ppp/physical.c index 1483b66..c1f5daa 100644 --- a/usr.sbin/ppp/physical.c +++ b/usr.sbin/ppp/physical.c @@ -30,6 +30,9 @@ #include <errno.h> #include <fcntl.h> #include <paths.h> +#ifdef NOSUID +#include <signal.h> +#endif #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -109,7 +112,7 @@ static int physical_DescriptorWrite(struct fdescriptor *, struct bundle *, const fd_set *); -static int +static unsigned physical_DeviceSize(void) { return sizeof(struct device); @@ -119,7 +122,7 @@ struct { struct device *(*create)(struct physical *); struct device *(*iov2device)(int, struct physical *, struct iovec *, int *, int, int *, int *); - int (*DeviceSize)(void); + unsigned (*DeviceSize)(void); } devices[] = { #ifndef NOI4B /* @@ -231,7 +234,7 @@ static const struct parity { { "even", "P_EVEN", CS7 | PARENB }, { "odd", "P_ODD", CS7 | PARENB | PARODD }, { "none", "P_ZERO", CS8 }, - { NULL, 0 }, + { NULL, NULL, 0 }, }; static int @@ -269,7 +272,7 @@ physical_SetParity(struct physical *p, const char *str) return -1; } -int +unsigned physical_GetSpeed(struct physical *p) { if (p->handler && p->handler->speed) @@ -279,9 +282,9 @@ physical_GetSpeed(struct physical *p) } int -physical_SetSpeed(struct physical *p, int speed) +physical_SetSpeed(struct physical *p, unsigned speed) { - if (IntToSpeed(speed) != B0) { + if (UnsignedToSpeed(speed) != B0) { p->cfg.speed = speed; return 1; } @@ -402,8 +405,8 @@ physical_Destroy(struct physical *p) } static int -physical_DescriptorWrite(struct fdescriptor *d, struct bundle *bundle, - const fd_set *fdset) +physical_DescriptorWrite(struct fdescriptor *d, struct bundle *bundle __unused, + const fd_set *fdset __unused) { struct physical *p = descriptor2physical(d); int nw, result = 0; @@ -535,7 +538,7 @@ physical_ShowStatus(struct cmdargs const *arg) void physical_DescriptorRead(struct fdescriptor *d, struct bundle *bundle, - const fd_set *fdset) + const fd_set *fdset __unused) { struct physical *p = descriptor2physical(d); u_char *rbuff; @@ -591,7 +594,8 @@ iov2physical(struct datalink *dl, struct iovec *iov, int *niov, int maxiov, int fd, int *auxfd, int *nauxfd) { struct physical *p; - int len, h, type; + int len, type; + unsigned h; p = (struct physical *)iov[(*niov)++].iov_base; p->link.name = dl->name; @@ -662,13 +666,13 @@ iov2physical(struct datalink *dl, struct iovec *iov, int *niov, int maxiov, return p; } -int +unsigned physical_MaxDeviceSize() { - int biggest, sz, n; + unsigned biggest, sz, n; biggest = sizeof(struct device); - for (sz = n = 0; n < NDEVICES; n++) + for (n = 0; n < NDEVICES; n++) if (devices[n].DeviceSize) { sz = (*devices[n].DeviceSize)(); if (biggest < sz) @@ -787,7 +791,8 @@ const char *physical_GetDevice(struct physical *p) void physical_SetDeviceList(struct physical *p, int argc, const char *const *argv) { - int f, pos; + unsigned pos; + int f; p->cfg.devlist[sizeof p->cfg.devlist - 1] = '\0'; for (f = 0, pos = 0; f < argc && pos < sizeof p->cfg.devlist - 1; f++) { @@ -1003,10 +1008,11 @@ physical_Found(struct physical *p) } int -physical_Open(struct physical *p, struct bundle *bundle) +physical_Open(struct physical *p) { - int devno, h, wasfd, err; char *dev; + int devno, wasfd, err; + unsigned h; if (p->fd >= 0) log_Printf(LogDEBUG, "%s: Open: Modem is already open!\n", p->link.name); diff --git a/usr.sbin/ppp/physical.h b/usr.sbin/ppp/physical.h index 222c5e6..f16e1a1 100644 --- a/usr.sbin/ppp/physical.h +++ b/usr.sbin/ppp/physical.h @@ -71,7 +71,7 @@ struct device { ssize_t (*read)(struct physical *, void *, size_t); ssize_t (*write)(struct physical *, const void *, size_t); void (*device2iov)(struct device *, struct iovec *, int *, int, int *, int *); - int (*speed)(struct physical *); + unsigned (*speed)(struct physical *); const char *(*openinfo)(struct physical *); int (*slot)(struct physical *); }; @@ -130,10 +130,10 @@ struct physical { #define PHYSICAL_FORCE_SYNCNOACF 4 extern struct physical *physical_Create(struct datalink *, int); -extern int physical_Open(struct physical *, struct bundle *); +extern int physical_Open(struct physical *); extern int physical_Raw(struct physical *); -extern int physical_GetSpeed(struct physical *); -extern int physical_SetSpeed(struct physical *, int); +extern unsigned physical_GetSpeed(struct physical *); +extern int physical_SetSpeed(struct physical *, unsigned); extern int physical_SetParity(struct physical *, const char *); extern int physical_SetRtsCts(struct physical *, int); extern void physical_SetSync(struct physical *); @@ -168,9 +168,9 @@ extern int physical_SetMode(struct physical *, int); extern void physical_DeleteQueue(struct physical *); extern void physical_SetupStack(struct physical *, const char *, int); extern void physical_StopDeviceTimer(struct physical *); -extern int physical_MaxDeviceSize(void); +extern unsigned physical_MaxDeviceSize(void); extern int physical_AwaitCarrier(struct physical *); extern void physical_SetDescriptor(struct physical *); extern void physical_SetAsyncParams(struct physical *, u_int32_t, u_int32_t); extern int physical_Slot(struct physical *); -extern int physical_SetPPPoEnonstandatd(struct physical *, int); +extern int physical_SetPPPoEnonstandard(struct physical *, int); diff --git a/usr.sbin/ppp/pred.c b/usr.sbin/ppp/pred.c index 2a81381..43d5d94 100644 --- a/usr.sbin/ppp/pred.c +++ b/usr.sbin/ppp/pred.c @@ -151,7 +151,7 @@ Pred1ResetOutput(void *v) } static void * -Pred1InitInput(struct bundle *bundle, struct fsm_opt *o) +Pred1InitInput(struct bundle *bundle __unused, struct fsm_opt *o __unused) { struct pred1_state *state; state = (struct pred1_state *)malloc(sizeof(struct pred1_state)); @@ -161,7 +161,7 @@ Pred1InitInput(struct bundle *bundle, struct fsm_opt *o) } static void * -Pred1InitOutput(struct bundle *bundle, struct fsm_opt *o) +Pred1InitOutput(struct bundle *bundle __unused, struct fsm_opt *o __unused) { struct pred1_state *state; state = (struct pred1_state *)malloc(sizeof(struct pred1_state)); @@ -171,8 +171,8 @@ Pred1InitOutput(struct bundle *bundle, struct fsm_opt *o) } static struct mbuf * -Pred1Output(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, - struct mbuf *bp) +Pred1Output(void *v, struct ccp *ccp, struct link *l __unused, + int pri __unused, u_short *proto, struct mbuf *bp) { struct pred1_state *state = (struct pred1_state *)v; struct mbuf *mwp; @@ -289,26 +289,28 @@ Pred1Input(void *v, struct ccp *ccp, u_short *proto, struct mbuf *bp) } static void -Pred1DictSetup(void *v, struct ccp *ccp, u_short proto, struct mbuf *bp) +Pred1DictSetup(void *v __unused, struct ccp *ccp __unused, + u_short proto __unused, struct mbuf *bp __unused) { + /* Nothing to see here */ } static const char * -Pred1DispOpts(struct fsm_opt *o) +Pred1DispOpts(struct fsm_opt *o __unused) { return NULL; } static void -Pred1InitOptsOutput(struct bundle *bundle, struct fsm_opt *o, - const struct ccp_config *cfg) +Pred1InitOptsOutput(struct bundle *bundle __unused, struct fsm_opt *o, + const struct ccp_config *cfg __unused) { o->hdr.len = 2; } static int -Pred1SetOpts(struct bundle *bundle, struct fsm_opt *o, - const struct ccp_config *cfg) +Pred1SetOpts(struct bundle *bundle __unused, struct fsm_opt *o, + const struct ccp_config *cfg __unused) { if (o->hdr.len != 2) { o->hdr.len = 2; diff --git a/usr.sbin/ppp/prompt.c b/usr.sbin/ppp/prompt.c index 839e655..de331ef 100644 --- a/usr.sbin/ppp/prompt.c +++ b/usr.sbin/ppp/prompt.c @@ -129,7 +129,8 @@ prompt_Display(struct prompt *p) } static int -prompt_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) +prompt_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w __unused, + fd_set *e, int *n) { struct prompt *p = descriptor2prompt(d); int sets; @@ -179,7 +180,8 @@ prompt_ShowHelp(struct prompt *p) } static void -prompt_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +prompt_Read(struct fdescriptor *d, struct bundle *bundle, + const fd_set *fdset __unused) { struct prompt *p = descriptor2prompt(d); struct prompt *op; @@ -206,7 +208,7 @@ prompt_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) } else if (n <= 0) { log_Printf(LogPHASE, "%s: Client connection closed.\n", p->src.from); if (!p->owner) - Cleanup(EX_NORMAL); + Cleanup(); prompt_Destroy(p, 0); } return; @@ -300,7 +302,8 @@ prompt_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) } static int -prompt_Write(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +prompt_Write(struct fdescriptor *d __unused, struct bundle *bundle __unused, + const fd_set *fdset __unused) { /* We never want to write here ! */ log_Printf(LogALERT, "prompt_Write: Internal error: Bad call !\n"); @@ -394,7 +397,7 @@ prompt_vPrintf(struct prompt *p, const char *fmt, va_list ap) if (p->TermMode) { /* Stuff '\r' in front of '\n' 'cos we're in raw mode */ - int len = strlen(fmt); + size_t len = strlen(fmt); if (len && len < sizeof nfmt - 1 && fmt[len-1] == '\n' && (len == 1 || fmt[len-2] != '\r')) { diff --git a/usr.sbin/ppp/proto.c b/usr.sbin/ppp/proto.c index e471998..2c2c26d 100644 --- a/usr.sbin/ppp/proto.c +++ b/usr.sbin/ppp/proto.c @@ -69,8 +69,8 @@ proto_Prepend(struct mbuf *bp, u_short proto, unsigned comp, int extra) } static struct mbuf * -proto_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, - int pri, u_short *proto) +proto_LayerPush(struct bundle *b __unused, struct link *l, struct mbuf *bp, + int pri __unused, u_short *proto) { log_Printf(LogDEBUG, "proto_LayerPush: Using 0x%04x\n", *proto); bp = proto_Prepend(bp, *proto, l->lcp.his_protocomp, @@ -82,7 +82,7 @@ proto_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, } static struct mbuf * -proto_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, +proto_LayerPull(struct bundle *b __unused, struct link *l, struct mbuf *bp, u_short *proto) { u_char cp[2]; diff --git a/usr.sbin/ppp/radius.c b/usr.sbin/ppp/radius.c index 1bd92ae..2c7f7fd 100644 --- a/usr.sbin/ppp/radius.c +++ b/usr.sbin/ppp/radius.c @@ -671,7 +671,8 @@ radius_Timeout(void *v) * Time to call rad_continue_send_request() - something to read. */ static void -radius_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +radius_Read(struct fdescriptor *d, struct bundle *bundle __unused, + const fd_set *fdset __unused) { radius_Continue(descriptor2radius(d), 1); } @@ -680,7 +681,8 @@ radius_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) * Behave as a struct fdescriptor (descriptor.h) */ static int -radius_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) +radius_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w __unused, + fd_set *e __unused, int *n) { struct radius *rad = descriptor2radius(d); @@ -710,7 +712,8 @@ radius_IsSet(struct fdescriptor *d, const fd_set *fdset) * Behave as a struct fdescriptor (descriptor.h) */ static int -radius_Write(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +radius_Write(struct fdescriptor *d __unused, struct bundle *bundle __unused, + const fd_set *fdset __unused) { /* We never want to write here ! */ log_Printf(LogALERT, "radius_Write: Internal error: Bad call !\n"); @@ -845,10 +848,11 @@ radius_Authenticate(struct radius *r, struct authinfo *authp, const char *name, const char *key, int klen, const char *nchallenge, int nclen) { + char hostname[MAXHOSTNAMELEN]; struct timeval tv; + const char *what = "questionable"; /* silence warnings! */ + char *mac_addr; int got; - char hostname[MAXHOSTNAMELEN]; - char *mac_addr, *what; #if 0 struct hostent *hp; struct in_addr hostaddr; @@ -997,7 +1001,7 @@ radius_Authenticate(struct radius *r, struct authinfo *authp, const char *name, rad_put_string(r->cx.rad, RAD_CALLING_STATION_ID, mac_addr) != 0) { log_Printf(LogERROR, "rad_put: %s\n", rad_strerror(r->cx.rad)); rad_close(r->cx.rad); - return; + return 0; } radius_put_physical_details(r->cx.rad, authp->physical); @@ -1210,7 +1214,7 @@ radius_Account(struct radius *r, struct radacct *ac, struct datalink *dl, } if (log_IsKept(LogPHASE) || log_IsKept(LogRADIUS)) { - char *what; + const char *what; int level; switch (acct_type) { diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index 168911c..9186b34 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -184,7 +184,7 @@ static struct bits { #endif static void -p_flags(struct prompt *prompt, u_int32_t f, int max) +p_flags(struct prompt *prompt, u_int32_t f, unsigned max) { char name[33], *flags; register struct bits *p = bits; @@ -192,7 +192,7 @@ p_flags(struct prompt *prompt, u_int32_t f, int max) if (max > sizeof name - 1) max = sizeof name - 1; - for (flags = name; p->b_mask && flags - name < max; p++) + for (flags = name; p->b_mask && flags - name < (int)max; p++) if (p->b_mask & f) *flags++ = p->b_val; *flags = '\0'; @@ -516,7 +516,7 @@ route_UpdateMTU(struct bundle *bundle) if (log_IsKept(LogTCPIP)) { ncprange_setsa(&dst, sa[RTAX_DST], sa[RTAX_NETMASK]); log_Printf(LogTCPIP, "route_UpdateMTU: Netif: %d (%s), dst %s," - " mtu %d\n", rtm->rtm_index, Index2Nam(rtm->rtm_index), + " mtu %lu\n", rtm->rtm_index, Index2Nam(rtm->rtm_index), ncprange_ntoa(&dst), bundle->iface->mtu); } rt_Update(bundle, sa[RTAX_DST], sa[RTAX_GATEWAY], sa[RTAX_NETMASK]); diff --git a/usr.sbin/ppp/server.c b/usr.sbin/ppp/server.c index 03f7b86..5be1357 100644 --- a/usr.sbin/ppp/server.c +++ b/usr.sbin/ppp/server.c @@ -192,7 +192,8 @@ server_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) } static int -server_Write(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +server_Write(struct fdescriptor *d __unused, struct bundle *bundle __unused, + const fd_set *fdset __unused) { /* We never want to write here ! */ log_Printf(LogALERT, "server_Write: Internal error: Bad call !\n"); @@ -207,7 +208,8 @@ struct server server = { server_Read, server_Write }, - -1 + -1, + { "", "", 0, 0 } }; enum server_stat @@ -375,7 +377,7 @@ failed: } int -server_Close(struct bundle *bundle) +server_Close(struct bundle *bundle __unused) { if (server.fd >= 0) { if (*server.cfg.sockname != '\0') { diff --git a/usr.sbin/ppp/slcompress.c b/usr.sbin/ppp/slcompress.c index bebd599..ec0523a 100644 --- a/usr.sbin/ppp/slcompress.c +++ b/usr.sbin/ppp/slcompress.c @@ -436,7 +436,7 @@ sl_uncompress_tcp(u_char ** bufp, int len, u_int type, struct slcompress *comp, * overflow the space we have available for it. */ hlen = ip->ip_hl << 2; - if (hlen + sizeof(struct tcphdr) > len) + if ((int)(hlen + sizeof(struct tcphdr)) > len) goto bad; th = (struct tcphdr *) & ((char *) ip)[hlen]; hlen += THOFFSET(th) << 2; diff --git a/usr.sbin/ppp/sync.c b/usr.sbin/ppp/sync.c index ebace8a..712e036 100644 --- a/usr.sbin/ppp/sync.c +++ b/usr.sbin/ppp/sync.c @@ -49,8 +49,8 @@ #include "physical.h" static struct mbuf * -sync_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, - int pri, u_short *proto) +sync_LayerPush(struct bundle *bundle __unused, struct link *l __unused, + struct mbuf *bp, int pri __unused, u_short *proto __unused) { log_DumpBp(LogSYNC, "Write", bp); m_settype(bp, MB_SYNCOUT); @@ -59,8 +59,8 @@ sync_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, } static struct mbuf * -sync_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, - u_short *proto) +sync_LayerPull(struct bundle *b __unused, struct link *l, struct mbuf *bp, + u_short *proto __unused) { struct physical *p = link2physical(l); int len; diff --git a/usr.sbin/ppp/systems.c b/usr.sbin/ppp/systems.c index 24f58a5..36cb4e9 100644 --- a/usr.sbin/ppp/systems.c +++ b/usr.sbin/ppp/systems.c @@ -70,7 +70,8 @@ InterpretArg(const char *from, char *to) { char *ptr, *startto, *endto; struct passwd *pwd; - int len, instring; + int instring; + size_t len; const char *env; instring = 0; @@ -106,7 +107,7 @@ InterpretArg(const char *from, char *to) ptr = strchr(from+2, '}'); if (ptr) { len = ptr - from - 2; - if (endto - to < len ) + if (endto - to < (int)len ) len = endto - to; if (len) { strncpy(to, from+2, len); @@ -137,7 +138,7 @@ InterpretArg(const char *from, char *to) case '~': ptr = strchr(++from, '/'); - len = ptr ? ptr - from : strlen(from); + len = ptr ? (size_t)(ptr - from) : strlen(from); if (len == 0) pwd = getpwuid(ID0realuid()); else { diff --git a/usr.sbin/ppp/tcp.c b/usr.sbin/ppp/tcp.c index 65679f0..4ace882 100644 --- a/usr.sbin/ppp/tcp.c +++ b/usr.sbin/ppp/tcp.c @@ -119,7 +119,8 @@ static struct device tcpdevice = { struct device * tcp_iov2device(int type, struct physical *p, struct iovec *iov, - int *niov, int maxiov, int *auxfd, int *nauxfd) + int *niov, int maxiov __unused, int *auxfd __unused, + int *nauxfd __unused) { if (type == TCP_DEVICE) { free(iov[(*niov)++].iov_base); diff --git a/usr.sbin/ppp/tcpmss.c b/usr.sbin/ppp/tcpmss.c index b4dc64e..38d2920 100644 --- a/usr.sbin/ppp/tcpmss.c +++ b/usr.sbin/ppp/tcpmss.c @@ -96,9 +96,9 @@ } static void -MSSFixup(struct tcphdr *tc, ssize_t pktlen, u_int16_t maxmss) +MSSFixup(struct tcphdr *tc, size_t pktlen, u_int16_t maxmss) { - int hlen, olen, optlen; + size_t hlen, olen, optlen; u_char *opt; u_int16_t *mss; int accumulate; @@ -144,7 +144,7 @@ static struct mbuf * tcpmss_Check(struct bundle *bundle, struct mbuf *bp) { struct ip *pip; - int hlen, plen; + size_t hlen, plen; if (!Enabled(bundle, OPT_TCPMSSFIXUP)) return bp; @@ -160,7 +160,7 @@ tcpmss_Check(struct bundle *bundle, struct mbuf *bp) */ if (pip->ip_p == IPPROTO_TCP && (ntohs(pip->ip_off) & IP_OFFMASK) == 0 && ntohs(pip->ip_len) == plen && hlen <= plen && - plen - hlen >= sizeof(struct tcphdr)) + plen >= sizeof(struct tcphdr) + hlen) MSSFixup((struct tcphdr *)(MBUF_CTOP(bp) + hlen), plen - hlen, MAXMSS(bundle->iface->mtu)); @@ -168,15 +168,15 @@ tcpmss_Check(struct bundle *bundle, struct mbuf *bp) } static struct mbuf * -tcpmss_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, - int pri, u_short *proto) +tcpmss_LayerPush(struct bundle *bundle, struct link *l __unused, + struct mbuf *bp, int pri __unused, u_short *proto __unused) { return tcpmss_Check(bundle, bp); } static struct mbuf * -tcpmss_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp, - u_short *proto) +tcpmss_LayerPull(struct bundle *bundle, struct link *l __unused, + struct mbuf *bp, u_short *proto __unused) { return tcpmss_Check(bundle, bp); } diff --git a/usr.sbin/ppp/tty.c b/usr.sbin/ppp/tty.c index b72ec79..916c20b 100644 --- a/usr.sbin/ppp/tty.c +++ b/usr.sbin/ppp/tty.c @@ -91,7 +91,7 @@ struct ttydevice { int carrier_seconds; /* seconds before CD is *required* */ #ifndef NONETGRAPH struct { - int speed; /* Pre-line-discipline speed */ + unsigned speed; /* Pre-line-discipline speed */ int fd; /* Pre-line-discipline fd */ int disc; /* Old line-discipline */ } real; @@ -103,7 +103,7 @@ struct ttydevice { #define device2tty(d) ((d)->type == TTY_DEVICE ? (struct ttydevice *)d : NULL) -int +unsigned tty_DeviceSize(void) { return sizeof(struct ttydevice); @@ -259,7 +259,8 @@ LoadLineDiscipline(struct physical *p) char ttypath[NG_NODESIZ]; struct ngm_mkpeer ngm; struct ngm_connect ngc; - int ldisc, cs, ds, hot, speed; + int ldisc, cs, ds, hot; + unsigned speed; /* * Don't use the netgraph line discipline for now. Using it works, but @@ -409,7 +410,7 @@ tty_Write(struct physical *p, const void *v, size_t n) struct ttydevice *dev = device2tty(p->handler); if (isngtty(dev)) - return NgSendData(p->fd, dev->hook, v, n) == -1 ? -1 : n; + return NgSendData(p->fd, dev->hook, v, n) == -1 ? -1 : (ssize_t)n; else return write(p->fd, v, n); } @@ -528,7 +529,7 @@ tty_Free(struct physical *p) free(dev); } -static int +static unsigned tty_Speed(struct physical *p) { struct termios ios; @@ -536,7 +537,7 @@ tty_Speed(struct physical *p) if (tcgetattr(p->fd, &ios) == -1) return 0; - return SpeedToInt(cfgetispeed(&ios)); + return SpeedToUnsigned(cfgetispeed(&ios)); } static const char * @@ -573,7 +574,7 @@ tty_Slot(struct physical *p) static void tty_device2iov(struct device *d, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd, int *nauxfd) { struct ttydevice *dev = device2tty(d); int sz = physical_MaxDeviceSize(); @@ -622,7 +623,7 @@ static struct device basettydevice = { struct device * tty_iov2device(int type, struct physical *p, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd, int *nauxfd) { if (type == TTY_DEVICE) { struct ttydevice *dev = (struct ttydevice *)iov[(*niov)++].iov_base; @@ -719,7 +720,7 @@ tty_Create(struct physical *p) /* Change tty speed when we're not in -direct mode */ ios.c_cflag &= ~(CSIZE | PARODD | PARENB); ios.c_cflag |= p->cfg.parity; - if (cfsetspeed(&ios, IntToSpeed(p->cfg.speed)) == -1) + if (cfsetspeed(&ios, UnsignedToSpeed(p->cfg.speed)) == -1) log_Printf(LogWARN, "%s: %s: Unable to set speed to %d\n", p->link.name, p->name.full, p->cfg.speed); } diff --git a/usr.sbin/ppp/tty.h b/usr.sbin/ppp/tty.h index f3f0d53..0991c81 100644 --- a/usr.sbin/ppp/tty.h +++ b/usr.sbin/ppp/tty.h @@ -34,4 +34,4 @@ struct device; extern struct device *tty_Create(struct physical *); extern struct device *tty_iov2device(int, struct physical *, struct iovec *, int *, int, int *, int *); -extern int tty_DeviceSize(void); +extern unsigned tty_DeviceSize(void); diff --git a/usr.sbin/ppp/udp.c b/usr.sbin/ppp/udp.c index 3a5fe06..d9f3252 100644 --- a/usr.sbin/ppp/udp.c +++ b/usr.sbin/ppp/udp.c @@ -73,7 +73,7 @@ struct udpdevice { #define device2udp(d) ((d)->type == UDP_DEVICE ? (struct udpdevice *)d : NULL) -int +unsigned udp_DeviceSize(void) { return sizeof(struct udpdevice); @@ -138,7 +138,7 @@ udp_Free(struct physical *p) static void udp_device2iov(struct device *d, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd __unused, int *nauxfd __unused) { int sz = physical_MaxDeviceSize(); @@ -174,7 +174,7 @@ static const struct device baseudpdevice = { struct device * udp_iov2device(int type, struct physical *p, struct iovec *iov, int *niov, - int maxiov, int *auxfd, int *nauxfd) + int maxiov __unused, int *auxfd __unused, int *nauxfd __unused) { if (type == UDP_DEVICE) { struct udpdevice *dev = (struct udpdevice *)iov[(*niov)++].iov_base; diff --git a/usr.sbin/ppp/udp.h b/usr.sbin/ppp/udp.h index 46b8fe6..c89e276 100644 --- a/usr.sbin/ppp/udp.h +++ b/usr.sbin/ppp/udp.h @@ -32,4 +32,4 @@ struct device; extern struct device *udp_Create(struct physical *); extern struct device *udp_iov2device(int, struct physical *, struct iovec *, int *, int, int *, int *); -extern int udp_DeviceSize(void); +extern unsigned udp_DeviceSize(void); diff --git a/usr.sbin/ppp/vjcomp.c b/usr.sbin/ppp/vjcomp.c index 8bc03db..f3c6b71 100644 --- a/usr.sbin/ppp/vjcomp.c +++ b/usr.sbin/ppp/vjcomp.c @@ -70,8 +70,8 @@ #define MAX_VJHEADER 16 /* Maximum size of compressed header */ static struct mbuf * -vj_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, int pri, - u_short *proto) +vj_LayerPush(struct bundle *bundle, struct link *l __unused, struct mbuf *bp, + int pri __unused, u_short *proto) { int type; struct ip *pip; @@ -162,7 +162,7 @@ VjUncompressTcp(struct ipcp *ipcp, struct mbuf *bp, u_char type) } static struct mbuf * -vj_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp, +vj_LayerPull(struct bundle *bundle, struct link *l __unused, struct mbuf *bp, u_short *proto) { u_char type; |