[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
detecting administratively unreachable
Hi, everyone -
I couldn't find anything by searching the mailing list archives but I
may just not have entered the right keywords. If so, apologies in
advance and could you please point me to the right thread?
I'm writing an application that uses connect(2) to open a TCP
connection. I'd like to be able to distinguish between two cases: ICMP
network unreachable and ICMP network administratively unreachable.
Unfortunately, under the 2.2 kernel, in
/usr/src/linux-2.2.18/net/ipv4/icmp.c, it looks like
icmp_err_convert[] maps both ICMP_NET_UNREACH and ICMP_NET_ANO onto
ENETUNREACH.
Is there a way, from the application layer, and without having to go
through all the work of incorporating a packet capture library, to do
either of these things:
1. get at the ICMP headers themselves so I can extract the ICMP code, or
2. figure out if the error associated with ENETUNREACH is fatal or
transitory (since icmp_err_convert[] maps ICMP_NET_UNREACH to a
transitory error and ICMP_NET_ANO to a fatal one)
thanks very much in advance,
Jeff Cours
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/