]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
netfilter: Decrease code duplication regarding transparent socket option
authorMáté Eckl <ecklm94@gmail.com>
Fri, 1 Jun 2018 12:54:07 +0000 (14:54 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 2 Jun 2018 22:02:01 +0000 (00:02 +0200)
commit8d6e555773690e6fdefd99723fcd0a7e432c0c90
treecd7d4ea4b08330fce0b77b2be2011c36938878bf
parent1ffdd8e1643f6ce28792edd3314be84167faabf1
netfilter: Decrease code duplication regarding transparent socket option

There is a function in include/net/netfilter/nf_socket.h to decide if a
socket has IP(V6)_TRANSPARENT socket option set or not. However this
does the same as inet_sk_transparent() in include/net/tcp.h

include/net/tcp.h:1733
/* This helper checks if socket has IP_TRANSPARENT set */
static inline bool inet_sk_transparent(const struct sock *sk)
{
switch (sk->sk_state) {
case TCP_TIME_WAIT:
return inet_twsk(sk)->tw_transparent;
case TCP_NEW_SYN_RECV:
return inet_rsk(inet_reqsk(sk))->no_srccheck;
}
return inet_sk(sk)->transparent;
}

tproxy_sk_is_transparent has also been refactored to use this function
instead of reimplementing it.

Signed-off-by: Máté Eckl <ecklm94@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_socket.h
net/netfilter/nft_socket.c
net/netfilter/xt_TPROXY.c
net/netfilter/xt_socket.c