Lines Matching refs:slwt
39 int (*input)(struct sk_buff *skb, struct seg6_local_lwt *slwt);
219 static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)
239 static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt)
249 seg6_lookup_nexthop(skb, &slwt->nh6, 0);
258 static int input_action_end_t(struct sk_buff *skb, struct seg6_local_lwt *slwt)
268 seg6_lookup_nexthop(skb, NULL, slwt->table);
279 struct seg6_local_lwt *slwt)
301 odev = dev_get_by_index_rcu(net, slwt->oif);
336 struct seg6_local_lwt *slwt)
353 * If slwt->nh6 is set to ::, then lookup the nexthop for the
357 if (!ipv6_addr_any(&slwt->nh6))
358 nhaddr = &slwt->nh6;
371 struct seg6_local_lwt *slwt)
387 nhaddr = slwt->nh4.s_addr ?: iph->daddr;
405 struct seg6_local_lwt *slwt)
415 seg6_lookup_any_nexthop(skb, NULL, slwt->table, true);
425 static int input_action_end_b6(struct sk_buff *skb, struct seg6_local_lwt *slwt)
434 err = seg6_do_srh_inline(skb, slwt->srh);
451 struct seg6_local_lwt *slwt)
465 err = seg6_do_srh_encap(skb, slwt->srh, IPPROTO_IPV6);
506 struct seg6_local_lwt *slwt)
530 ret = bpf_prog_run_save_cb(slwt->bpf.prog, skb);
633 struct seg6_local_lwt *slwt;
640 slwt = seg6_local_lwtunnel(orig_dst->lwtstate);
641 desc = slwt->desc;
643 return desc->input(skb, slwt);
659 static int parse_nla_srh(struct nlattr **attrs, struct seg6_local_lwt *slwt)
674 slwt->srh = kmemdup(srh, len, GFP_KERNEL);
675 if (!slwt->srh)
678 slwt->headroom += len;
683 static int put_nla_srh(struct sk_buff *skb, struct seg6_local_lwt *slwt)
689 srh = slwt->srh;
711 static int parse_nla_table(struct nlattr **attrs, struct seg6_local_lwt *slwt)
713 slwt->table = nla_get_u32(attrs[SEG6_LOCAL_TABLE]);
718 static int put_nla_table(struct sk_buff *skb, struct seg6_local_lwt *slwt)
720 if (nla_put_u32(skb, SEG6_LOCAL_TABLE, slwt->table))
734 static int parse_nla_nh4(struct nlattr **attrs, struct seg6_local_lwt *slwt)
736 memcpy(&slwt->nh4, nla_data(attrs[SEG6_LOCAL_NH4]),
742 static int put_nla_nh4(struct sk_buff *skb, struct seg6_local_lwt *slwt)
750 memcpy(nla_data(nla), &slwt->nh4, sizeof(struct in_addr));
760 static int parse_nla_nh6(struct nlattr **attrs, struct seg6_local_lwt *slwt)
762 memcpy(&slwt->nh6, nla_data(attrs[SEG6_LOCAL_NH6]),
768 static int put_nla_nh6(struct sk_buff *skb, struct seg6_local_lwt *slwt)
776 memcpy(nla_data(nla), &slwt->nh6, sizeof(struct in6_addr));
786 static int parse_nla_iif(struct nlattr **attrs, struct seg6_local_lwt *slwt)
788 slwt->iif = nla_get_u32(attrs[SEG6_LOCAL_IIF]);
793 static int put_nla_iif(struct sk_buff *skb, struct seg6_local_lwt *slwt)
795 if (nla_put_u32(skb, SEG6_LOCAL_IIF, slwt->iif))
809 static int parse_nla_oif(struct nlattr **attrs, struct seg6_local_lwt *slwt)
811 slwt->oif = nla_get_u32(attrs[SEG6_LOCAL_OIF]);
816 static int put_nla_oif(struct sk_buff *skb, struct seg6_local_lwt *slwt)
818 if (nla_put_u32(skb, SEG6_LOCAL_OIF, slwt->oif))
839 static int parse_nla_bpf(struct nlattr **attrs, struct seg6_local_lwt *slwt)
855 slwt->bpf.name = nla_memdup(tb[SEG6_LOCAL_BPF_PROG_NAME], GFP_KERNEL);
856 if (!slwt->bpf.name)
862 kfree(slwt->bpf.name);
866 slwt->bpf.prog = p;
870 static int put_nla_bpf(struct sk_buff *skb, struct seg6_local_lwt *slwt)
874 if (!slwt->bpf.prog)
881 if (nla_put_u32(skb, SEG6_LOCAL_BPF_PROG, slwt->bpf.prog->aux->id))
884 if (slwt->bpf.name &&
885 nla_put_string(skb, SEG6_LOCAL_BPF_PROG_NAME, slwt->bpf.name))
903 int (*parse)(struct nlattr **attrs, struct seg6_local_lwt *slwt);
904 int (*put)(struct sk_buff *skb, struct seg6_local_lwt *slwt);
939 static int parse_nla_action(struct nlattr **attrs, struct seg6_local_lwt *slwt)
945 desc = __get_action_desc(slwt->action);
952 slwt->desc = desc;
953 slwt->headroom += desc->static_headroom;
962 err = param->parse(attrs, slwt);
978 struct seg6_local_lwt *slwt;
993 newts = lwtunnel_state_alloc(sizeof(*slwt));
997 slwt = seg6_local_lwtunnel(newts);
998 slwt->action = nla_get_u32(tb[SEG6_LOCAL_ACTION]);
1000 err = parse_nla_action(tb, slwt);
1006 newts->headroom = slwt->headroom;
1013 kfree(slwt->srh);
1020 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt);
1022 kfree(slwt->srh);
1024 if (slwt->desc->attrs & (1 << SEG6_LOCAL_BPF)) {
1025 kfree(slwt->bpf.name);
1026 bpf_prog_put(slwt->bpf.prog);
1035 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt);
1039 if (nla_put_u32(skb, SEG6_LOCAL_ACTION, slwt->action))
1043 if (slwt->desc->attrs & (1 << i)) {
1045 err = param->put(skb, slwt);
1056 struct seg6_local_lwt *slwt = seg6_local_lwtunnel(lwt);
1062 attrs = slwt->desc->attrs;
1065 nlsize += nla_total_size((slwt->srh->hdrlen + 1) << 3);