diff options
author | brian <brian@cvs.openbsd.org> | 1998-01-11 17:54:50 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 1998-01-11 17:54:50 +0000 |
commit | 53969a981c9f4a37e745d6c67b631332ca86ba42 (patch) | |
tree | 786ec3c79ac30dc13c4771327551dc3aca2cad3b /usr.sbin | |
parent | d040fadb877d73edda627576dfee73de0ed333a0 (diff) |
Make things work when sizeof(long) != 32 (hopefully)
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/ccp.h | 10 | ||||
-rw-r--r-- | usr.sbin/ppp/command.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/ipcp.h | 10 | ||||
-rw-r--r-- | usr.sbin/ppp/lcp.c | 59 | ||||
-rw-r--r-- | usr.sbin/ppp/lcp.h | 22 | ||||
-rw-r--r-- | usr.sbin/ppp/lqr.c | 14 | ||||
-rw-r--r-- | usr.sbin/ppp/lqr.h | 36 | ||||
-rw-r--r-- | usr.sbin/ppp/vars.h | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/vjcomp.c | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/vjcomp.h | 4 |
10 files changed, 89 insertions, 86 deletions
diff --git a/usr.sbin/ppp/ccp.h b/usr.sbin/ppp/ccp.h index b10ad9e8280..a7bce9fa5f4 100644 --- a/usr.sbin/ppp/ccp.h +++ b/usr.sbin/ppp/ccp.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ccp.h,v 1.4 1998/01/10 01:55:14 brian Exp $ + * $Id: ccp.h,v 1.5 1998/01/11 17:54:45 brian Exp $ * * TODO: */ @@ -36,14 +36,14 @@ #define TY_DEFLATE 26 /* Deflate (gzip) - rfc 1979 */ struct ccpstate { - u_long his_proto; /* peer's compression protocol */ - u_long my_proto; /* our compression protocol */ + int his_proto; /* peer's compression protocol */ + int my_proto; /* our compression protocol */ int reset_sent; /* If != -1, ignore compressed 'till ack */ int last_reset; /* We can receive more (dups) w/ this id */ - u_long his_reject; /* Request codes rejected by peer */ - u_long my_reject; /* Request codes I have rejected */ + u_int32_t his_reject; /* Request codes rejected by peer */ + u_int32_t my_reject; /* Request codes I have rejected */ int out_init; /* Init called for out algorithm */ int in_init; /* Init called for in algorithm */ diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 9c9852f0f46..f91d4f468d6 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.21 1998/01/10 21:50:56 brian Exp $ + * $Id: command.c,v 1.22 1998/01/11 17:54:46 brian Exp $ * */ #include <sys/param.h> @@ -520,7 +520,7 @@ static int ShowInitialMRU(struct cmdargs const *arg) { if (VarTerm) - fprintf(VarTerm, " Initial MRU: %ld\n", VarMRU); + fprintf(VarTerm, " Initial MRU: %d\n", VarMRU); return 0; } @@ -529,7 +529,7 @@ ShowPreferredMTU(struct cmdargs const *arg) { if (VarTerm) if (VarPrefMTU) - fprintf(VarTerm, " Preferred MTU: %ld\n", VarPrefMTU); + fprintf(VarTerm, " Preferred MTU: %d\n", VarPrefMTU); else fprintf(VarTerm, " Preferred MTU: unspecified\n"); return 0; diff --git a/usr.sbin/ppp/ipcp.h b/usr.sbin/ppp/ipcp.h index d9d48147cf6..142905efeb9 100644 --- a/usr.sbin/ppp/ipcp.h +++ b/usr.sbin/ppp/ipcp.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.h,v 1.3 1998/01/05 01:39:05 brian Exp $ + * $Id: ipcp.h,v 1.4 1998/01/11 17:54:46 brian Exp $ * * TODO: */ @@ -40,13 +40,13 @@ extern struct in_addr nbns_entries[2]; struct ipcpstate { struct in_addr his_ipaddr; /* IP address he is willing to use */ - u_long his_compproto; + u_int32_t his_compproto; struct in_addr want_ipaddr; /* IP address I'm willing to use */ - u_long want_compproto; + u_int32_t want_compproto; - u_long his_reject; /* Request codes rejected by peer */ - u_long my_reject; /* Request codes I have rejected */ + u_int32_t his_reject; /* Request codes rejected by peer */ + u_int32_t my_reject; /* Request codes I have rejected */ int heis1172; /* True if he is speaking rfc1172 */ }; diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c index f51187e3a7e..86e72a2007f 100644 --- a/usr.sbin/ppp/lcp.c +++ b/usr.sbin/ppp/lcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lcp.c,v 1.4 1997/12/24 09:30:38 brian Exp $ + * $Id: lcp.c,v 1.5 1998/01/11 17:54:46 brian Exp $ * * TODO: * o Validate magic number received from peer. @@ -171,24 +171,26 @@ ReportLcpStatus(struct cmdargs const *arg) fprintf(VarTerm, "%s [%s]\n", fp->name, StateNames[fp->state]); fprintf(VarTerm, - " his side: MRU %ld, ACCMAP %08lx, PROTOCOMP %d, ACFCOMP %d, MAGIC %08lx,\n" - " REJECT %04lx\n", - lcp->his_mru, lcp->his_accmap, lcp->his_protocomp, lcp->his_acfcomp, - lcp->his_magic, lcp->his_reject); + " his side: MRU %d, ACCMAP %08lx, PROTOCOMP %d, ACFCOMP %d,\n" + " MAGIC %08lx, REJECT %04x\n", + lcp->his_mru, (u_long)lcp->his_accmap, lcp->his_protocomp, + lcp->his_acfcomp, (u_long)lcp->his_magic, lcp->his_reject); fprintf(VarTerm, - " my side: MRU %ld, ACCMAP %08lx, PROTOCOMP %d, ACFCOMP %d, MAGIC %08lx,\n" - " REJECT %04lx\n", - lcp->want_mru, lcp->want_accmap, lcp->want_protocomp, lcp->want_acfcomp, - lcp->want_magic, lcp->my_reject); - fprintf(VarTerm, "\nDefaults: MRU = %ld, ACCMAP = %08x\t", VarMRU, VarAccmap); - fprintf(VarTerm, "Open Mode: %s\n", (VarOpenMode == OPEN_ACTIVE) ? "active" : "passive"); + " my side: MRU %d, ACCMAP %08lx, PROTOCOMP %d, ACFCOMP %d,\n" + " MAGIC %08lx, REJECT %04x\n", + lcp->want_mru, (u_long)lcp->want_accmap, lcp->want_protocomp, + lcp->want_acfcomp, (u_long)lcp->want_magic, lcp->my_reject); + fprintf(VarTerm, "\nDefaults: MRU = %d, ACCMAP = %08lx\t", + VarMRU, (u_long)VarAccmap); + fprintf(VarTerm, "Open Mode: %s\n", + (VarOpenMode == OPEN_ACTIVE) ? "active" : "passive"); return 0; } /* * Generate random number which will be used as magic number. */ -static u_long +static u_int32_t GenerateMagic(void) { randinit(); @@ -257,23 +259,23 @@ do { \ cp += LcpPutConf(LogLCP, cp, &o, cftypes[o.id], NULL); \ } while (0) -#define PUTHEXL(ty, arg) \ +#define PUTHEX32(ty, arg) \ do { \ o.id = ty; \ o.len = 6; \ *(u_long *)o.data = htonl(arg); \ - cp += LcpPutConf(LogLCP, cp, &o, cftypes[o.id], "0x%08x", (u_int)arg);\ + cp += LcpPutConf(LogLCP, cp, &o, cftypes[o.id], "0x%08lx", (u_long)arg);\ } while (0) -#define PUTACCMAP(arg) PUTHEXL(TY_ACCMAP, arg) -#define PUTMAGIC(arg) PUTHEXL(TY_MAGICNUM, arg) +#define PUTACCMAP(arg) PUTHEX32(TY_ACCMAP, arg) +#define PUTMAGIC(arg) PUTHEX32(TY_MAGICNUM, arg) #define PUTMRU(arg) \ do { \ o.id = TY_MRU; \ o.len = 4; \ *(u_short *)o.data = htons(arg); \ - cp += LcpPutConf(LogLCP, cp, &o, cftypes[o.id], "%lu", arg); \ + cp += LcpPutConf(LogLCP, cp, &o, cftypes[o.id], "%u", arg); \ } while (0) #define PUTLQR(period) \ @@ -282,7 +284,8 @@ do { \ o.len = 8; \ *(u_short *)o.data = htons(PROTO_LQR); \ *(u_long *)(o.data+2) = htonl(period); \ - cp += LcpPutConf(LogLCP, cp, &o, cftypes[o.id], "period %ld", period);\ + cp += LcpPutConf(LogLCP, cp, &o, cftypes[o.id], \ + "period %ld", (u_long)period); \ } while (0) #define PUTPAP() \ @@ -474,9 +477,9 @@ LcpClose() static void LcpDecodeConfig(u_char *cp, int plen, int mode_type) { - int type, length, mru, mtu, sz, pos; - u_long *lp, magic, accmap; - u_short *sp, proto; + int type, length, sz, pos; + u_int32_t *lp, magic, accmap; + u_short mtu, mru, *sp, proto; struct lqrreq *req; char request[20], desc[22]; @@ -529,9 +532,9 @@ LcpDecodeConfig(u_char *cp, int plen, int mode_type) break; case TY_ACCMAP: - lp = (u_long *) (cp + 2); + lp = (u_int32_t *) (cp + 2); accmap = htonl(*lp); - LogPrintf(LogLCP, "%s 0x%08x\n", request, accmap); + LogPrintf(LogLCP, "%s 0x%08lx\n", request, (u_long)accmap); switch (mode_type) { case MODE_REQ: @@ -680,17 +683,17 @@ LcpDecodeConfig(u_char *cp, int plen, int mode_type) break; case TY_MAGICNUM: - lp = (u_long *) (cp + 2); + lp = (u_int32_t *) (cp + 2); magic = ntohl(*lp); - LogPrintf(LogLCP, "%s 0x%08x\n", request, magic); + LogPrintf(LogLCP, "%s 0x%08lx\n", request, (u_long)magic); switch (mode_type) { case MODE_REQ: if (LcpInfo.want_magic) { /* Validate magic number */ if (magic == LcpInfo.want_magic) { - LogPrintf(LogLCP, "Magic is same (%08x) - %d times\n", - magic, ++LcpFailedMagic); + LogPrintf(LogLCP, "Magic is same (%08lx) - %d times\n", + (u_long)magic, ++LcpFailedMagic); LcpInfo.want_magic = GenerateMagic(); memcpy(nakp, cp, 6); nakp += 6; @@ -708,7 +711,7 @@ LcpDecodeConfig(u_char *cp, int plen, int mode_type) } break; case MODE_NAK: - LogPrintf(LogLCP, " Magic 0x%08x is NAKed!\n", magic); + LogPrintf(LogLCP, " Magic 0x%08lx is NAKed!\n", (u_long)magic); LcpInfo.want_magic = GenerateMagic(); break; case MODE_REJ: diff --git a/usr.sbin/ppp/lcp.h b/usr.sbin/ppp/lcp.h index 21bacdc6ac8..ca2d6edbc77 100644 --- a/usr.sbin/ppp/lcp.h +++ b/usr.sbin/ppp/lcp.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lcp.h,v 1.3 1997/12/06 12:09:10 brian Exp $ + * $Id: lcp.h,v 1.4 1998/01/11 17:54:47 brian Exp $ * * TODO: */ @@ -23,24 +23,24 @@ #define REJECTED(p, x) ((p)->his_reject & (1<<(x))) struct lcpstate { - u_long his_mru; - u_long his_accmap; - u_long his_magic; - u_long his_lqrperiod; + u_int16_t his_mru; + u_int32_t his_accmap; + u_int32_t his_magic; + u_int32_t his_lqrperiod; u_char his_protocomp; u_char his_acfcomp; u_short his_auth; - u_long want_mru; - u_long want_accmap; - u_long want_magic; - u_long want_lqrperiod; + u_short want_mru; + u_int32_t want_accmap; + u_int32_t want_magic; + u_int32_t want_lqrperiod; u_char want_protocomp; u_char want_acfcomp; u_short want_auth; - u_long his_reject; /* Request codes rejected by peer */ - u_long my_reject; /* Request codes I have rejected */ + u_int32_t his_reject; /* Request codes rejected by peer */ + u_int32_t my_reject; /* Request codes I have rejected */ u_short auth_iwait; u_short auth_ineed; diff --git a/usr.sbin/ppp/lqr.c b/usr.sbin/ppp/lqr.c index df3bea3d898..da8343fe944 100644 --- a/usr.sbin/ppp/lqr.c +++ b/usr.sbin/ppp/lqr.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lqr.c,v 1.1 1997/11/23 20:27:34 brian Exp $ + * $Id: lqr.c,v 1.2 1998/01/11 17:54:47 brian Exp $ * * o LQR based on RFC1333 * @@ -49,14 +49,14 @@ struct pppTimer LqrTimer; static u_long lastpeerin = (u_long) - 1; static int lqmmethod; -static int echoseq; -static int gotseq; +static u_int32_t echoseq; +static u_int32_t gotseq; static int lqrsendcnt; struct echolqr { - u_long magic; - u_long signature; - u_long sequence; + u_int32_t magic; + u_int32_t signature; + u_int32_t sequence; }; #define SIGNATURE 0x594e4f54 @@ -82,7 +82,7 @@ void RecvEchoLqr(struct mbuf * bp) { struct echolqr *lqr; - u_long seq; + u_int32_t seq; if (plength(bp) == sizeof(struct echolqr)) { lqr = (struct echolqr *) MBUF_CTOP(bp); diff --git a/usr.sbin/ppp/lqr.h b/usr.sbin/ppp/lqr.h index ee378abc154..c001d2f3135 100644 --- a/usr.sbin/ppp/lqr.h +++ b/usr.sbin/ppp/lqr.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lqr.h,v 1.1 1997/11/23 20:27:34 brian Exp $ + * $Id: lqr.h,v 1.2 1998/01/11 17:54:48 brian Exp $ * * TODO: */ @@ -24,26 +24,26 @@ * Structure of LQR packet defined in RFC1333 */ struct lqrdata { - u_long MagicNumber; - u_long LastOutLQRs; - u_long LastOutPackets; - u_long LastOutOctets; - u_long PeerInLQRs; - u_long PeerInPackets; - u_long PeerInDiscards; - u_long PeerInErrors; - u_long PeerInOctets; - u_long PeerOutLQRs; - u_long PeerOutPackets; - u_long PeerOutOctets; + u_int32_t MagicNumber; + u_int32_t LastOutLQRs; + u_int32_t LastOutPackets; + u_int32_t LastOutOctets; + u_int32_t PeerInLQRs; + u_int32_t PeerInPackets; + u_int32_t PeerInDiscards; + u_int32_t PeerInErrors; + u_int32_t PeerInOctets; + u_int32_t PeerOutLQRs; + u_int32_t PeerOutPackets; + u_int32_t PeerOutOctets; }; struct lqrsave { - u_long SaveInLQRs; - u_long SaveInPackets; - u_long SaveInDiscards; - u_long SaveInErrors; - u_long SaveInOctets; + u_int32_t SaveInLQRs; + u_int32_t SaveInPackets; + u_int32_t SaveInDiscards; + u_int32_t SaveInErrors; + u_int32_t SaveInOctets; }; struct lqrdata MyLqrData, HisLqrData; diff --git a/usr.sbin/ppp/vars.h b/usr.sbin/ppp/vars.h index 03bdd167925..49c3d038e9f 100644 --- a/usr.sbin/ppp/vars.h +++ b/usr.sbin/ppp/vars.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: vars.h,v 1.4 1997/12/29 22:23:09 brian Exp $ + * $Id: vars.h,v 1.5 1998/01/11 17:54:48 brian Exp $ * * TODO: */ @@ -55,8 +55,8 @@ struct confdesc { extern struct confdesc pppConfs[MAXCONFS + 1]; struct pppvars { - u_long var_mru; /* Initial MRU value */ - u_long pref_mtu; /* Preferred MTU value */ + u_short var_mru; /* Initial MRU value */ + u_short pref_mtu; /* Preferred MTU value */ int var_accmap; /* Initial ACCMAP value */ int modem_speed; /* Current modem speed */ int modem_parity; /* Parity setting */ diff --git a/usr.sbin/ppp/vjcomp.c b/usr.sbin/ppp/vjcomp.c index 872ba7a69bb..8e3c4830cd7 100644 --- a/usr.sbin/ppp/vjcomp.c +++ b/usr.sbin/ppp/vjcomp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: vjcomp.c,v 1.2 1997/12/06 12:09:06 brian Exp $ + * $Id: vjcomp.c,v 1.3 1998/01/11 17:54:49 brian Exp $ * * TODO: */ @@ -155,11 +155,11 @@ VjCompInput(struct mbuf * bp, int proto) } const char * -vj2asc(u_long val) +vj2asc(u_int32_t val) { static char asc[50]; - sprintf(asc, "%ld VJ slots %s slot compression", - ((val>>8)&15)+1, val & 1 ? "with" : "without"); + sprintf(asc, "%d VJ slots %s slot compression", + (int)((val>>8)&15)+1, val & 1 ? "with" : "without"); return asc; } diff --git a/usr.sbin/ppp/vjcomp.h b/usr.sbin/ppp/vjcomp.h index b971bf76f3f..7400739b9b4 100644 --- a/usr.sbin/ppp/vjcomp.h +++ b/usr.sbin/ppp/vjcomp.h @@ -23,10 +23,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: vjcomp.h,v 1.3 1997/12/21 14:27:21 brian Exp $ + * $Id: vjcomp.h,v 1.4 1998/01/11 17:54:49 brian Exp $ */ extern void VjInit(int); extern void SendPppFrame(struct mbuf *); extern struct mbuf *VjCompInput(struct mbuf *, int); -extern const char *vj2asc(u_long); +extern const char *vj2asc(u_int32_t); |