From 78de2c2137db802893173fd5699a7f15fb006293 Mon Sep 17 00:00:00 2001 From: bol-van Date: Mon, 3 Jan 2022 21:30:42 +0300 Subject: [PATCH] nfqws: move IP_NODEFRAG sockopt --- nfq/darkmagic.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/nfq/darkmagic.c b/nfq/darkmagic.c index 66a2aa1..d41e511 100644 --- a/nfq/darkmagic.c +++ b/nfq/darkmagic.c @@ -794,15 +794,6 @@ static int rawsend_socket_raw(int domain, int proto) close(fd); return -1; } - #ifdef __linux__ - int yes=1; - if (setsockopt(fd,IPPROTO_IP,IP_NODEFRAG,&yes,sizeof(yes)) == -1) - { - perror("rawsend: setsockopt(IP_NODEFRAG)"); - close(fd); - return -1; - } - #endif } return fd; } @@ -863,6 +854,11 @@ static int rawsend_socket(sa_family_t family,uint32_t fwmark) perror("rawsend: setsockopt(SO_PRIORITY)"); goto exiterr; } + if (setsockopt(*sock, IPPROTO_IP, IP_NODEFRAG, &yes, sizeof(yes)) == -1) + { + perror("rawsend: setsockopt(IP_NODEFRAG)"); + goto exiterr; + } #endif } return *sock;