*** ./nbase/nbase_misc.c.ORIG	Wed Dec 14 22:55:27 2011
--- ./nbase/nbase_misc.c	Wed Dec 14 22:56:34 2011
***************
*** 117,122 ****
--- 117,126 ----
  #define INET6_ADDRSTRLEN 46
  #endif
  
+ #if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+ #define ss_family __ss_family
+ #endif
+ 
  /* Returns the UNIX/Windows errno-equivalent.  Note that the Windows
     call is socket/networking specific.  The windows error number
     returned is like WSAMSGSIZE, but nbase.h includes #defines to
*** ./traceroute.cc.ORIG	Wed Dec 14 23:20:48 2011
--- ./traceroute.cc	Wed Dec 14 23:21:00 2011
***************
*** 145,150 ****
--- 145,154 ----
  #include <set>
  #include <vector>
  
+ #if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+ #define ss_family __ss_family
+ #endif
+ 
  extern NmapOps o;
  
  /* The highest TTL we go up to if the target itself doesn't respond. */
*** ./ncat/ncat_proxy.c.ORIG	Thu Dec 15 22:58:47 2011
--- ./ncat/ncat_proxy.c	Thu Dec 15 22:59:01 2011
***************
*** 97,102 ****
--- 97,106 ----
  #include <unistd.h>
  #endif
  
+ #if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+ #define ss_family __ss_family
+ #endif
+ 
  #ifndef WIN32
  /* SIG_CHLD handler */
  static void proxyreaper(int signo)
*** ./nping/utils_net.cc.ORIG	Wed May 30 00:15:05 2012
--- ./nping/utils_net.cc	Wed May 30 00:15:19 2012
***************
*** 101,106 ****
--- 101,110 ----
  #include "dnet.h"
  #include <vector>
  
