On Tue, Jul 25, 2017 at 10:30:02PM +0800, JingPiao Chen wrote:
> * defs.h (arp_hardware_types, iffflags): New xlat prototypes.
> * netlink_route.c: Include "print_fields.h" and <linux/rtnetlink.h>.
> (decode_ifinfomsg): New function.
> (netlink_route_decoder_t): New typedef.
> (route_decoders): New array.
> (decode_netlink_route): Use it.
> 
> Co-authored-by: Fabien Siron <fabien.si...@epita.fr>
> ---
[...]
>  bool
>  decode_netlink_route(struct tcb *const tcp,
>                    const struct nlmsghdr *const nlmsghdr,
>                    const kernel_ulong_t addr,
>                    const unsigned int len)
>  {
> +     unsigned int type = nlmsghdr->nlmsg_type;
>       uint8_t family;
>  
>       if (nlmsghdr->nlmsg_type == NLMSG_DONE)
>               return false;
>  
> -     if (!umove_or_printaddr(tcp, addr, &family))
> -             decode_family(tcp, family, addr, len);
> +     if (!umove_or_printaddr(tcp, addr, &family)) {
> +             if (type > RTM_BASE
> +                 && type - RTM_BASE < ARRAY_SIZE(route_decoders)
> +                 && route_decoders[type - RTM_BASE]) {

A mistake, type >= RTM_BASE instead of type > RTM_BASE.
Version 2 will send after these patches are reviewed.

> +                     route_decoders[type - RTM_BASE](tcp, nlmsghdr,
> +                                                     family, addr, len);
> +             } else
> +                     decode_family(tcp, family, addr, len);
> +     }
>  
>       return true;
>  }
> -- 
> 2.7.4
> 

--
JingPiao Chen

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to