From fc6c9257c6dd47316a1c55d356bcd89bdc5fd642 Mon Sep 17 00:00:00 2001 From: Yann Bordenave Date: Tue, 15 Mar 2016 10:31:19 +0100 Subject: slirp: Adding ICMPv6 error sending Adding icmp6_send_error to send ICMPv6 Error messages. This function is simpler than the v4 version. Adding some calls in various functions to send ICMP errors, when a received packet is too big, or when its hop limit is 0. Signed-off-by: Yann Bordenave Signed-off-by: Samuel Thibault Reviewed-by: Thomas Huth --- slirp/ip6_input.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'slirp/ip6_input.c') diff --git a/slirp/ip6_input.c b/slirp/ip6_input.c index ca0007c..b6a438d 100644 --- a/slirp/ip6_input.c +++ b/slirp/ip6_input.c @@ -39,9 +39,14 @@ void ip6_input(struct mbuf *m) goto bad; } + if (ntohs(ip6->ip_pl) > IF_MTU) { + icmp6_send_error(m, ICMP6_TOOBIG, 0); + goto bad; + } + /* check ip_ttl for a correct ICMP reply */ if (ip6->ip_hl == 0) { - /*icmp_send_error(m, ICMP_TIMXCEED,ICMP_TIMXCEED_INTRANS, 0,"ttl");*/ + icmp6_send_error(m, ICMP6_TIMXCEED, ICMP6_TIMXCEED_INTRANS); goto bad; } @@ -50,10 +55,10 @@ void ip6_input(struct mbuf *m) */ switch (ip6->ip_nh) { case IPPROTO_TCP: - /*tcp_input(m, hlen, (struct socket *)NULL);*/ + icmp6_send_error(m, ICMP6_UNREACH, ICMP6_UNREACH_NO_ROUTE); break; case IPPROTO_UDP: - /*udp_input(m, hlen);*/ + icmp6_send_error(m, ICMP6_UNREACH, ICMP6_UNREACH_NO_ROUTE); break; case IPPROTO_ICMPV6: icmp6_input(m); -- cgit v1.1