pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/net/xl2tpd/patches more portability fixes, described i...
details: https://anonhg.NetBSD.org/pkgsrc/rev/4de5b7d6c13c
branches: trunk
changeset: 621573:4de5b7d6c13c
user: christos <christos%pkgsrc.org@localhost>
date: Fri Jul 12 19:06:31 2013 +0000
description:
more portability fixes, described in the patch files.
diffstat:
net/xl2tpd/patches/patch-control.c | 18 +++++++++++++++
net/xl2tpd/patches/patch-l2tp.h | 26 +++++++++++++++++----
net/xl2tpd/patches/patch-md5.c | 18 +++++++++++---
net/xl2tpd/patches/patch-misc.c | 40 +++++++++++++++++++++++++++++++++
net/xl2tpd/patches/patch-misc.h | 45 ++++++++++++++++++++++++++++++++++++++
5 files changed, 138 insertions(+), 9 deletions(-)
diffs (180 lines):
diff -r 51c90f01f8c6 -r 4de5b7d6c13c net/xl2tpd/patches/patch-control.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/xl2tpd/patches/patch-control.c Fri Jul 12 19:06:31 2013 +0000
@@ -0,0 +1,18 @@
+$NetBSD: patch-control.c,v 1.1 2013/07/12 19:06:31 christos Exp $
+
+Remove static from inline; each inlined copy might have its own buffer and
+this is not want you want if you define it static. In this case it does not
+matter, since it is only 4K and we don't return it, so don't try to play
+around with saving stack space for no good reason.
+
+--- control.c.orig 2013-06-17 06:17:24.000000000 -0400
++++ control.c 2013-07-12 14:54:44.000000000 -0400
+@@ -1571,7 +1571,7 @@
+ int x;
+ unsigned char e;
+ int err;
+- static unsigned char wbuf[MAX_RECV_SIZE];
++ unsigned char wbuf[MAX_RECV_SIZE];
+ int pos = 0;
+
+ if (c->fd < 0)
diff -r 51c90f01f8c6 -r 4de5b7d6c13c net/xl2tpd/patches/patch-l2tp.h
--- a/net/xl2tpd/patches/patch-l2tp.h Fri Jul 12 17:25:18 2013 +0000
+++ b/net/xl2tpd/patches/patch-l2tp.h Fri Jul 12 19:06:31 2013 +0000
@@ -1,9 +1,25 @@
-$NetBSD: patch-l2tp.h,v 1.1 2013/07/02 00:22:17 christos Exp $
+$NetBSD: patch-l2tp.h,v 1.2 2013/07/12 19:06:31 christos Exp $
+
+Include common.h first since it typedefs things other headers need
+Conditionalize in_pktinfo
-Detect if we have IP_PKTINFO
-
---- l2tp.h.orig 2013-06-26 13:42:03.000000000 -0400
-+++ l2tp.h 2013-06-26 13:41:15.000000000 -0400
+--- l2tp.h.orig 2013-06-17 06:17:24.000000000 -0400
++++ l2tp.h 2013-07-12 15:00:53.000000000 -0400
+@@ -28,13 +28,13 @@
+ #endif
+ #include "osport.h"
+ #include "scheduler.h"
++#include "common.h"
+ #include "misc.h"
+ #include "file.h"
+ #include "call.h"
+ #include "avp.h"
+ #include "control.h"
+ #include "aaa.h"
+-#include "common.h"
+ #include "ipsecmast.h"
+
+ #define CONTROL_PIPE "/var/run/xl2tpd/l2tp-control"
@@ -172,7 +172,9 @@
struct call *self;
struct lns *lns; /* LNS that owns us */
diff -r 51c90f01f8c6 -r 4de5b7d6c13c net/xl2tpd/patches/patch-md5.c
--- a/net/xl2tpd/patches/patch-md5.c Fri Jul 12 17:25:18 2013 +0000
+++ b/net/xl2tpd/patches/patch-md5.c Fri Jul 12 19:06:31 2013 +0000
@@ -1,9 +1,10 @@
-$NetBSD: patch-md5.c,v 1.1 2013/07/02 00:22:17 christos Exp $
+$NetBSD: patch-md5.c,v 1.2 2013/07/12 19:06:31 christos Exp $
-We need endian.h
+Include endian.h for NetBSD
+memset the right size, not just the first sizeof(ptr) bits.
---- md5.c 2013-06-17 06:17:24.000000000 -0400
-+++ md5.c 2013-06-11 19:49:29.000000000 -0400
+--- md5.c.orig 2013-06-17 06:17:24.000000000 -0400
++++ md5.c 2013-07-12 14:52:02.000000000 -0400
@@ -7,6 +7,8 @@
# include <endian.h>
#elif defined(SOLARIS)
@@ -13,3 +14,12 @@
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
#define HIGHFIRST 1
+@@ -166,7 +168,7 @@
+ MD5Transform (ctx->buf, (uint32 *) ctx->in);
+ byteReverse ((unsigned char *) ctx->buf, 4);
+ memcpy (digest, ctx->buf, 16);
+- memset (ctx, 0, sizeof (ctx)); /* In case it's sensitive */
++ memset (ctx, 0, sizeof (*ctx)); /* In case it's sensitive */
+ }
+
+ #ifndef ASM_MD5
diff -r 51c90f01f8c6 -r 4de5b7d6c13c net/xl2tpd/patches/patch-misc.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/xl2tpd/patches/patch-misc.c Fri Jul 12 19:06:31 2013 +0000
@@ -0,0 +1,40 @@
+$NetBSD: patch-misc.c,v 1.1 2013/07/12 19:06:31 christos Exp $
+
+Declare inline in a separate file.
+
+--- misc.c.orig 2013-06-17 06:17:24.000000000 -0400
++++ misc.c 2013-07-12 14:58:32.000000000 -0400
+@@ -170,33 +170,6 @@
+ printf ("}\n");
+ }
+
+-inline void swaps (void *buf_v, int len)
+-{
+-#ifdef __alpha
+- /* Reverse byte order alpha is little endian so lest save a step.
+- to make things work out easier */
+- int x;
+- unsigned char t1;
+- unsigned char *tmp = (_u16 *) buf_v;
+- for (x = 0; x < len; x += 2)
+- {
+- t1 = tmp[x];
+- tmp[x] = tmp[x + 1];
+- tmp[x + 1] = t1;
+- }
+-#else
+-
+- /* Reverse byte order (if proper to do so)
+- to make things work out easier */
+- int x;
+- struct hw { _u16 s; } __attribute__ ((packed)) *p = (struct hw *) buf_v;
+- for (x = 0; x < len / 2; x++, p++)
+- p->s = ntohs(p->s);
+-#endif
+-}
+-
+-
+-
+ inline void toss (struct buffer *buf)
+ {
+ /*
diff -r 51c90f01f8c6 -r 4de5b7d6c13c net/xl2tpd/patches/patch-misc.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/xl2tpd/patches/patch-misc.h Fri Jul 12 19:06:31 2013 +0000
@@ -0,0 +1,45 @@
+$NetBSD: patch-misc.h,v 1.1 2013/07/12 19:06:31 christos Exp $
+
+Portable inlines are in header files.
+
+--- misc.h.orig 2013-06-17 06:17:24.000000000 -0400
++++ misc.h 2013-07-12 14:58:05.000000000 -0400
+@@ -65,7 +65,6 @@
+ extern struct buffer *new_buf (int);
+ extern void udppush_handler (int);
+ extern int addfcs (struct buffer *buf);
+-extern inline void swaps (void *, int);
+ extern void do_packet_dump (struct buffer *);
+ extern void status (const char *fmt, ...);
+ extern void status_handler (int signal);
+@@ -76,4 +75,30 @@
+ extern void opt_destroy (struct ppp_opts *);
+ extern struct ppp_opts *add_opt (struct ppp_opts *, char *, ...);
+ extern void process_signal (void);
++
++
++static inline void swaps (void *buf_v, int len)
++{
++#ifdef __alpha
++ /* Reverse byte order alpha is little endian so lest save a step.
++ to make things work out easier */
++ int x;
++ unsigned char t1;
++ unsigned char *tmp = (_u16 *) buf_v;
++ for (x = 0; x < len; x += 2)
++ {
++ t1 = tmp[x];
++ tmp[x] = tmp[x + 1];
++ tmp[x + 1] = t1;
++ }
++#else
++
++ /* Reverse byte order (if proper to do so)
++ to make things work out easier */
++ int x;
++ struct hw { _u16 s; } __attribute__((__packed__)) *p = (struct hw *) buf_v;
++ for (x = 0; x < len / 2; x++, p++)
++ p->s = ntohs(p->s);
++#endif
++}
+ #endif
Home |
Main Index |
Thread Index |
Old Index