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_icmp.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'slirp/ip6_icmp.h') diff --git a/slirp/ip6_icmp.h b/slirp/ip6_icmp.h index b2c40d6c96..9460bf837a 100644 --- a/slirp/ip6_icmp.h +++ b/slirp/ip6_icmp.h @@ -19,6 +19,12 @@ struct icmp6_echo { /* Echo Messages */ uint16_t seq_num; }; +union icmp6_error_body { + uint32_t unused; + uint32_t pointer; + uint32_t mtu; +}; + /* * NDP Messages */ @@ -82,6 +88,7 @@ struct icmp6 { uint8_t icmp6_code; /* type sub code */ uint16_t icmp6_cksum; /* ones complement cksum of struct */ union { + union icmp6_error_body error_body; struct icmp6_echo echo; struct ndp_rs ndp_rs; struct ndp_ra ndp_ra; @@ -89,6 +96,7 @@ struct icmp6 { struct ndp_na ndp_na; struct ndp_redirect ndp_redirect; } icmp6_body; +#define icmp6_err icmp6_body.error_body #define icmp6_echo icmp6_body.echo #define icmp6_nrs icmp6_body.ndp_rs #define icmp6_nra icmp6_body.ndp_ra @@ -98,6 +106,7 @@ struct icmp6 { } QEMU_PACKED; #define ICMP6_MINLEN 4 +#define ICMP6_ERROR_MINLEN 8 #define ICMP6_ECHO_MINLEN 8 #define ICMP6_NDP_RS_MINLEN 8 #define ICMP6_NDP_RA_MINLEN 16 @@ -197,6 +206,7 @@ struct ndpopt { void icmp6_init(Slirp *slirp); void icmp6_cleanup(Slirp *slirp); void icmp6_input(struct mbuf *); +void icmp6_send_error(struct mbuf *m, uint8_t type, uint8_t code); void ndp_send_ra(Slirp *slirp); void ndp_send_ns(Slirp *slirp, struct in6_addr addr); -- cgit v1.2.1