All of lore.kernel.org
 help / color / mirror / Atom feed
* xtables-addons: ipp2p does not block TCP traffic with nonlinear skb
@ 2023-05-31  6:42 ValdikSS
  2023-05-31  9:41 ` Jan Engelhardt
  0 siblings, 1 reply; 5+ messages in thread
From: ValdikSS @ 2023-05-31  6:42 UTC (permalink / raw)
  To: netfilter-devel


[-- Attachment #1.1: Type: text/plain, Size: 1448 bytes --]

Hello list,

I'm trying to block BitTorrent protocol on my local machine with ipp2p 
module using xtables-addons 3.24 on Fedora 37 (kernel 6.2.15) by adding 
the following rules:

# iptables -I OUTPUT -m ipp2p --bit --debug -j DROP
# iptables -I INPUT -m ipp2p --bit --debug -j DROP

However the protocol is not blocked completely: the announce is still 
successfully transmitted to the HTTP announcer, apparently due to 
nonlinear skb check in ipp2p.

There's a code to block this case:

> /* Search for BitTorrent commands */
> static unsigned int
> search_bittorrent(const unsigned char *payload, const unsigned int plen)
> ...
> 		if (memcmp(payload, "GET /", 5) == 0) {
> 			if (HX_memmem(payload, plen, "info_hash=", 10) != NULL)
> 				return IPP2P_BIT * 100 + 1;


However, it's not getting processed due to nonlinear skb:

> static bool
> ipp2p_mt(const struct sk_buff *skb, struct xt_action_param *par)
> 	/* make sure that skb is linear */
> 	if (skb_is_nonlinear(skb)) {
> 		if (info->debug)
> 			printk("IPP2P.match: nonlinear skb found\n");
> 		return 0;
> 	}

All I see in dmesg (rule with --debug) is:
IPP2P.match: nonlinear skb found

This could be checked with a simple curl command, which should be 
blocked if ipp2p --bit is active:

$ curl 'http://bt1.archive.org:6969/announce?info_hash=something'

I can see the response when executing this command, however it should be 
blocked.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-01 19:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-31  6:42 xtables-addons: ipp2p does not block TCP traffic with nonlinear skb ValdikSS
2023-05-31  9:41 ` Jan Engelhardt
2023-05-31 15:01   ` Jeremy Sowden
2023-05-31 15:15     ` Jan Engelhardt
2023-06-01 19:01   ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.