Skip to content

Commit

Permalink
Userspace: handle --no-ipv6 for PF_INET6 UNBIND/BIND_PF
Browse files Browse the repository at this point in the history
  • Loading branch information
Waujito committed Oct 26, 2024
1 parent 93972f8 commit ae9592c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions youtubeUnblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,20 +497,22 @@ int init_queue(int queue_num) {
goto die;
}

nlh = nfq_nlmsg_put(buf, NFQNL_MSG_CONFIG, queue_num);
nfq_nlmsg_cfg_put_cmd(nlh, PF_INET6, NFQNL_CFG_CMD_PF_UNBIND);
if (config.use_ipv6) {
nlh = nfq_nlmsg_put(buf, NFQNL_MSG_CONFIG, queue_num);
nfq_nlmsg_cfg_put_cmd(nlh, PF_INET6, NFQNL_CFG_CMD_PF_UNBIND);

if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) {
perror("mnl_socket_send");
goto die;
}
if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) {
perror("mnl_socket_send");
goto die;
}

nlh = nfq_nlmsg_put(buf, NFQNL_MSG_CONFIG, queue_num);
nfq_nlmsg_cfg_put_cmd(nlh, PF_INET6, NFQNL_CFG_CMD_PF_BIND);
nlh = nfq_nlmsg_put(buf, NFQNL_MSG_CONFIG, queue_num);
nfq_nlmsg_cfg_put_cmd(nlh, PF_INET6, NFQNL_CFG_CMD_PF_BIND);

if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) {
perror("mnl_socket_send");
goto die;
if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) {
perror("mnl_socket_send");
goto die;
}
}
/* End of support for kernel versions < 3.8 */

Expand Down

0 comments on commit ae9592c

Please sign in to comment.