mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
icmp: add helpers to recognize ICMP error packets
Add two helper functions, one for IPv4 and one for IPv6, to recognize the ICMP packets which are error responses. This packets are special because they have as payload the original header of the packet which generated it (RFC 792 says at least 8 bytes, but Linux actually includes much more than that). Signed-off-by: Matteo Croce <mcroce@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b8fed591df
commit
15122464d5
2 changed files with 29 additions and 0 deletions
|
@ -46,4 +46,18 @@ extern void icmpv6_flow_init(struct sock *sk,
|
|||
const struct in6_addr *saddr,
|
||||
const struct in6_addr *daddr,
|
||||
int oif);
|
||||
|
||||
static inline bool icmpv6_is_err(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case ICMPV6_DEST_UNREACH:
|
||||
case ICMPV6_PKT_TOOBIG:
|
||||
case ICMPV6_TIME_EXCEED:
|
||||
case ICMPV6_PARAMPROB:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue