u8 flags;
#ifdef CONFIG_DECNET_ROUTE_FWMARK
u32 fwmark;
+ u32 fwmask;
#endif
};
[FRA_SRC] = { .type = NLA_U16 },
[FRA_DST] = { .type = NLA_U16 },
[FRA_FWMARK] = { .type = NLA_U32 },
+ [FRA_FWMASK] = { .type = NLA_U32 },
[FRA_TABLE] = { .type = NLA_U32 },
};
return 0;
#ifdef CONFIG_DECNET_ROUTE_FWMARK
- if (r->fwmark && (r->fwmark != fl->fld_fwmark))
+ if ((r->fwmark ^ fl->fld_fwmark) & r->fwmask)
return 0;
#endif
r->dst = nla_get_u16(tb[FRA_DST]);
#ifdef CONFIG_DECNET_ROUTE_FWMARK
- if (tb[FRA_FWMARK])
+ if (tb[FRA_FWMARK]) {
r->fwmark = nla_get_u32(tb[FRA_FWMARK]);
+ if (r->fwmark)
+ /* compatibility: if the mark value is non-zero all bits
+ * are compared unless a mask is explicitly specified.
+ */
+ r->fwmask = 0xFFFFFFFF;
+ }
+
+ if (tb[FRA_FWMASK])
+ r->fwmask = nla_get_u32(tb[FRA_FWMASK]);
#endif
r->src_len = frh->src_len;
#ifdef CONFIG_DECNET_ROUTE_FWMARK
if (tb[FRA_FWMARK] && (r->fwmark != nla_get_u32(tb[FRA_FWMARK])))
return 0;
+
+ if (tb[FRA_FWMASK] && (r->fwmask != nla_get_u32(tb[FRA_FWMASK])))
+ return 0;
#endif
if (tb[FRA_SRC] && (r->src != nla_get_u16(tb[FRA_SRC])))
#ifdef CONFIG_DECNET_ROUTE_FWMARK
if (r->fwmark)
NLA_PUT_U32(skb, FRA_FWMARK, r->fwmark);
+ if (r->fwmask || r->fwmark)
+ NLA_PUT_U32(skb, FRA_FWMASK, r->fwmask);
#endif
if (r->dst_len)
NLA_PUT_U16(skb, FRA_DST, r->dst);