/linux/security/selinux/ |
H A D | netif.c | 52 static inline u32 sel_netif_hashfn(const struct net *ns, int ifindex) in sel_netif_hashfn() argument 54 return (((uintptr_t)ns + ifindex) & (SEL_NETIF_HASH_SIZE - 1)); in sel_netif_hashfn() 68 int ifindex) in sel_netif_find() argument 70 u32 idx = sel_netif_hashfn(ns, ifindex); in sel_netif_find() 75 netif->nsec.ifindex == ifindex) in sel_netif_find() 97 idx = sel_netif_hashfn(netif->nsec.ns, netif->nsec.ifindex); in sel_netif_insert() 132 static int sel_netif_sid_slow(struct net *ns, int ifindex, u32 *sid) in sel_netif_sid_slow() argument 142 dev = dev_get_by_index(ns, ifindex); in sel_netif_sid_slow() 145 __func__, ifindex); in sel_netif_sid_slow() 150 netif = sel_netif_find(ns, ifindex); in sel_netif_sid_slow() [all …]
|
/linux/tools/testing/selftests/bpf/prog_tests/ |
H A D | tc_netkit.c | 37 static int create_netkit(int mode, int policy, int peer_policy, int *ifindex, in create_netkit() 72 *ifindex = if_nametoindex(netkit_name); in create_netkit() 74 ASSERT_GT(*ifindex, 0, "retrieve_ifindex"); in create_netkit() 184 int err, ifindex; in serial_test_tc_netkit_basic() 187 &ifindex, false, NETKIT_SCRUB_DEFAULT, in serial_test_tc_netkit_basic() 210 assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PRIMARY, 0); in serial_test_tc_netkit_basic() 211 assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PEER, 0); in serial_test_tc_netkit_basic() 216 link = bpf_program__attach_netkit(skel->progs.tc1, ifindex, &optl); in serial_test_tc_netkit_basic() 224 assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PRIMARY, 1); in serial_test_tc_netkit_basic() 225 assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PEE in serial_test_tc_netkit_basic() 35 create_netkit(int mode,int policy,int peer_policy,int * ifindex,bool same_netns) create_netkit() argument 151 int err, ifindex; serial_test_tc_netkit_basic() local 265 int err, ifindex; serial_test_tc_netkit_multi_links_target() local 393 int err, ifindex; serial_test_tc_netkit_multi_opts_target() local 507 int err, ifindex, ifindex2; serial_test_tc_netkit_device() local 618 int err, ifindex; serial_test_tc_netkit_neigh_links_target() local [all...] |
H A D | test_tunnel.c | 407 int key = 0, ifindex = -1; in test_vxlan_tunnel() local 422 ifindex = if_nametoindex(VXLAN_TUNL_DEV1); in test_vxlan_tunnel() 423 if (!ASSERT_NEQ(ifindex, 0, "vxlan11 ifindex")) in test_vxlan_tunnel() 425 tc_hook.ifindex = ifindex; in test_vxlan_tunnel() 436 ifindex = if_nametoindex("veth1"); in test_vxlan_tunnel() 437 if (!ASSERT_NEQ(ifindex, 0, "veth1 ifindex")) in test_vxlan_tunnel() 439 tc_hook.ifindex = ifindex; in test_vxlan_tunnel() 450 ifindex = if_nametoindex(VXLAN_TUNL_DEV0); in test_vxlan_tunnel() 451 if (!ASSERT_NEQ(ifindex, 0, "vxlan00 ifindex")) in test_vxlan_tunnel() 453 tc_hook.ifindex = ifindex; in test_vxlan_tunnel() [all …]
|
H A D | xdp_dev_bound_only.c | 8 static int load_dummy_prog(char *name, __u32 ifindex, __u32 flags) in load_dummy_prog() argument 14 opts.prog_ifindex = ifindex; in load_dummy_prog() 28 __u32 ifindex; in test_xdp_dev_bound_only_offdev() local 37 ifindex = if_nametoindex("eth42"); in test_xdp_dev_bound_only_offdev() 38 if (!ASSERT_NEQ(ifindex, 0, "if_nametoindex")) { in test_xdp_dev_bound_only_offdev() 42 fd1 = load_dummy_prog("dummy1", ifindex, BPF_F_XDP_DEV_BOUND_ONLY); in test_xdp_dev_bound_only_offdev() 50 fd2 = load_dummy_prog("dummy2", ifindex, 0); in test_xdp_dev_bound_only_offdev()
|
H A D | empty_skb.c | 24 int *ifindex; in test_empty_skb() member 37 .ifindex = &veth_ifindex, in test_empty_skb() 45 .ifindex = &ipip_ifindex, in test_empty_skb() 59 .ifindex = &veth_ifindex, in test_empty_skb() 73 .ifindex = &ipip_ifindex, in test_empty_skb() 84 .ifindex = &veth_ifindex, in test_empty_skb() 91 .ifindex = &ipip_ifindex, in test_empty_skb() 128 bpf_obj->bss->ifindex = *tests[i].ifindex; in test_empty_skb()
|
H A D | lwt_reroute.c | 190 int ifindex = -1; in test_lwt_reroute_normal_xmit() local 201 ifindex = if_nametoindex(tun_dev); in test_lwt_reroute_normal_xmit() 202 if (!ASSERT_GE(ifindex, 0, "if_nametoindex")) in test_lwt_reroute_normal_xmit() 205 snprintf(ip, 256, "10.0.0.%d", ifindex); in test_lwt_reroute_normal_xmit() 223 int ifindex = -1; in test_lwt_reroute_qdisc_dropped() local 232 ifindex = if_nametoindex(tun_dev); in test_lwt_reroute_qdisc_dropped() 233 if (!ASSERT_GE(ifindex, 0, "if_nametoindex")) in test_lwt_reroute_qdisc_dropped() 236 snprintf(ip, 256, "10.0.0.%d", ifindex); in test_lwt_reroute_qdisc_dropped()
|
/linux/tools/testing/selftests/bpf/progs/ |
H A D | test_check_mtu.c | 37 __u32 ifindex = 0; in xdp_use_helper() local 42 ifindex = GLOBAL_USER_IFINDEX; in xdp_use_helper() 44 if (bpf_check_mtu(ctx, ifindex, &mtu_len, delta, 0)) { in xdp_use_helper() 63 __u32 ifindex = GLOBAL_USER_IFINDEX; in xdp_exceed_mtu() local 73 err = bpf_check_mtu(ctx, ifindex, &mtu_len, delta, 0); in xdp_exceed_mtu() 90 __u32 ifindex = GLOBAL_USER_IFINDEX; in xdp_minus_delta() local 101 if (bpf_check_mtu(ctx, ifindex, &mtu_len, delta, 0)) in xdp_minus_delta() 114 __u32 ifindex = GLOBAL_USER_IFINDEX; in xdp_input_len() local 125 if (bpf_check_mtu(ctx, ifindex, &mtu_len, 0, 0)) in xdp_input_len() 136 __u32 ifindex = GLOBAL_USER_IFINDEX; in xdp_input_len_exceed() local [all …]
|
H A D | kfree_skb.c | 28 int ifindex; member 52 int ifindex; member 84 meta.ifindex = _(dev->ifindex); in BPF_PROG() 99 meta.ifindex, data, pkt_data); in BPF_PROG() 102 if (users != 1 || pkt_data != bpf_htons(0x86dd) || meta.ifindex != 1) in BPF_PROG() 121 int len, ifindex; in BPF_PROG() local 125 ifindex = dev->ifindex; in BPF_PROG() 129 if (len != 74 || ifindex != 1) in BPF_PROG() 139 int len, ifindex; in BPF_PROG() local 143 ifindex = dev->ifindex; in BPF_PROG() [all …]
|
H A D | empty_skb.c | 8 int ifindex; variable 14 ret = bpf_clone_redirect(skb, ifindex, BPF_F_INGRESS); in redirect_ingress() 21 ret = bpf_clone_redirect(skb, ifindex, 0); in redirect_egress() 28 ret = bpf_clone_redirect(skb, ifindex, BPF_F_INGRESS); in tc_redirect_ingress() 35 ret = bpf_clone_redirect(skb, ifindex, 0); in tc_redirect_egress()
|
/linux/tools/bpf/bpftool/ |
H A D | feature.c | 144 static int get_vendor_id(int ifindex) in get_vendor_id() argument 150 if (!if_indextoname(ifindex, ifname)) in get_vendor_id() 516 __u32 ifindex) in probe_prog_load_ifindex() argument 522 .prog_ifindex = ifindex, in probe_prog_load_ifindex() 534 static bool probe_prog_type_ifindex(enum bpf_prog_type prog_type, __u32 ifindex) in probe_prog_type_ifindex() argument 543 NULL, 0, ifindex); in probe_prog_type_ifindex() 548 bool *supported_types, const char *define_prefix, __u32 ifindex) in probe_prog_type() argument 555 if (ifindex) { in probe_prog_type() 564 res = probe_prog_type_ifindex(prog_type, ifindex); in probe_prog_type() 593 static bool probe_map_type_ifindex(enum bpf_map_type map_type, __u32 ifindex) in probe_map_type_ifindex() argument [all …]
|
H A D | net.c | 33 int ifindex; member 58 int ifindex; member 226 static int netlink_get_class(int sock, unsigned int nl_pid, int ifindex, in netlink_get_class() argument 237 .t.tcm_ifindex = ifindex, in netlink_get_class() 265 static int netlink_get_qdisc(int sock, unsigned int nl_pid, int ifindex, in netlink_get_qdisc() argument 276 .t.tcm_ifindex = ifindex, in netlink_get_qdisc() 304 static int netlink_get_filter(int sock, unsigned int nl_pid, int ifindex, int handle, in netlink_get_filter() argument 315 .t.tcm_ifindex = ifindex, in netlink_get_filter() 382 netinfo->devices[netinfo->used_len].ifindex = ifinfo->ifi_index; in dump_link_nlmsg() 433 filter_info->devname, filter_info->ifindex); in dump_filter_nlmsg() [all …]
|
/linux/tools/testing/selftests/drivers/net/ |
H A D | stats.py | 21 ethnl.pause_get({"header": {"dev-index": cfg.ifindex}}) 27 data = ethnl.pause_get({"header": {"dev-index": cfg.ifindex, 36 ethnl.fec_get({"header": {"dev-index": cfg.ifindex}}) 42 data = ethnl.fec_get({"header": {"dev-index": cfg.ifindex, 55 if qs["ifindex"]== test.ifindex: 75 rtstat = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64'] 93 for ifindex in ifindexes.keys(): 94 entry = netfam.qstats_get({"ifindex": ifindex}, dump=True) 106 for ifindex, triple in ifindexes.items(): 118 ifindex = entry["ifindex"] [all …]
|
/linux/net/l3mdev/ |
H A D | l3mdev.c | 81 int ifindex = -EINVAL; in l3mdev_ifindex_lookup_by_table_id() local 96 ifindex = lookup(net, table_id); in l3mdev_ifindex_lookup_by_table_id() 101 return ifindex; in l3mdev_ifindex_lookup_by_table_id() 112 int ifindex = 0; in l3mdev_master_ifindex_rcu() local 118 ifindex = dev->ifindex; in l3mdev_master_ifindex_rcu() 131 ifindex = master->ifindex; in l3mdev_master_ifindex_rcu() 134 return ifindex; in l3mdev_master_ifindex_rcu() 144 int l3mdev_master_upper_ifindex_by_index_rcu(struct net *net, int ifindex) in l3mdev_master_upper_ifindex_by_index_rcu() argument 148 dev = dev_get_by_index_rcu(net, ifindex); in l3mdev_master_upper_ifindex_by_index_rcu() 152 return dev ? dev->ifindex : 0; in l3mdev_master_upper_ifindex_by_index_rcu() [all …]
|
/linux/net/can/ |
H A D | bcm.c | 106 int ifindex; member 130 int ifindex; member 187 static char *bcm_proc_getifname(struct net *net, char *result, int ifindex) in bcm_proc_getifname() argument 191 if (!ifindex) in bcm_proc_getifname() 195 dev = dev_get_by_index_rcu(net, ifindex); in bcm_proc_getifname() 217 seq_printf(m, " / bound %s", bcm_proc_getifname(net, ifname, bo->ifindex)); in bcm_proc_show() 229 bcm_proc_getifname(net, ifname, op->ifindex)); in bcm_proc_show() 258 bcm_proc_getifname(net, ifname, op->ifindex)); in bcm_proc_show() 292 if (!op->ifindex) in bcm_can_tx() 295 dev = dev_get_by_index(sock_net(op->sk), op->ifindex); in bcm_can_tx() [all …]
|
/linux/tools/net/ynl/samples/ |
H A D | netdev.c | 24 if (!d->_present.ifindex) in netdev_print_device() 27 name = if_indextoname(d->ifindex, ifname); in netdev_print_device() 30 printf("[%d]\t", d->ifindex); in netdev_print_device() 67 int ifindex = 0; in main() local 70 ifindex = strtol(argv[1], NULL, 0); in main() 82 if (scanf("%d", &ifindex) != 1) { in main() 87 if (ifindex > 0) { in main() 92 netdev_dev_get_req_set_ifindex(req, ifindex); in main() 101 } else if (!ifindex) { in main() 111 } else if (ifindex == -2) { in main()
|
/linux/tools/testing/selftests/bpf/ |
H A D | xdp_redirect_multi.c | 45 static int get_mac_addr(unsigned int ifindex, void *mac_addr) in get_mac_addr() argument 55 if (!if_indextoname(ifindex, ifname)) in get_mac_addr() 93 unsigned int ifindex; in main() local 187 ifindex = ifaces[i]; in main() 190 ret = get_mac_addr(ifindex, mac_addr); in main() 192 printf("get interface %d mac failed\n", ifindex); in main() 195 ret = bpf_map_update_elem(mac_map, &ifindex, mac_addr, 0); in main() 203 devmap_val.ifindex = ifindex; in main() 205 ret = bpf_map_update_elem(group_all, &ifindex, &devmap_val, 0); in main() 212 ret = bpf_xdp_attach(ifindex, prog_fd, xdp_flags, NULL); in main() [all …]
|
H A D | xdp_synproxy.c | 19 static unsigned int ifindex; variable 34 .ifindex = ifindex, in cleanup() 49 err = bpf_xdp_attach(ifindex, -1, 0, NULL); in cleanup() 57 err = bpf_xdp_attach(ifindex, -1, XDP_FLAGS_REPLACE, &opts); in cleanup() 91 static void parse_options(int argc, char *argv[], unsigned int *ifindex, __u32 *prog_id, in parse_options() argument 114 *ifindex = 0; in parse_options() 133 *ifindex = if_nametoindex(optarg); in parse_options() 134 if (*ifindex == 0) in parse_options() 182 if (*ifindex != 0 && *prog_id != 0) in parse_options() 184 if (*ifindex == 0 && *prog_id == 0) in parse_options() [all …]
|
/linux/include/trace/events/ |
H A D | xdp.h | 39 __field(int, ifindex) 45 __entry->ifindex = dev->ifindex; 48 TP_printk("prog_id=%d action=%s ifindex=%d", 51 __entry->ifindex) 62 __field(int, ifindex) 70 __entry->ifindex = dev->ifindex; 77 TP_printk("ifindex=%d action=%s sent=%d drops=%d err=%d", 78 __entry->ifindex, [all...] |
/linux/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ |
H A D | int_port.c | 13 int ifindex; member 106 int ifindex, in mlx5e_int_port_lookup() argument 115 if (int_port->ifindex == ifindex && int_port->type == type) { in mlx5e_int_port_lookup() 125 int ifindex, enum mlx5e_tc_int_port_type type, in mlx5e_int_port_metadata_alloc() argument 128 u32 mapped_key[2] = {type, ifindex}; in mlx5e_int_port_metadata_alloc() 151 int ifindex, in mlx5e_int_port_add() argument 174 err = mlx5e_int_port_metadata_alloc(priv, ifindex, type, &match_metadata); in mlx5e_int_port_add() 177 ifindex); in mlx5e_int_port_add() 190 int_port->ifindex = ifindex; in mlx5e_int_port_add() 265 int ifindex, in mlx5e_tc_int_port_get() argument [all …]
|
/linux/tools/lib/bpf/ |
H A D | netlink.c | 40 int ifindex; member 47 int ifindex; member 286 static int __bpf_set_link_xdp_fd_replace(int ifindex, int fd, int old_fd, in __bpf_set_link_xdp_fd_replace() argument 298 req.ifinfo.ifi_index = ifindex; in __bpf_set_link_xdp_fd_replace() 322 int bpf_xdp_attach(int ifindex, int prog_fd, __u32 flags, const struct bpf_xdp_attach_opts *opts) in bpf_xdp_attach() argument 335 err = __bpf_set_link_xdp_fd_replace(ifindex, prog_fd, old_prog_fd, flags); in bpf_xdp_attach() 339 int bpf_xdp_detach(int ifindex, __u32 flags, const struct bpf_xdp_attach_opts *opts) in bpf_xdp_detach() argument 341 return bpf_xdp_attach(ifindex, -1, flags, opts); in bpf_xdp_detach() 367 if (xdp_id->ifindex && xdp_id->ifindex != ifinfo->ifi_index) in get_xdp_info() 412 __u32 ifindex; in parse_xdp_features() local [all …]
|
/linux/drivers/net/vxlan/ |
H A D | vxlan_multicast.c | 21 int ifindex = (rifindex ? : vxlan->default_dst.remote_ifindex); in vxlan_igmp_join() local 29 .imr_ifindex = ifindex, in vxlan_igmp_join() 42 ret = ipv6_stub->ipv6_sock_mc_join(sk, ifindex, in vxlan_igmp_join() 55 int ifindex = (rifindex ? : vxlan->default_dst.remote_ifindex); in vxlan_igmp_leave() local 63 .imr_ifindex = ifindex, in vxlan_igmp_leave() 76 ret = ipv6_stub->ipv6_sock_mc_drop(sk, ifindex, in vxlan_igmp_leave() 85 static bool vxlan_group_used_match(union vxlan_addr *ip, int ifindex, in vxlan_group_used_match() argument 94 if (rifindex != ifindex) in vxlan_group_used_match() 101 union vxlan_addr *ip, int ifindex) in vxlan_group_used_by_vnifilter() argument 106 if (vxlan_group_used_match(ip, ifindex, in vxlan_group_used_by_vnifilter() [all …]
|
/linux/samples/bpf/ |
H A D | xdp_adjust_tail_user.c | 27 static int ifindex = -1; variable 35 if (ifindex > -1) { in int_exit() 36 if (bpf_xdp_query_id(ifindex, xdp_flags, &curr_prog_id)) { in int_exit() 41 bpf_xdp_detach(ifindex, xdp_flags, NULL); in int_exit() 105 ifindex = if_nametoindex(optarg); in main() 106 if (!ifindex) in main() 107 ifindex = atoi(optarg); in main() 142 if (!ifindex) { in main() 182 if (bpf_xdp_attach(ifindex, prog_fd, xdp_flags, NULL) < 0) { in main()
|
/linux/drivers/net/netdevsim/ |
H A D | hwstats.c | 57 int ifindex) in nsim_dev_hwslist_find_hwsdev() argument 62 if (hwsdev->netdev->ifindex == ifindex) in nsim_dev_hwslist_find_hwsdev() 121 hwsdev = nsim_dev_hwslist_find_hwsdev(hwsdev_list, dev->ifindex); in nsim_dev_hwstats_event_off_xstats() 163 hwsdev = nsim_dev_hwslist_find_hwsdev(hwsdev_list, dev->ifindex); in __nsim_dev_hwstats_event_unregister() 216 int ifindex, in nsim_dev_hwstats_enable_ifindex() argument 232 hwsdev = nsim_dev_hwslist_find_hwsdev(hwsdev_list, ifindex); in nsim_dev_hwstats_enable_ifindex() 236 netdev = dev_get_by_index(net, ifindex); in nsim_dev_hwstats_enable_ifindex() 272 int ifindex, in nsim_dev_hwstats_disable_ifindex() argument 281 hwsdev = nsim_dev_hwslist_find_hwsdev(hwsdev_list, ifindex); in nsim_dev_hwstats_disable_ifindex() 305 int ifindex, in nsim_dev_hwstats_fail_ifindex() argument [all …]
|
/linux/net/core/ |
H A D | netdev-genl.c | 19 unsigned long ifindex; member 57 if (nla_put_u32(rsp, NETDEV_A_DEV_IFINDEX, netdev->ifindex) || in netdev_nl_dev_fill() 110 u32 ifindex; in netdev_nl_dev_get_doit() local 116 ifindex = nla_get_u32(info->attrs[NETDEV_A_DEV_IFINDEX]); in netdev_nl_dev_get_doit() 124 netdev = __dev_get_by_index(genl_info_net(info), ifindex); in netdev_nl_dev_get_doit() 150 for_each_netdev_dump(net, netdev, ctx->ifindex) { in netdev_nl_dev_get_dumpit() 183 if (nla_put_u32(rsp, NETDEV_A_NAPI_IFINDEX, napi->dev->ifindex)) in netdev_nl_napi_fill_one() 288 u32 ifindex = 0; in netdev_nl_napi_get_dumpit() local 292 ifindex = nla_get_u32(info->attrs[NETDEV_A_NAPI_IFINDEX]); in netdev_nl_napi_get_dumpit() 295 if (ifindex) { in netdev_nl_napi_get_dumpit() [all …]
|
/linux/net/phonet/ |
H A D | pn_netlink.c | 22 static int fill_addr(struct sk_buff *skb, u32 ifindex, u8 addr, 25 void phonet_address_notify(struct net *net, int event, u32 ifindex, u8 addr) in phonet_address_notify() argument 35 err = fill_addr(skb, ifindex, addr, 0, 0, event); in phonet_address_notify() 102 static int fill_addr(struct sk_buff *skb, u32 ifindex, u8 addr, in fill_addr() argument 117 ifm->ifa_index = ifindex; in fill_addr() 155 err = fill_addr(skb, READ_ONCE(pnd->netdev->ifindex), in getaddr_dumpit() 173 static int fill_route(struct sk_buff *skb, u32 ifindex, u8 dst, in fill_route() argument 193 if (nla_put_u8(skb, RTA_DST, dst) || nla_put_u32(skb, RTA_OIF, ifindex)) in fill_route() 203 void rtm_phonet_notify(struct net *net, int event, u32 ifindex, u8 dst) in rtm_phonet_notify() argument 213 err = fill_route(skb, ifindex, dst, 0, 0, event); in rtm_phonet_notify() [all …]
|