]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
- (dtucker) [defines.h] Bug #336: Add CMSG_DATA and CMSG_FIRSTHDR macros if
authorDarren Tucker <dtucker@zip.com.au>
Thu, 7 Aug 2003 05:58:28 +0000 (15:58 +1000)
committerDarren Tucker <dtucker@zip.com.au>
Thu, 7 Aug 2003 05:58:28 +0000 (15:58 +1000)
   not already defined (eg Linux with some versions of libc5), based on those
   from OpenBSD.

ChangeLog
defines.h

index 0f2f798e1764d39ae6e4ebd69d385220c0f89a90..513799d3d08634d95dc8de16609cbcdcc3470481 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,10 @@
  - (dtucker) [session.c] Have session_break_req not attempt to send a break
    if TIOCSBRK and TIOCCBRK are not defined (eg Cygwin).
  - (dtucker) [canohost.c] Bug #336: Only check ip options if IP_OPTIONS is
-   defined (eg really old Linux).
+   defined (fixes compile error on really old Linuxes).
+ - (dtucker) [defines.h] Bug #336: Add CMSG_DATA and CMSG_FIRSTHDR macros if
+   not already defined (eg Linux with some versions of libc5), based on those
+   from OpenBSD.
 
 20030802
  - (dtucker) [monitor.h monitor_wrap.h] Remove excess ident tags.
  - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
    Report from murple@murple.net, diagnosis from dtucker@zip.com.au
 
-$Id: ChangeLog,v 1.2881 2003/08/07 03:29:04 dtucker Exp $
+$Id: ChangeLog,v 1.2882 2003/08/07 05:58:28 dtucker Exp $
index ec610d0db50803c65561336a54046849a8de8032..3679ea549ef8b585c86ffbb67c1b1c0d87888811 100644 (file)
--- a/defines.h
+++ b/defines.h
@@ -25,7 +25,7 @@
 #ifndef _DEFINES_H
 #define _DEFINES_H
 
-/* $Id: defines.h,v 1.99 2003/06/11 12:51:32 djm Exp $ */
+/* $Id: defines.h,v 1.100 2003/08/07 05:58:28 dtucker Exp $ */
 
 
 /* Constants */
@@ -577,4 +577,22 @@ struct winsize {
 
 /** end of login recorder definitions */
 
+#ifndef CMSG_DATA
+/* given pointer to struct cmsghdr, return pointer to data */
+#define CMSG_DATA(cmsg) \
+       ((u_char *)(cmsg) +  (((u_int)(sizeof(struct cmsghdr)) \
+        (sizeof(int) - 1)) &~ (sizeof(int) - 1)))
+#endif /* CMSG_DATA */
+
+#ifndef CMSG_FIRSTHDR
+/*
+ * RFC 2292 requires to check msg_controllen, in case that the kernel returns
+ * an empty list for some reasons.
+ */
+# define CMSG_FIRSTHDR(mhdr) \
+       ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
+        (struct cmsghdr *)(mhdr)->msg_control : \
+        (struct cmsghdr *)NULL)
+#endif /* CMSG_FIRSTHDR */
+
 #endif /* _DEFINES_H */