Lines Matching refs:nlrule

496 static int fib_nl2rule_l3mdev(struct nlattr *nla, struct fib_rule *nlrule,  in fib_nl2rule_l3mdev()  argument
499 nlrule->l3mdev = nla_get_u8(nla); in fib_nl2rule_l3mdev()
500 if (nlrule->l3mdev != 1) { in fib_nl2rule_l3mdev()
508 static int fib_nl2rule_l3mdev(struct nlattr *nla, struct fib_rule *nlrule, in fib_nl2rule_l3mdev() argument
525 struct fib_rule *nlrule = NULL; in fib_nl2rule() local
544 nlrule = kzalloc(ops->rule_size, GFP_KERNEL_ACCOUNT); in fib_nl2rule()
545 if (!nlrule) { in fib_nl2rule()
549 refcount_set(&nlrule->refcnt, 1); in fib_nl2rule()
550 nlrule->fr_net = net; in fib_nl2rule()
553 nlrule->pref = nla_get_u32(tb[FRA_PRIORITY]); in fib_nl2rule()
556 nlrule->pref = fib_default_rule_pref(ops); in fib_nl2rule()
559 nlrule->proto = tb[FRA_PROTOCOL] ? in fib_nl2rule()
565 nlrule->iifindex = -1; in fib_nl2rule()
566 nla_strscpy(nlrule->iifname, tb[FRA_IIFNAME], IFNAMSIZ); in fib_nl2rule()
567 dev = __dev_get_by_name(net, nlrule->iifname); in fib_nl2rule()
569 nlrule->iifindex = dev->ifindex; in fib_nl2rule()
575 nlrule->oifindex = -1; in fib_nl2rule()
576 nla_strscpy(nlrule->oifname, tb[FRA_OIFNAME], IFNAMSIZ); in fib_nl2rule()
577 dev = __dev_get_by_name(net, nlrule->oifname); in fib_nl2rule()
579 nlrule->oifindex = dev->ifindex; in fib_nl2rule()
583 nlrule->mark = nla_get_u32(tb[FRA_FWMARK]); in fib_nl2rule()
584 if (nlrule->mark) in fib_nl2rule()
588 nlrule->mark_mask = 0xFFFFFFFF; in fib_nl2rule()
592 nlrule->mark_mask = nla_get_u32(tb[FRA_FWMASK]); in fib_nl2rule()
595 nlrule->tun_id = nla_get_be64(tb[FRA_TUN_ID]); in fib_nl2rule()
599 fib_nl2rule_l3mdev(tb[FRA_L3MDEV], nlrule, extack) < 0) in fib_nl2rule()
602 nlrule->action = frh->action; in fib_nl2rule()
603 nlrule->flags = frh->flags; in fib_nl2rule()
604 nlrule->table = frh_get_table(frh, tb); in fib_nl2rule()
606 nlrule->suppress_prefixlen = nla_get_u32(tb[FRA_SUPPRESS_PREFIXLEN]); in fib_nl2rule()
608 nlrule->suppress_prefixlen = -1; in fib_nl2rule()
611 nlrule->suppress_ifgroup = nla_get_u32(tb[FRA_SUPPRESS_IFGROUP]); in fib_nl2rule()
613 nlrule->suppress_ifgroup = -1; in fib_nl2rule()
616 if (nlrule->action != FR_ACT_GOTO) { in fib_nl2rule()
621 nlrule->target = nla_get_u32(tb[FRA_GOTO]); in fib_nl2rule()
623 if (nlrule->target <= nlrule->pref) { in fib_nl2rule()
627 } else if (nlrule->action == FR_ACT_GOTO) { in fib_nl2rule()
632 if (nlrule->l3mdev && nlrule->table) { in fib_nl2rule()
644 nlrule->uid_range = nla_get_kuid_range(tb); in fib_nl2rule()
646 if (!uid_range_set(&nlrule->uid_range) || in fib_nl2rule()
647 !uid_lte(nlrule->uid_range.start, nlrule->uid_range.end)) { in fib_nl2rule()
652 nlrule->uid_range = fib_kuid_range_unset; in fib_nl2rule()
656 nlrule->ip_proto = nla_get_u8(tb[FRA_IP_PROTO]); in fib_nl2rule()
660 &nlrule->sport_range); in fib_nl2rule()
669 &nlrule->dport_range); in fib_nl2rule()
676 *rule = nlrule; in fib_nl2rule()
681 kfree(nlrule); in fib_nl2rule()
888 struct fib_rule *rule = NULL, *r, *nlrule = NULL; in fib_nl_delrule() local
912 err = fib_nl2rule(skb, nlh, extack, ops, tb, &nlrule, &user_priority); in fib_nl_delrule()
916 rule = rule_find(ops, frh, tb, nlrule, user_priority); in fib_nl_delrule()
973 kfree(nlrule); in fib_nl_delrule()
977 kfree(nlrule); in fib_nl_delrule()