Merge pull request #237 from fsantini/fix_kernel_5.15

Fix compilation for kernel 5.15+
This commit is contained in:
Ole Petter Bang 2022-05-11 20:30:20 +02:00 committed by GitHub
commit 69539f685e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,10 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <net/ip.h> #include <net/ip.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
#include <net/ipx.h> #include <net/ipx.h>
#endif
#include <linux/atalk.h> #include <linux/atalk.h>
#include <linux/udp.h> #include <linux/udp.h>
#include <linux/if_pppox.h> #include <linux/if_pppox.h>
@ -170,7 +173,7 @@ static __inline__ void __nat25_generate_ipv4_network_addr(unsigned char *network
memcpy(networkAddr+7, (unsigned char *)ipAddr, 4); memcpy(networkAddr+7, (unsigned char *)ipAddr, 4);
} }
#ifdef _NET_INET_IPX_H_
static __inline__ void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr, static __inline__ void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr) unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
{ {
@ -191,7 +194,7 @@ static __inline__ void __nat25_generate_ipx_network_addr_with_socket(unsigned ch
memcpy(networkAddr+1, (unsigned char *)ipxNetAddr, 4); memcpy(networkAddr+1, (unsigned char *)ipxNetAddr, 4);
memcpy(networkAddr+5, (unsigned char *)ipxSocketAddr, 2); memcpy(networkAddr+5, (unsigned char *)ipxSocketAddr, 2);
} }
#endif
static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networkAddr, static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
unsigned short *network, unsigned char *node) unsigned short *network, unsigned char *node)
@ -337,6 +340,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
return x & (NAT25_HASH_SIZE - 1); return x & (NAT25_HASH_SIZE - 1);
} }
#ifdef _NET_INET_IPX_H_
else if(networkAddr[0] == NAT25_IPX) else if(networkAddr[0] == NAT25_IPX)
{ {
unsigned long x; unsigned long x;
@ -346,6 +350,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
return x & (NAT25_HASH_SIZE - 1); return x & (NAT25_HASH_SIZE - 1);
} }
#endif
else if(networkAddr[0] == NAT25_APPLE) else if(networkAddr[0] == NAT25_APPLE)
{ {
unsigned long x; unsigned long x;
@ -927,7 +932,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
return -1; return -1;
} }
} }
#ifdef _NET_INET_IPX_H_
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/* Handle IPX and Apple Talk frame */ /* Handle IPX and Apple Talk frame */
/*---------------------------------------------------*/ /*---------------------------------------------------*/
@ -1191,7 +1196,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
return -1; return -1;
} }
#endif
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/* Handle PPPoE frame */ /* Handle PPPoE frame */
/*---------------------------------------------------*/ /*---------------------------------------------------*/