diff --git a/openair2/NETWORK_DRIVER/MESH/classifier.c b/openair2/NETWORK_DRIVER/MESH/classifier.c index 985bab946ecffc9241661b447e735fa09ab0d32e..a22ac2f20045b4457b9ec6adaeed72d931a0555a 100644 --- a/openair2/NETWORK_DRIVER/MESH/classifier.c +++ b/openair2/NETWORK_DRIVER/MESH/classifier.c @@ -410,7 +410,7 @@ struct cx_entity *nas_CLASS_cx6(struct sk_buff *skb, #endif //NAS_DEBUG_CLASS //if ((dst = (unsigned int*)&(((struct rt6_info *)skbdst)->rt6i_gateway)) == 0){ - if ((dst = ((struct iphdr*)(skb_network_header(skb)))->daddr) == 0) { + if ( (dst = &((struct iphdr*)(skb_network_header(skb)))->daddr) == NULL) { printk("nas_CLASS_cx6: dst addr is null \n"); p = p->next; @@ -475,7 +475,7 @@ struct cx_entity *nas_CLASS_cx4(struct sk_buff *skb, if (skb!=NULL) { daddr = ((struct iphdr*)(skb_network_header(skb)))->daddr; - if (daddr!=NULL) { + if (daddr!=0) { #ifdef NAS_DEBUG_CLASS printk("[NAS][CLASS][IPv4] Searching for %d.%d.%d.%d\n", diff --git a/openair2/NETWORK_DRIVER/MESH/common.c b/openair2/NETWORK_DRIVER/MESH/common.c index 1c7b8e4d123d41c11b1dfb9f5b47ffc916d8d997..738f05ad9922f4f17221e817f33df7a3e747ab96 100644 --- a/openair2/NETWORK_DRIVER/MESH/common.c +++ b/openair2/NETWORK_DRIVER/MESH/common.c @@ -53,17 +53,14 @@ void nas_COMMON_receive(uint16_t dlen, struct sk_buff *skb; struct ipversion *ipv; struct nas_priv *gpriv=netdev_priv(nasdev[inst]); - uint32_t odaddr,osaddr; //int i; unsigned char protocol; - unsigned char /**addr,*/ *daddr,*saddr,*ifaddr /*,sn*/; //struct udphdr *uh; //struct tcphdr *th; - uint16_t *cksum,check; struct iphdr *network_header; @@ -114,11 +111,12 @@ void nas_COMMON_receive(uint16_t dlen, // Make the third byte of both the source and destination equal to the fourth of the destination - + unsigned char * ifaddr, *saddr, daddr; daddr = (unsigned char *)&((struct iphdr *)skb->data)->daddr; odaddr = ((struct iphdr *)skb->data)->daddr; // sn = addr[3]; saddr = (unsigned char *)&((struct iphdr *)skb->data)->saddr; + uint32_t odaddr,osaddr; osaddr = ((struct iphdr *)skb->data)->saddr; if (daddr[0] == saddr[0]) {// same network @@ -219,6 +217,7 @@ void nas_COMMON_receive(uint16_t dlen, case IPPROTO_TCP: + uint16_t *cksum,check; cksum = (uint16_t*)&(((struct tcphdr*)(((char *)network_header + (network_header->ihl<<2))))->check); //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum)); diff --git a/openair2/NETWORK_DRIVER/MESH/device.c b/openair2/NETWORK_DRIVER/MESH/device.c index f5d31742bc400c4cc055d8950ae633c65b9beec0..8b95e05cfcf063b8591fbd8af296b602af82e77e 100644 --- a/openair2/NETWORK_DRIVER/MESH/device.c +++ b/openair2/NETWORK_DRIVER/MESH/device.c @@ -241,7 +241,7 @@ int nas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) // End debug information netif_stop_queue(dev); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE>=1796 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE>=1796) netif_trans_update(dev); #else dev->trans_start = jiffies; @@ -306,7 +306,7 @@ void nas_tx_timeout(struct net_device *dev) printk("TX_TIMEOUT: begin\n"); // (struct nas_priv *)(dev->priv)->stats.tx_errors++; (priv->stats).tx_errors++; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE>=1796 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE>=1796) netif_trans_update(dev); #else dev->trans_start = jiffies; @@ -324,7 +324,7 @@ static const struct net_device_ops nasmesh_netdev_ops = { .ndo_set_mac_address = NULL, .ndo_set_config = nas_set_config, .ndo_do_ioctl = nas_CTL_ioctl, -#if RHEL_RELEASE_CODE>=1797 +#if (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE>=1797) .extended.ndo_change_mtu = nas_change_mtu, #else .ndo_change_mtu = nas_change_mtu, diff --git a/openair2/NETWORK_DRIVER/MESH/mesh.c b/openair2/NETWORK_DRIVER/MESH/mesh.c index 367e34cc4fb519265ad568e60292af048d0241c5..ed87bc05f89ae52f100881aa742d70b2789ae60a 100644 --- a/openair2/NETWORK_DRIVER/MESH/mesh.c +++ b/openair2/NETWORK_DRIVER/MESH/mesh.c @@ -30,7 +30,7 @@ ***************************************************************************/ - +#include <linux/version.h> #include "local.h" #include "proto_extern.h" @@ -155,10 +155,18 @@ void nas_mesh_start_default_sclassifier(struct cx_entity *cx,struct rb_entity *r } //--------------------------------------------------------------------------- +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) +void nas_mesh_timer(struct timer_list *t) +#else void nas_mesh_timer(unsigned long data) +#endif { //--------------------------------------------------------------------------- +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) + struct nas_priv *gpriv=from_timer(gpriv, t, timer); + #else struct nas_priv *gpriv=(struct nas_priv *) data; + #endif uint8_t cxi; struct cx_entity *cx; struct rb_entity *rb; @@ -166,10 +174,14 @@ void nas_mesh_timer(unsigned long data) #ifdef NAS_DEBUG_TIMER printk("NAS_MESH_TIMER - begin \n"); #endif - +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) +timer_setup(&gpriv->timer, nas_mesh_timer, 0); + mod_timer(&gpriv->timer, jiffies+NAS_TIMER_TICK); + #else (gpriv->timer).function=nas_mesh_timer; (gpriv->timer).expires=jiffies+NAS_TIMER_TICK; (gpriv->timer).data=data; + #endif return; diff --git a/openair2/NETWORK_DRIVER/MESH/proto_extern.h b/openair2/NETWORK_DRIVER/MESH/proto_extern.h index 844c5b41a4a3d9a9f99e454ef93d51977f37af05..2eae034257f291610ad0f765af37c5bda116b5cd 100644 --- a/openair2/NETWORK_DRIVER/MESH/proto_extern.h +++ b/openair2/NETWORK_DRIVER/MESH/proto_extern.h @@ -195,7 +195,6 @@ void nas_mesh_init(int inst //!< Instance ID ); -void nas_mesh_timer(unsigned long data); int nas_mesh_DC_receive(struct cx_entity *cx,struct nas_priv *gpriv); int nas_mesh_GC_receive(struct nas_priv *gpriv); diff --git a/openair2/NETWORK_DRIVER/MESH/tool.c b/openair2/NETWORK_DRIVER/MESH/tool.c index 2e8e68a17cfb821f44c72bdae0fed1754c7099e5..a8d359f9ff9a0851cc76a7fd0709a85293d1f8e5 100644 --- a/openair2/NETWORK_DRIVER/MESH/tool.c +++ b/openair2/NETWORK_DRIVER/MESH/tool.c @@ -679,11 +679,11 @@ void print_TOOL_pk_all(struct sk_buff *skb) switch (ntohs(skb->protocol)) { case ETH_P_IPV6: - print_TOOL_pk_ipv6((struct ipv6hdr *)skb->network_header); + print_TOOL_pk_ipv6((struct ipv6hdr *)skb_network_header(skb)); break; case ETH_P_IP: - print_TOOL_pk_ipv4((struct iphdr *)skb->network_header); + print_TOOL_pk_ipv4((struct iphdr *)skb_network_header(skb)); break; } }