Re: [B.A.T.M.A.N.] [RFCv2] batctl tcpdump: add IPv6 support to tcpdump parser

Antonio Quartulli
2013-09-17T15:51:20Z

[-- Attachment #1: Type: text/plain, Size: 972 bytes --]

On Tue, Sep 17, 2013 at 02:08:14PM +0200, Marco Dalla Torre wrote:
> + switch (iphdr->ip6_nxt) {
> + case IPPROTO_ICMPV6:
> + LEN_CHECK(
> + (size_t)buff_len - (size_t)(sizeof(struct ip6_hdr)),
> + sizeof(struct icmp6_hdr),
> + "ICMPv6");
> + icmphdr = (struct icmp6_hdr *)(packet_buff +
> + sizeof(struct ip6_hdr));
> + inet_ntop(AF_INET6, &(iphdr->ip6_src), nd_ipv6_addr, 40);
> + printf("IPv6 %s > ", nd_ipv6_addr);
> + switch (icmphdr->icmp6_type) {
> + case ICMP6_DST_UNREACH:
> + if ((size_t)(buff_len) < IPV6_MIN_MTU) {
> + fprintf(stderr,
> + "Warning - dropping received 'ICMPv6 destination unreached' packet as it is bigger than maximum allowed size (%u): %zu\n",
> + IPV6_MIN_MTU, (size_t)(buff_len));

Is the message wrong? should it be the other way around? "packet is smaller than
minimum size" ? And why should _only_ this ICMP packet be bigger of IPV6_MIN_MTU
?