Lines Matching refs:cfg

330 static int mpls_route_add(struct mpls_route_config *cfg)  in mpls_route_add()  argument
333 struct net *net = cfg->rc_nlinfo.nl_net; in mpls_route_add()
340 index = cfg->rc_label; in mpls_route_add()
344 (cfg->rc_nlflags & NLM_F_CREATE)) { in mpls_route_add()
357 if (cfg->rc_output_labels > MAX_NEW_LABELS) in mpls_route_add()
361 dev = dev_get_by_index(net, cfg->rc_ifindex); in mpls_route_add()
371 if ((cfg->rc_via_table == NEIGH_LINK_TABLE) && in mpls_route_add()
372 (dev->addr_len != cfg->rc_via_alen)) in mpls_route_add()
377 if (cfg->rc_nlflags & NLM_F_APPEND) in mpls_route_add()
383 if ((cfg->rc_nlflags & NLM_F_EXCL) && old) in mpls_route_add()
387 if (!(cfg->rc_nlflags & NLM_F_REPLACE) && old) in mpls_route_add()
391 if (!(cfg->rc_nlflags & NLM_F_CREATE) && !old) in mpls_route_add()
395 rt = mpls_rt_alloc(cfg->rc_via_alen); in mpls_route_add()
399 rt->rt_labels = cfg->rc_output_labels; in mpls_route_add()
401 rt->rt_label[i] = cfg->rc_output_label[i]; in mpls_route_add()
402 rt->rt_protocol = cfg->rc_protocol; in mpls_route_add()
404 rt->rt_via_table = cfg->rc_via_table; in mpls_route_add()
405 memcpy(rt->rt_via, cfg->rc_via, cfg->rc_via_alen); in mpls_route_add()
407 mpls_route_update(net, index, NULL, rt, &cfg->rc_nlinfo); in mpls_route_add()
418 static int mpls_route_del(struct mpls_route_config *cfg) in mpls_route_del() argument
420 struct net *net = cfg->rc_nlinfo.nl_net; in mpls_route_del()
424 index = cfg->rc_label; in mpls_route_del()
434 mpls_route_update(net, index, NULL, NULL, &cfg->rc_nlinfo); in mpls_route_del()
676 struct mpls_route_config *cfg) in rtm_to_route_config() argument
689 memset(cfg, 0, sizeof(*cfg)); in rtm_to_route_config()
714 cfg->rc_label = LABEL_NOT_SPECIFIED; in rtm_to_route_config()
715 cfg->rc_protocol = rtm->rtm_protocol; in rtm_to_route_config()
716 cfg->rc_nlflags = nlh->nlmsg_flags; in rtm_to_route_config()
717 cfg->rc_nlinfo.portid = NETLINK_CB(skb).portid; in rtm_to_route_config()
718 cfg->rc_nlinfo.nlh = nlh; in rtm_to_route_config()
719 cfg->rc_nlinfo.nl_net = sock_net(skb->sk); in rtm_to_route_config()
728 cfg->rc_ifindex = nla_get_u32(nla); in rtm_to_route_config()
732 &cfg->rc_output_labels, in rtm_to_route_config()
733 cfg->rc_output_label)) in rtm_to_route_config()
740 &cfg->rc_label)) in rtm_to_route_config()
744 if (cfg->rc_label < 16) in rtm_to_route_config()
754 cfg->rc_via_alen = nla_len(nla) - in rtm_to_route_config()
756 if (cfg->rc_via_alen > MAX_VIA_ALEN) in rtm_to_route_config()
762 cfg->rc_via_table = NEIGH_LINK_TABLE; in rtm_to_route_config()
765 cfg->rc_via_table = NEIGH_ARP_TABLE; in rtm_to_route_config()
766 if (cfg->rc_via_alen != 4) in rtm_to_route_config()
770 cfg->rc_via_table = NEIGH_ND_TABLE; in rtm_to_route_config()
771 if (cfg->rc_via_alen != 16) in rtm_to_route_config()
779 memcpy(cfg->rc_via, via->rtvia_addr, cfg->rc_via_alen); in rtm_to_route_config()
795 struct mpls_route_config cfg; in mpls_rtm_delroute() local
798 err = rtm_to_route_config(skb, nlh, &cfg); in mpls_rtm_delroute()
802 return mpls_route_del(&cfg); in mpls_rtm_delroute()
808 struct mpls_route_config cfg; in mpls_rtm_newroute() local
811 err = rtm_to_route_config(skb, nlh, &cfg); in mpls_rtm_newroute()
815 return mpls_route_add(&cfg); in mpls_rtm_newroute()