Added support for Linux version 5.10

b95e75064d
pull/108/head
brektrou 6 years ago committed by GitHub
parent 397a8182cf
commit 6df86a017f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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;

Loading…
Cancel
Save