Disable ICMP Host unreachable
Asked Answered
G

0

6

I'm using a single raw socket to read UDP packets from local test network with 1024 ports. Each UDP src and dest port is unique and I need access to IP and UDP header fields. I can stream and process data (in and out) at 100 mbps in linux-rt kernel with very low jitter < 250 usec, 10 usec nominal.

I'd like to prevent kernel from issuing ICMP port unreachable errors back to the sending host, however, I don't want to create 1024 vanilla UDP sockets and bind to each one because of resource constraints. Currently, I'm using iptables to drop the outbound port unreachable messages. Does anyone know of a way (programmatic using C code) to prevent the ICMP unreachable traffic? Perhaps an IOCTL or socket option? I also tried changing /proc/sys/net/ipv4/icmp_ratelimit but that seemed to have no effect. By default the ratemask is set for dest unreachables and a variety of ratelimit values did not change any behavior that I could see.

Gay answered 20/2, 2013 at 18:32 Comment(2)
Why? Why is the sending host sending to non-existent ports? What problem are you trying to solve here?Bindery
@Bindery when using raw sockets it's perfectly normal to receive packets that are destined for ports other than those known to the kernel via individually bound UDP sockets.Daradarach

© 2022 - 2024 — McMap. All rights reserved.