|
|||||||||||
|
linux-ipsec: 64 bit patches to freeswan/lib
From: Peter Onion <ponion(at)srd.bt.co.uk>
Date: Tue Dec 15 1998 - 12:00:27 EST
# cd /usr/src/freeswan-snap1998Nov30 # export DIFFDIR="lib" #diff -urN $DIFFDIR/dogbert/usr/src/freeswan-snap1998Nov30/$DIFFDIR >/tmp/$DIFFDIR.diffs The version on dogbert is modified set. diff -urN lib/addrtoa.c /dogbert/usr/src/freeswan-snap1998Nov30/lib/addrtoa.c --- lib/addrtoa.c Thu Jul 30 21:07:01 1998 +++ /dogbert/usr/src/freeswan-snap1998Nov30/lib/addrtoa.c Tue Dec 812:14:49 1998 @@ -1,6 +1,15 @@ #include "internal.h" #include "freeswan.h" + +/* Because this code gets used in both kernel & user code it needs to use + both __u32 (kernel) and u_int32_t (user) , so this kludges makes it work + in both. P.J.Onion +*/ +#ifdef __KERNEL__ +#define u_int32_t __u32 +#endif + #define NBYTES 4 /* bytes in an address */ #define PERBYTE 4 /* three digits plus a dot or NUL */ #define BUFLEN (NBYTES*PERBYTE)size_t dstlen; {
- unsigned long a = ntohl(addr.s_addr);
+ u_int32_t a = ntohl(addr.s_addr);
int i;
size_t n;
- unsigned long byte;
+ u_int32_t byte;
char buf[BUFLEN];
char *p;
diff -urN lib/atoaddr.c /dogbert/usr/src/freeswan-snap1998Nov30/lib/atoaddr.c
--- lib/atoaddr.c Tue Oct 13 23:51:40 1998
+++ /dogbert/usr/src/freeswan-snap1998Nov30/lib/atoaddr.c Tue Dec 1
14:48:57 1998
@@ -83,7 +83,7 @@ struct in_addr *addrp; {
const char *oops;
- unsigned long addr;
+ u_int32_t addr;
if (srclen != 8)
return "internal error, try8hex called with bad length";
11:06:05 1998
@@ -15,7 +15,7 @@
const char *stop;
size_t mlen;
const char *oops;
- unsigned long bc;
+ //__u32 bc;
if (srclen == 0)
srclen = strlen(src);
diff -urN lib/atosa.c /dogbert/usr/src/freeswan-snap1998Nov30/lib/atosa.c --- lib/atosa.c Sun Oct 25 03:34:43 1998 +++ /dogbert/usr/src/freeswan-snap1998Nov30/lib/atosa.c Tue Dec 8 12:15:26 1998 @@ -29,9 +29,9 @@
const char *addr;
const char *spi;
struct satype *sat;
- unsigned long ul;
+ u_int32_t ul;
const char *oops;
-# define MINLEN 5 /* ah0@0 is as short as it can get */
+# define MINLEN 5 /* ah0@0 is as short as it can get */
if (srclen == 0)
srclen = strlen(src);
diff -urN lib/atosubnet.c /dogbert/usr/src/freeswan-snap1998Nov30/lib/atosubnet.c --- lib/atosubnet.c Thu Aug 20 14:14:41 1998 +++ /dogbert/usr/src/freeswan-snap1998Nov30/lib/atosubnet.c Tue Dec 114:49:48 1998 @@ -20,7 +20,7 @@
const char *mask;
size_t mlen;
const char *oops;
- unsigned long bc;
+ u_int32_t bc;
static char def[] = DEFAULTSUBNET;
# define DEFLEN (sizeof(def) - 1) /* -1 for NUL */
static char defis[] = "0/0";
diff -urN lib/atoul.c /dogbert/usr/src/freeswan-snap1998Nov30/lib/atoul.c --- lib/atoul.c Tue Sep 29 19:43:02 1998 +++ /dogbert/usr/src/freeswan-snap1998Nov30/lib/atoul.c Tue Dec 8 14:15:09 1998 @@ -9,7 +9,7 @@ const char *src; size_t srclen; /* 0 means strlen(src) */ int base; /* 0 means figure it out */-unsigned long *resultp; +u_int32_t *resultp; {
const char *stop;
static char hex[] = "0123456789abcdef";
16:33:00 1998
@@ -32,17 +32,18 @@
const char *src,
size_t srclen, /* 0 means strlen(src) */
int base, /* 0 means figure it out */
- unsigned long *resultp
+ unsigned int *resultp
);
size_t /* space needed for full conversion */
ultoa(
- unsigned long n,
+ unsigned int n,
int base,
char *dst,
size_t dstlen
);
#define ULTOA_BUF 21 /* just large enough for largest
result, */
/* assuming 64-bit unsigned long! */
+ /* Pity this wasn't assumed elsewhere ! PJO */
/* Internet addresses */
const char * /* NULL for success, else string literal */
diff -urN lib/goodmask.c /dogbert/usr/src/freeswan-snap1998Nov30/lib/goodmask.c
--- lib/goodmask.c Thu Jul 30 21:07:03 1998
+++ /dogbert/usr/src/freeswan-snap1998Nov30/lib/goodmask.c Tue Dec 1
16:40:15 1998
@@ -1,6 +1,12 @@ #include "internal.h" #include "freeswan.h" + +#ifdef __KERNEL__ +#define u_int32_t __u32 +#endif + + /*
if ((((x|(x-1))+1)&x) == 0)
return 1;
@@ -27,7 +33,7 @@ masktobits(mask) struct in_addr mask; {
- unsigned long m = ntohl(mask.s_addr);
+ u_int32_t m = ntohl(mask.s_addr);
int masklen;
if (!goodmask(mask))
diff -urN lib/satoa.c /dogbert/usr/src/freeswan-snap1998Nov30/lib/satoa.c --- lib/satoa.c Sun Oct 25 03:34:43 1998 +++ /dogbert/usr/src/freeswan-snap1998Nov30/lib/satoa.c Tue Dec 1 11:09:11 1998 @@ -24,7 +24,7 @@
size_t len;
int base;
struct typename *tn;
- unsigned long ul;
+ //__u32 ul;
char buf[30+ADDRTOA_BUF];
switch (format) {
diff -urN lib/subnettoa.c /dogbert/usr/src/freeswan-snap1998Nov30/lib/subnettoa.c --- lib/subnettoa.c Thu Jul 30 21:07:04 1998 +++ /dogbert/usr/src/freeswan-snap1998Nov30/lib/subnettoa.c Tue Dec 116:39:58 1998 @@ -1,6 +1,12 @@ #include "internal.h" #include "freeswan.h" + +#ifdef __KERNEL__ +#define u_int32_t __u32 +#endif + + /*
n = masktobits(mask);
if (n >= 0)
- len += ultoa((unsigned long)n, 10, p, rest);
+ len += ultoa((u_int32_t)n, 10, p, rest);
else
len += addrtoa(mask, 0, p, rest);
diff -urN lib/ultoa.c /dogbert/usr/src/freeswan-snap1998Nov30/lib/ultoa.c
--- lib/ultoa.c Thu Jul 30 21:07:04 1998
+++ /dogbert/usr/src/freeswan-snap1998Nov30/lib/ultoa.c Tue Dec 1 16:38:21 1998
+#ifdef __KERNEL__ +#define u_int32_t __u32 +#endif + + /* - - ultoa - convert unsigned long to decimal ASCII + - ultoa - convert u_int32_t to decimal ASCII */ size_t /* length required for full conversion */ultoa(n, base, dst, dstlen) -unsigned long n; +u_int32_t n; int base; char *dst; /* need not be valid if dstlen is 0 */size_t dstlen; {
- char buf[3*sizeof(unsigned long) + 1];
+ char buf[3*sizeof(u_int32_t) + 1];
char *bufend = buf + sizeof(buf);
size_t len;
char *p;
----------------------------------
E-Mail: Peter Onion <ponion@srd.bt.co.uk> Date: 15-Dec-98 Time: 16:53:20 This message was sent by XFMail Received on Tue Dec 15 13:11:25 1998 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 12:59:29 EDT |
||||||||||
|
|||||||||||