diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index c4b5157..257c581 100755 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -3933,7 +3933,9 @@ static int route_dump(u32 *gw_addr , int *gw_index) struct msghdr msg; struct iovec iov; struct sockaddr_nl nladdr; + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) mm_segment_t oldfs; + #endif char *pg; int size = 0; @@ -3972,14 +3974,18 @@ static int route_dump(u32 *gw_addr , int *gw_index) msg.msg_controllen = 0; msg.msg_flags = MSG_DONTWAIT; + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) oldfs = get_fs(); set_fs(KERNEL_DS); + #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) err = sock_sendmsg(sock, &msg); #else err = sock_sendmsg(sock, &msg, sizeof(req)); #endif + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) set_fs(oldfs); + #endif if (err < 0) goto out_sock; @@ -4004,14 +4010,18 @@ restart: iov_iter_init(&msg.msg_iter, READ, &iov, 1, PAGE_SIZE); #endif + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) oldfs = get_fs(); set_fs(KERNEL_DS); + #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) err = sock_recvmsg(sock, &msg, MSG_DONTWAIT); #else err = sock_recvmsg(sock, &msg, PAGE_SIZE, MSG_DONTWAIT); #endif + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) set_fs(oldfs); + #endif if (err < 0) goto out_sock_pg; @@ -4082,14 +4092,18 @@ done: msg.msg_controllen = 0; msg.msg_flags = MSG_DONTWAIT; + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) oldfs = get_fs(); set_fs(KERNEL_DS); + #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) err = sock_sendmsg(sock, &msg); #else err = sock_sendmsg(sock, &msg, sizeof(req)); #endif + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) set_fs(oldfs); + #endif if (err > 0) goto restart;