+ #if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+ #define ss_family __ss_family
+ #endif
+ 
  extern NpingOps o;
  
  int atoIP(const char *hostname, struct in_addr *dst){
*** ./nse_nmaplib.cc.ORIG	Wed May 30 00:11:49 2012
--- ./nse_nmaplib.cc	Wed May 30 00:12:02 2012
***************
*** 25,30 ****
--- 25,34 ----
  #include "nse_nsock.h"
  #include "nse_dnet.h"
  
+ #if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+ #define ss_family __ss_family
+ #endif
+ 
  extern NmapOps o;
  
  static const char *NSE_PROTOCOL_OP[] = {"tcp", "udp", "sctp", NULL};

--- ./nse_nsock.cc.orig   2018-01-11 18:33:38 -0600
+++ ./nse_nsock.cc        2018-01-11 18:36:41 -0600
@@ -14,6 +14,10 @@
 #include "nse_utility.h"
 #include "nse_ssl_cert.h"

+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 #if HAVE_OPENSSL
 /* See the comments in service_scan.cc for the reason for _WINSOCKAPI_. */
 #  define _WINSOCKAPI_

--- ./nsock/src/nsock_connect.c.orig      2018-01-11 18:36:54 -0600
+++ ./nsock/src/nsock_connect.c   2018-01-11 18:38:04 -0600
@@ -64,6 +64,9 @@
 #include <errno.h>
 #include <string.h>

+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif

 static int mksock_bind_addr(struct npool *ms, struct niod *iod) {
   int rc;
--- ./output.cc.orig      2018-01-11 18:41:44 -0600
+++ ./output.cc   2018-01-11 18:42:54 -0600
@@ -159,6 +159,10 @@
 #include <list>
 #include <sstream>

+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 extern NmapOps o;
 static const char *logtypes[LOG_NUM_FILES] = LOG_NAMES;

--- ./scan_engine.cc.orig 2018-01-11 18:44:23 -0600
+++ ./scan_engine.cc      2018-01-11 18:46:00 -0600
@@ -159,6 +159,10 @@
 #include <list>
 #include <map>

+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 extern NmapOps o;
 #ifdef WIN32
 /* from libdnet's intf-win32.c */

--- ./portlist.cc.orig    2018-01-11 18:46:17 -0600
+++ ./portlist.cc 2018-01-11 18:46:51 -0600
@@ -139,6 +139,10 @@
 #include "tcpip.h"
 #include "libnetutil/netutil.h"

+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 #if HAVE_STRINGS_H
 #include <strings.h>
 #endif /* HAVE_STRINGS_H */
--- ./ncat/ncat_main.c.orig	2019-05-22 08:13:52 +0000
+++ ./ncat/ncat_main.c	2019-05-22 08:27:16 +0000
@@ -156,6 +156,10 @@
 #include "ncat_lua.h"
 #endif
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 static int ncat_connect_mode(void);
 static int ncat_listen_mode(void);
 
--- ./ncat/ncat_connect.c.orig	2019-05-22 08:26:01 +0000
+++ ./ncat/ncat_connect.c	2019-05-22 08:27:46 +0000
@@ -157,6 +157,10 @@
 #define SHUT_WR SD_SEND
 #endif
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 struct conn_state {
     nsock_iod sock_nsi;
     nsock_iod stdin_nsi;
--- ./ncat/ncat_listen.c.orig	2019-05-22 08:28:01 +0000
+++ ./ncat/ncat_listen.c	2019-05-22 08:28:32 +0000
@@ -155,6 +155,10 @@
 #include <openssl/err.h>
 #endif
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 #ifdef WIN32
 /* Define missing constant for shutdown(2).
  * See:
--- ./tcpip.cc.orig	2019-05-22 08:31:34 +0000
+++ ./tcpip.cc	2019-05-22 08:32:10 +0000
@@ -155,6 +155,10 @@
 
 static PacketCounter PktCt;
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 /* Create a raw socket and do things that always apply to raw sockets:
     * Set SO_BROADCAST.
     * Set IP_HDRINCL.
--- ./nping/ProbeMode.cc.orig	2019-05-22 08:29:33 +0000
+++ ./nping/ProbeMode.cc	2019-05-22 08:29:56 +0000
@@ -141,6 +141,10 @@
 #include "libnetutil/netutil.h"
 #endif
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 extern NpingOps o;
 
 
--- ./nping/EchoServer.cc.orig	2019-05-22 08:28:53 +0000
+++ ./nping/EchoServer.cc	2019-05-22 08:29:22 +0000
@@ -138,6 +138,10 @@
 #include "ProbeMode.h"
 #include <signal.h>
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 extern NpingOps o;
 extern EchoServer es;
 
--- ./nsock/src/nsock_core.c.orig	2019-05-22 08:30:08 +0000
+++ ./nsock/src/nsock_core.c	2019-05-22 08:30:43 +0000
@@ -86,6 +86,10 @@
 #include "nsock_pcap.h"
 #endif
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 /* Nsock time of day -- we update this at least once per nsock_loop round (and
  * after most calls that are likely to block).  Other nsock files should grab
  * this */
--- ./nsock/src/nsock_write.c.orig	2019-05-22 08:31:02 +0000
+++ ./nsock/src/nsock_write.c	2019-05-22 08:31:23 +0000
@@ -64,6 +64,10 @@
 #include <stdarg.h>
 #include <errno.h>
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 nsock_event_id nsock_sendto(nsock_pool ms_pool, nsock_iod ms_iod, nsock_ev_handler handler, int timeout_msecs,
                             void *userdata, struct sockaddr *saddr, size_t sslen, unsigned short port, const char *data, int datalen) {
   struct npool *nsp = (struct npool *)ms_pool;
--- ./Target.cc.orig	2019-05-22 08:33:41 +0000
+++ ./Target.cc	2019-05-22 08:34:04 +0000
@@ -143,6 +143,10 @@
 #include "nmap.h"
 #include "nmap_error.h"
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 extern NmapOps o;
 
 Target::Target() {
--- ./portreasons.cc.org	2022-08-22 08:29:51 +0000
+++ ./portreasons.cc	2022-08-22 08:31:47 +0000
@@ -66,6 +66,10 @@
 #ifdef WIN32
 #include "winfix.h"
 #endif
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 #include "portlist.h"
 #include "NmapOps.h"
 #include "portreasons.h"
--- ./FPEngine.cc.org	2022-08-22 08:33:45 +0000
+++ ./FPEngine.cc	2022-08-22 08:34:35 +0000
@@ -74,6 +74,10 @@
 #include "tcpip.h"
 #include "string_pool.h"
 extern NmapOps o;
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 #ifdef WIN32
 /* Need DnetName2PcapName */
 #include "libnetutil/netutil.h"
 
--- ./ncat/util.c.org	2022-08-22 08:48:13 +0000
+++ ./ncat/util.c	2022-08-22 08:48:57 +0000
@@ -83,6 +83,10 @@
 #include <unistd.h>
 #endif
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 #if HAVE_LINUX_VM_SOCKETS_H
 #include <linux/vm_sockets.h>
 #endif
--- ./nping/nping.cc.org	2022-08-22 08:49:55 +0000
+++ ./nping/nping.cc	2022-08-22 08:51:16 +0000
@@ -64,6 +64,7 @@
 #include "winfix.h"
 #endif
 
+#include "dnet.h"
 #include "nping.h"
 #include "output.h"
 #include "NpingOps.h"
--- ./NmapOps.cc.org	2022-08-22 08:52:20 +0000
+++ ./NmapOps.cc	2022-08-22 08:53:23 +0000
@@ -64,6 +64,10 @@
 #ifdef WIN32
 #include "winfix.h"
 #endif
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 #include "nmap.h"
 #include "nbase.h"
 #include "NmapOps.h"
--- ./nse_dnet.cc.org	2022-08-22 08:54:03 +0000
+++ ./nse_dnet.cc	2022-08-22 08:55:13 +0000
@@ -10,6 +10,9 @@
 #include "struct_ip.h"
 
 #include "nse_lua.h"
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
 
 #include <assert.h>
 
--- ./libnetutil/netutil.cc.org	2022-08-22 09:03:28 +0000
+++ ./libnetutil/netutil.cc	2022-08-22 09:04:11 +0000
@@ -69,6 +69,10 @@
 
 #include "nbase.h"
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family
+#endif
+
 #ifndef WIN32
 #include <sys/uio.h>
 #include <sys/ioctl.h>
@@ -90,7 +90,7 @@
 
 /* Define CMSG_* symbols for Solaris 9 and earlier. See
    http://wiki.opencsw.org/porting-faq#toc10. */
-#if defined(__sun) || defined(__sun__)
+#if defined(__sun) || defined(__sun__) || (defined(_AIX51) && !defined(_AIX53))
 # ifndef CMSG_ALIGN
 #   ifdef __sun__
 #     define CMSG_ALIGN(len) _CMSG_DATA_ALIGN (len)
@@ -3738,6 +3738,14 @@
   return 0;
 }
 
+ #if defined(_AIX) && !defined(_AIX61) && !defined(_AIX71)
+ #define IPV6_HOPLIMIT           40   /* ancillary-only option */
+ #define IPV6_RTHDR              50   /* routing header option */
+ #define IPV6_HOPOPTS            52   /* Hop-by-Hop Header */
+ #define IPV6_DSTOPTS            54   /* Destination Opts Header after Rthdr
+                                         or when there is no Rthdr */
+ #endif
+
 static int exthdr_type_to_cmsg_type(uint8_t type) {
   switch (type) {
   /* These are the only extension headers we can set directly through a
--- ./osscan2.cc_orig	2023-07-12 07:32:46.009730991 +0000
+++ ./osscan2.cc	2023-07-12 07:33:35.133210701 +0000
@@ -75,6 +75,10 @@
 
 #include "struct_ip.h"
 
+#if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) && !(defined(_AIX71))
+#define ss_family __ss_family  
+#endif
+
 #include <list>
 #include <math.h>
 
--- ./TargetGroup.cc_orig	2023-07-12 07:32:22.529749544 +0000
+++ ./TargetGroup.cc	2023-07-12 07:34:30.241727587 +0000
@@ -62,6 +62,7 @@
 
 /* $Id: TargetGroup.cc 38653 2023-04-14 17:11:46Z dmiller $ */
 
+#include "dnet.h"
 #include "tcpip.h"
 #include "TargetGroup.h"
 #include "NmapOps.h"
