On 2/20/18 6:53 PM, Donald Sharp wrote: > @@ -159,7 +159,13 @@ static bool filter_nlmsg(struct nlmsghdr *n, struct > rtattr **tb, int host_len) > return false; > } > > - table = rtm_get_table(r, tb); > + > + /* struct fib_rule_hdr and struct rtmsg > + * were intentionally the same. Since > + * the table is the rtm_table, just call > + * it. > + */ > + table = rtm_get_table((struct rtmsg *)frh, tb); > if (filter.tb > 0 && filter.tb ^ table) > return false; > ...
> @@ -273,7 +279,12 @@ int print_rule(const struct sockaddr_nl *who, struct > nlmsghdr *n, void *arg) > fprintf(fp, "uidrange %u-%u ", r->start, r->end); > } > > - table = rtm_get_table(r, tb); > + /* struct fib_rule_hdr and struct rtmsg > + * were intentionally the same. Since > + * the table is the rtm_table, just call > + * it. > + */ > + table = rtm_get_table((struct rtmsg *)frh, tb); > if (table) { > fprintf(fp, "lookup %s ", > rtnl_rttable_n2a(table, b1, sizeof(b1))); I would rather have a second get_table function than use the typecast; frh_get_table() that mirrors rtm_get_table. Thanks for taking the time to fix the ancillary header struct.