/freebsd/lib/libifconfig/ |
H A D | libifconfig.c | 169 struct ifreq ifr; in ifconfig_get_description() local 175 memset(&ifr, 0, sizeof(ifr)); in ifconfig_get_description() 176 (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); in ifconfig_get_description() 185 ifr.ifr_buffer.buffer = descr; in ifconfig_get_description() 186 ifr.ifr_buffer.length = descrlen; in ifconfig_get_description() 187 if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR, &ifr) != 0) { in ifconfig_get_description() 192 if (ifr.ifr_buffer.buffer == descr) { in ifconfig_get_description() 205 } else if (ifr.ifr_buffer.length > descrlen) { in ifconfig_get_description() 206 descrlen = ifr.ifr_buffer.length; in ifconfig_get_description() 221 struct ifreq ifr; in ifconfig_set_description() local [all …]
|
/freebsd/contrib/wpa/src/drivers/ |
H A D | linux_ioctl.c | 21 struct ifreq ifr; in linux_set_iface_flags() local 27 os_memset(&ifr, 0, sizeof(ifr)); in linux_set_iface_flags() 28 os_strlcpy(ifr.ifr_name, ifname, IFNAMSIZ); in linux_set_iface_flags() 30 if (ioctl(sock, SIOCGIFFLAGS, &ifr) != 0) { in linux_set_iface_flags() 38 if (ifr.ifr_flags & IFF_UP) in linux_set_iface_flags() 40 ifr.ifr_flags |= IFF_UP; in linux_set_iface_flags() 42 if (!(ifr.ifr_flags & IFF_UP)) in linux_set_iface_flags() 44 ifr.ifr_flags &= ~IFF_UP; in linux_set_iface_flags() 47 if (ioctl(sock, SIOCSIFFLAGS, &ifr) != 0) { in linux_set_iface_flags() 61 struct ifreq ifr; in linux_iface_up() local [all …]
|
H A D | driver_wired_common.c | 35 struct ifreq ifr; in driver_wired_get_ifflags() local 44 os_memset(&ifr, 0, sizeof(ifr)); in driver_wired_get_ifflags() 45 os_strlcpy(ifr.ifr_name, ifname, IFNAMSIZ); in driver_wired_get_ifflags() 46 if (ioctl(s, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) { in driver_wired_get_ifflags() 53 *flags = ifr.ifr_flags & 0xffff; in driver_wired_get_ifflags() 60 struct ifreq ifr; in driver_wired_set_ifflags() local 69 os_memset(&ifr, 0, sizeof(ifr)); in driver_wired_set_ifflags() 70 os_strlcpy(ifr.ifr_name, ifname, IFNAMSIZ); in driver_wired_set_ifflags() 71 ifr.ifr_flags = flags & 0xffff; in driver_wired_set_ifflags() 72 if (ioctl(s, SIOCSIFFLAGS, (caddr_t) &ifr) < 0) { in driver_wired_set_ifflags() [all …]
|
H A D | driver_wired.c | 171 struct ifreq ifr; in wired_init_sockets() local 189 os_memset(&ifr, 0, sizeof(ifr)); in wired_init_sockets() 190 os_strlcpy(ifr.ifr_name, drv->common.ifname, sizeof(ifr.ifr_name)); in wired_init_sockets() 191 if (ioctl(drv->common.sock, SIOCGIFINDEX, &ifr) != 0) { in wired_init_sockets() 199 addr.sll_ifindex = ifr.ifr_ifindex; in wired_init_sockets() 210 if (wired_multicast_membership(drv->common.sock, ifr.ifr_ifindex, in wired_init_sockets() 217 os_memset(&ifr, 0, sizeof(ifr)); in wired_init_sockets() 218 os_strlcpy(ifr.ifr_name, drv->common.ifname, sizeof(ifr.ifr_name)); in wired_init_sockets() 219 if (ioctl(drv->common.sock, SIOCGIFHWADDR, &ifr) != 0) { in wired_init_sockets() 225 if (ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) { in wired_init_sockets() [all …]
|
H A D | driver_nl80211_android.c | 45 struct ifreq ifr; in android_priv_cmd() local 50 os_memset(&ifr, 0, sizeof(ifr)); in android_priv_cmd() 52 os_strlcpy(ifr.ifr_name, bss->ifname, IFNAMSIZ); in android_priv_cmd() 60 ifr.ifr_data = &priv_cmd; in android_priv_cmd() 62 ret = ioctl(drv->global->ioctl_sock, SIOCDEVPRIVATE + 1, &ifr); in android_priv_cmd() 79 struct ifreq ifr; in android_pno_start() local 123 memset(&ifr, 0, sizeof(ifr)); in android_pno_start() 125 os_strlcpy(ifr.ifr_name, bss->ifname, IFNAMSIZ); in android_pno_start() 130 ifr.ifr_data = &priv_cmd; in android_pno_start() 132 ret = ioctl(drv->global->ioctl_sock, SIOCDEVPRIVATE + 1, &ifr); in android_pno_start()
|
/freebsd/sbin/ifconfig/ |
H A D | iffib.c | 49 struct ifreq ifr; in fib_status() local 51 memset(&ifr, 0, sizeof(ifr)); in fib_status() 52 strlcpy(ifr.ifr_name, ctx->ifname, sizeof(ifr.ifr_name)); in fib_status() 53 if (ioctl_ctx(ctx, SIOCGIFFIB, (caddr_t)&ifr) == 0 && in fib_status() 54 ifr.ifr_fib != RT_DEFAULT_FIB) in fib_status() 55 printf("\tfib: %u\n", ifr.ifr_fib); in fib_status() 57 memset(&ifr, 0, sizeof(ifr)); in fib_status() 58 strlcpy(ifr.ifr_name, ctx->ifname, sizeof(ifr.ifr_name)); in fib_status() 59 if (ioctl_ctx(ctx, SIOCGTUNFIB, (caddr_t)&ifr) == 0 && in fib_status() 60 ifr.ifr_fib != RT_DEFAULT_FIB) in fib_status() [all …]
|
H A D | ifmac.c | 55 struct ifreq ifr; in maclabel_status() local 59 memset(&ifr, 0, sizeof(ifr)); in maclabel_status() 60 strlcpy(ifr.ifr_name, ctx->ifname, sizeof(ifr.ifr_name)); in maclabel_status() 64 ifr.ifr_ifru.ifru_data = (void *)label; in maclabel_status() 65 if (ioctl_ctx(ctx, SIOCGIFMAC, &ifr) == -1) in maclabel_status() 83 struct ifreq ifr; in setifmaclabel() local 92 memset(&ifr, 0, sizeof(ifr)); in setifmaclabel() 93 strlcpy(ifr.ifr_name, ctx->ifname, sizeof(ifr.ifr_name)); in setifmaclabel() 94 ifr.ifr_ifru.ifru_data = (void *)label; in setifmaclabel() 96 error = ioctl(ctx->io_s, SIOCSIFMAC, &ifr); in setifmaclabel()
|
H A D | ifvlan.c | 78 struct ifreq ifr = { .ifr_data = (caddr_t)&vreq }; in vlan_status() local 80 if (ioctl_ctx_ifr(ctx, SIOCGETVLAN, &ifr) == -1) in vlan_status() 94 if (ioctl_ctx_ifr(ctx, SIOCGVLANPCP, &ifr) != -1) in vlan_status() 95 printf(" vlanpcp: %u", ifr.ifr_vlan_pcp); in vlan_status() 149 vlan_create(if_ctx *ctx, struct ifreq *ifr) in vlan_create() argument 151 vlan_parse_ethervid(ifr->ifr_name); in vlan_create() 163 ifr->ifr_data = (caddr_t) ¶ms; in vlan_create() 165 ifcreate_ioctl(ctx, ifr); in vlan_create() 176 vlan_set(int s, struct ifreq *ifr) in vlan_set() argument 181 ifr->ifr_data = (caddr_t) ¶ms; in vlan_set() [all …]
|
H A D | ifconfig.c | 192 ifr_set_name(struct ifreq *ifr, const char *name) in ifr_set_name() argument 194 strlcpy(ifr->ifr_name, name, sizeof(ifr->ifr_name)); in ifr_set_name() 198 ioctl_ctx_ifr(if_ctx *ctx, unsigned long cmd, struct ifreq *ifr) in ioctl_ctx_ifr() argument 200 ifr_set_name(ifr, ctx->ifname); in ioctl_ctx_ifr() 201 return (ioctl_ctx(ctx, cmd, ifr)); in ioctl_ctx_ifr() 205 ifcreate_ioctl(if_ctx *ctx, struct ifreq *ifr) in ifcreate_ioctl() argument 209 strlcpy(ifname_orig, ifr->ifr_name, sizeof(ifname_orig)); in ifcreate_ioctl() 211 if (ioctl(ctx->io_s, SIOCIFCREATE2, ifr) < 0) { in ifcreate_ioctl() 214 errx(1, "interface %s already exists", ifr->ifr_name); in ifcreate_ioctl() 216 err(1, "SIOCIFCREATE2 (%s)", ifr->ifr_name); in ifcreate_ioctl() [all …]
|
H A D | af_link.c | 101 struct ifreq ifr = {}; in print_pcp() local 103 if (ioctl_ctx_ifr(ctx, SIOCGLANPCP, &ifr) == 0 && in print_pcp() 104 ifr.ifr_lan_pcp != IFNET_PCP_NONE) in print_pcp() 105 printf("\tpcp %d\n", ifr.ifr_lan_pcp); in print_pcp() 114 struct ifreq ifr; in link_status() local 137 strncpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name)); in link_status() 138 memcpy(&ifr.ifr_addr, ifa->ifa_addr, sizeof(ifa->ifa_addr->sa_len)); in link_status() 139 ifr.ifr_addr.sa_family = AF_LOCAL; in link_status() 144 rc = ioctl(sock_hw, SIOCGHWADDR, &ifr); in link_status() 153 if (memcmp(ifr.ifr_addr.sa_data, laggaddr, sdl->sdl_alen) == 0 || in link_status() [all …]
|
H A D | ifclone.c | 118 struct ifreq ifr = {}; in ifclonecreate() local 121 strlcpy(ifr.ifr_name, ctx->ifname, sizeof(ifr.ifr_name)); in ifclonecreate() 126 dcp->ifmatch(ifr.ifr_name) != 0) in ifclonecreate() 134 strncmp(dcp->ifprefix, ifr.ifr_name, in ifclonecreate() 142 ifcreate_ioctl(ctx, &ifr); in ifclonecreate() 144 dcp->clone_cb(ctx, &ifr); in ifclonecreate() 157 struct ifreq ifr = {}; in clone_destroy() local 159 if (ioctl_ctx_ifr(ctx, SIOCIFDESTROY, &ifr) < 0) in clone_destroy()
|
/freebsd/tools/tools/ath/common/ |
H A D | ctrl.c | 141 struct ifreq ifr; in ath_driver_req_zero_stats() local 145 bzero(&ifr, sizeof(ifr)); in ath_driver_req_zero_stats() 146 strncpy(ifr.ifr_name, req->ifname, sizeof (ifr.ifr_name)); in ath_driver_req_zero_stats() 147 ifr.ifr_data = NULL; in ath_driver_req_zero_stats() 150 ret = ioctl(req->s, SIOCZATHSTATS, &ifr); in ath_driver_req_zero_stats() 162 struct ifreq ifr; in ath_driver_req_fetch_stats() local 166 bzero(&ifr, sizeof(ifr)); in ath_driver_req_fetch_stats() 167 strncpy(ifr.ifr_name, req->ifname, sizeof (ifr.ifr_name)); in ath_driver_req_fetch_stats() 168 ifr.ifr_data = (caddr_t) st; in ath_driver_req_fetch_stats() 171 ret = ioctl(req->s, SIOCGATHSTATS, &ifr); in ath_driver_req_fetch_stats() [all …]
|
/freebsd/sbin/ipf/libipf/ |
H A D | printfraginfo.c | 14 printfraginfo(char *prefix, struct ipfr *ifr) in printfraginfo() argument 19 if (ifr->ipfr_v == 6) { in printfraginfo() 27 PRINTF(" %s -> ", hostname(family, &ifr->ipfr_src)); in printfraginfo() 29 hostname(family, &ifr->ipfr_dst), ifr->ipfr_id, in printfraginfo() 30 ifr->ipfr_ttl, ifr->ipfr_p, ifr->ipfr_pkts, ifr->ipfr_bytes, in printfraginfo() 31 ifr->ipfr_seen0, ifr->ipfr_ref); in printfraginfo()
|
/freebsd/usr.sbin/bluetooth/btpand/ |
H A D | tap.c | 57 struct ifreq ifr; in tap_init() local 67 memset(&ifr, 0, sizeof(ifr)); in tap_init() 68 if (ioctl(fd, TAPGIFNAME, &ifr) == -1) { in tap_init() 79 ifr.ifr_addr.sa_family = AF_LINK; in tap_init() 80 ifr.ifr_addr.sa_len = ETHER_ADDR_LEN; in tap_init() 81 b2eaddr(ifr.ifr_addr.sa_data, &local_bdaddr); in tap_init() 83 if (ioctl(s, SIOCSIFLLADDR, &ifr) == -1) { in tap_init() 84 log_err("Could not set %s physical address: %m", ifr.ifr_name); in tap_init() 88 if (ioctl(s, SIOCGIFFLAGS, &ifr) == -1) { in tap_init() 93 if ((ifr.ifr_flags & IFF_UP) == 0) { in tap_init() [all …]
|
/freebsd/tools/regression/netinet/msocket_ifnet_remove/ |
H A D | msocket_ifnet_remove.c | 71 struct ifreq ifr; in disc_setup() local 90 bzero(&ifr, sizeof(ifr)); in disc_setup() 91 snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s%d", DISC_IFNAME, in disc_setup() 94 if (ioctl(s, SIOCIFCREATE, &ifr) < 0) { in disc_setup() 95 warn("disc_setup: ioctl(%s, SIOCIFCREATE)", ifr.ifr_name); in disc_setup() 107 struct ifreq ifr; in disc_done() local 116 bzero(&ifr, sizeof(ifr)); in disc_done() 117 snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s%d", DISC_IFNAME, in disc_done() 120 if (ioctl(s, SIOCIFDESTROY, &ifr) < 0) in disc_done() 121 warn("disc_done: ioctl(%s, SIOCIFDESTROY)", ifr.ifr_name); in disc_done()
|
/freebsd/crypto/openssh/openbsd-compat/ |
H A D | port-net.c | 146 struct ifreq ifr; in sys_tun_open() local 158 bzero(&ifr, sizeof(ifr)); in sys_tun_open() 161 ifr.ifr_flags = IFF_TAP; in sys_tun_open() 164 ifr.ifr_flags = IFF_TUN; in sys_tun_open() 167 ifr.ifr_flags |= IFF_NO_PI; in sys_tun_open() 175 snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), name, tun); in sys_tun_open() 178 if (ioctl(fd, TUNSETIFF, &ifr) == -1) { in sys_tun_open() 187 debug("%s: %s mode %d fd %d", __func__, ifr.ifr_name, mode, fd); in sys_tun_open() 189 if (ifname != NULL && (*ifname = strdup(ifr.ifr_name)) == NULL) in sys_tun_open() 211 struct ifreq ifr; in sys_tun_open() local [all …]
|
/freebsd/tests/sys/net/ |
H A D | if_epair.c | 51 struct ifreq ifr; in ATF_TC_BODY() local 61 bzero(&ifr, sizeof(ifr)); in ATF_TC_BODY() 62 ifr.ifr_data = (caddr_t)-1; in ATF_TC_BODY() 63 (void) strlcpy(ifr.ifr_name, "epair", sizeof(ifr.ifr_name)); in ATF_TC_BODY() 65 if (ioctl(s, SIOCIFCREATE2, &ifr) < 0) in ATF_TC_BODY() 68 if (ioctl(s, SIOCIFDESTROY, &ifr) < 0) in ATF_TC_BODY()
|
/freebsd/tests/sys/net/if_ovpn/ |
H A D | if_ovpn_c.c | 40 struct ifreq ifr; in create_interface() local 42 bzero(&ifr, sizeof(ifr)); in create_interface() 45 snprintf(ifr.ifr_name, IFNAMSIZ, "ovpn"); in create_interface() 46 ret = ioctl(fd, SIOCIFCREATE2, &ifr); in create_interface() 50 snprintf(ovpn_ifname, IFNAMSIZ, "%s", ifr.ifr_name); in create_interface() 60 struct ifreq ifr; in destroy_interface() local 67 bzero(&ifr, sizeof(ifr)); in destroy_interface() 68 snprintf(ifr.ifr_name, IFNAMSIZ, "%s", ovpn_ifname); in destroy_interface() 70 ret = ioctl(fd, SIOCIFDESTROY, &ifr); in destroy_interface()
|
/freebsd/usr.sbin/traceroute/ |
H A D | ifaddrlist.c | 71 struct ifreq ibuf[(32 * 1024) / sizeof(struct ifreq)], ifr; in ifaddrlist() local 74 char device[sizeof(ifr.ifr_name) + 1]; in ifaddrlist() 115 strncpy(ifr.ifr_name, ifrp->ifr_name, sizeof(ifr.ifr_name)); in ifaddrlist() 116 if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifr) < 0) { in ifaddrlist() 120 (int)sizeof(ifr.ifr_name), ifr.ifr_name, in ifaddrlist() 127 if ((ifr.ifr_flags & IFF_UP) == 0) in ifaddrlist() 131 (void)strlcpy(device, ifr.ifr_name, sizeof(device)); in ifaddrlist() 137 if (ioctl(fd, SIOCGIFADDR, (char *)&ifr) < 0) { in ifaddrlist() 150 sin = (struct sockaddr_in *)&ifr.ifr_addr; in ifaddrlist()
|
/freebsd/contrib/wpa/src/ap/ |
H A D | vlan_ifconfig.c | 22 struct ifreq ifr; in ifconfig_helper() local 30 os_memset(&ifr, 0, sizeof(ifr)); in ifconfig_helper() 31 os_strlcpy(ifr.ifr_name, if_name, IFNAMSIZ); in ifconfig_helper() 33 if (ioctl(fd, SIOCGIFFLAGS, &ifr) != 0) { in ifconfig_helper() 42 ifr.ifr_flags |= IFF_UP; in ifconfig_helper() 44 ifr.ifr_flags &= ~IFF_UP; in ifconfig_helper() 46 if (ioctl(fd, SIOCSIFFLAGS, &ifr) != 0) { in ifconfig_helper()
|
/freebsd/contrib/netbsd-tests/net/bpf/ |
H A D | t_bpf.c | 79 struct ifreq ifr; in ATF_TC_BODY() local 84 sprintf(ifr.ifr_name, "shmif%d", ifnum); in ATF_TC_BODY() 87 RL(rump_sys_ioctl(bpfd, BIOCSETIF, &ifr)); in ATF_TC_BODY() 88 RL(rump_sys_ioctl(bpfd, BIOCSFEEDBACK, &ifr)); in ATF_TC_BODY() 109 struct ifreq ifr; in ATF_TC_BODY() local 116 memset(&ifr, 0, sizeof(ifr)); in ATF_TC_BODY() 156 netcfg_rump_makeshmif("bpfwritetrunc", ifr.ifr_name); in ATF_TC_BODY() 157 netcfg_rump_if(ifr.ifr_name, "10.1.1.1", "255.0.0.0"); in ATF_TC_BODY() 160 RL(rump_sys_ioctl(bpfd, BIOCSETIF, &ifr)); in ATF_TC_BODY() 179 struct ifreq ifr; in ATF_TC_BODY() local [all …]
|
/freebsd/usr.sbin/rtsold/ |
H A D | if.c | 93 struct ifreq ifr; in interface_up() local 98 memset(&ifr, 0, sizeof(ifr)); in interface_up() 99 strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); in interface_up() 103 if (ioctl(ifsock, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) { in interface_up() 108 if (!(ifr.ifr_flags & IFF_UP)) { in interface_up() 109 ifr.ifr_flags |= IFF_UP; in interface_up() 110 if (ioctl(ifsock, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) in interface_up() 191 struct ifreq ifr; in interface_status() local 195 memset(&ifr, 0, sizeof(ifr)); in interface_status() 196 strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); in interface_status() [all …]
|
/freebsd/lib/libc/net/ |
H A D | if_nametoindex.c | 66 struct ifreq ifr; in if_nametoindex() local 72 memset(&ifr, 0, sizeof(ifr)); in if_nametoindex() 73 strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); in if_nametoindex() 74 if (_ioctl(s, SIOCGIFINDEX, &ifr) != -1) { in if_nametoindex() 76 return (ifr.ifr_index); in if_nametoindex()
|
/freebsd/sbin/ipf/ipsend/ |
H A D | sockraw.c | 37 struct ifreq ifr; in initdevice() local 40 memset(&ifr, 0, sizeof(ifr)); in initdevice() 41 strncpy(ifr.ifr_name, device, sizeof ifr.ifr_name); in initdevice() 49 if (ioctl(fd, SIOCGIFADDR, &ifr) == -1) in initdevice() 57 bcopy(&ifr.ifr_addr, s.sa_data, 4); in initdevice()
|
H A D | snit.c | 60 struct ifreq ifr; in initdevice() local 94 strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); in initdevice() 95 ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = ' '; in initdevice() 97 si.ic_len = sizeof(ifr); in initdevice() 98 si.ic_dp = (char*)𝔦 in initdevice() 101 perror(ifr.ifr_name); in initdevice()
|