Lines Matching defs:ctx

96 static void list_interfaces_ioctl(if_ctx *ctx);
97 static void status(if_ctx *ctx, const struct sockaddr_dl *sdl,
183 ifname_update(if_ctx *ctx, const char *name)
185 strlcpy(ctx->_ifname_storage_ioctl, name, sizeof(ctx->_ifname_storage_ioctl));
186 ctx->ifname = ctx->_ifname_storage_ioctl;
198 ioctl_ctx_ifr(if_ctx *ctx, unsigned long cmd, struct ifreq *ifr)
200 ifr_set_name(ifr, ctx->ifname);
201 return (ioctl_ctx(ctx, cmd, ifr));
205 ifcreate_ioctl(if_ctx *ctx, struct ifreq *ifr)
211 if (ioctl(ctx->io_s, SIOCIFCREATE2, ifr) < 0) {
221 ifname_update(ctx, ifr->ifr_name);
430 list_interfaces(if_ctx *ctx)
433 list_interfaces_ioctl(ctx);
435 list_interfaces_nl(ctx->args);
582 ifconfig(if_ctx *ctx, int iscreate, const struct afswtch *uafp)
585 return (ifconfig_ioctl(ctx, iscreate, uafp));
587 return (ifconfig_nl(ctx, iscreate, uafp));
620 struct ifconfig_context ctx = {
654 ctx.ifname = args->ifname;
670 ifconfig(&ctx, 1, NULL);
683 ifconfig(&ctx, 0, NULL);
722 ifconfig(&ctx, 0, args->afp);
729 list_interfaces(&ctx);
779 list_interfaces_ioctl(if_ctx *ctx)
786 struct ifconfig_args *args = ctx->args;
831 ctx->ifname = cp;
850 ifconfig(ctx, 0, args->afp);
852 status(ctx, sdl, ifa);
960 af_other_status(if_ctx *ctx)
971 afp->af_other_status(ctx);
977 af_all_tunnel_status(if_ctx *ctx)
988 afp->af_status_tunnel(ctx);
1042 static void setifaddr(if_ctx *ctx, const char *addr, int param);
1045 static void setifdstaddr(if_ctx *ctx, const char *addr, int param __unused);
1050 af_exec_ioctl(if_ctx *ctx, unsigned long action, void *data)
1054 strlcpy(req->ifr_name, ctx->ifname, sizeof(req->ifr_name));
1055 if (ioctl_ctx(ctx, action, req) == 0)
1061 delifaddr(if_ctx *ctx, const struct afswtch *afp)
1067 ctx->ifname, afp->af_name);
1072 error = afp->af_exec(ctx, afp->af_difaddr, afp->af_ridreq);
1082 addifaddr(if_ctx *ctx, const struct afswtch *afp)
1086 ctx->ifname, afp->af_name);
1092 int error = afp->af_exec(ctx, afp->af_aifaddr, afp->af_addreq);
1112 struct ifconfig_context *ctx = &_ctx;
1115 strlcpy(ifr.ifr_name, ctx->ifname, sizeof ifr.ifr_name);
1151 ctx->io_s = s;
1152 ctx->afp = afp;
1166 cb->cb_func(ctx, cb->cb_arg);
1198 p->c_u.c_func(ctx, argv[1], 0);
1201 p->c_u.c_func(ctx, argv[1], 0);
1208 p->c_u.c_func2(ctx, argv[1], argv[2]);
1211 p->c_u.c_func3(ctx, *argv, p->c_sparameter);
1213 p->c_u.c_func(ctx, *argv, p->c_parameter);
1221 afp->af_postproc(ctx, newaddr, getifflags(ctx->ifname, s, true));
1227 cb->cb_func(ctx, cb->cb_arg);
1232 delifaddr(ctx, afp);
1234 addifaddr(ctx, afp);
1241 setifaddr(if_ctx *ctx, const char *addr, int param __unused)
1243 const struct afswtch *afp = ctx->afp;
1259 settunnel(if_ctx *ctx, const char *src, const char *dst)
1261 const struct afswtch *afp = ctx->afp;
1283 afp->af_settunnel(ctx, srcres, dstres);
1290 deletetunnel(if_ctx *ctx, const char *vname __unused, int param __unused)
1294 if (ioctl_ctx_ifr(ctx, SIOCDIFPHYADDR, &ifr) < 0)
1300 setifvnet(if_ctx *ctx, const char *jname, int dummy __unused)
1307 if (ioctl_ctx_ifr(ctx, SIOCSIFVNET, &ifr) < 0)
1312 setifrvnet(if_ctx *ctx, const char *jname, int dummy __unused)
1319 if (ioctl_ctx_ifr(ctx, SIOCSIFRVNET, &ifr) < 0)
1325 setifnetmask(if_ctx *ctx, const char *addr, int dummy __unused)
1327 const struct afswtch *afp = ctx->afp;
1336 setifbroadaddr(if_ctx *ctx, const char *addr, int dummy __unused)
1338 const struct afswtch *afp = ctx->afp;
1345 notealias(if_ctx *ctx, const char *addr __unused, int param)
1347 const struct afswtch *afp = ctx->afp;
1351 afp->af_copyaddr(ctx, RIDADDR, ADDR);
1362 setifdstaddr(if_ctx *ctx, const char *addr, int param __unused)
1364 const struct afswtch *afp = ctx->afp;
1400 clearifflags(if_ctx *ctx, const char *vname, int value)
1405 flags = getifflags(ctx->ifname, ctx->io_s, false);
1408 strlcpy(my_ifr.ifr_name, ctx->ifname, sizeof(my_ifr.ifr_name));
1411 if (ioctl(ctx->io_s, SIOCSIFFLAGS, (caddr_t)&my_ifr) < 0)
1416 setifflags(if_ctx *ctx, const char *vname, int value)
1421 flags = getifflags(ctx->ifname, ctx->io_s, false);
1424 strlcpy(my_ifr.ifr_name, ctx->ifname, sizeof(my_ifr.ifr_name));
1427 if (ioctl(ctx->io_s, SIOCSIFFLAGS, (caddr_t)&my_ifr) < 0)
1432 clearifcap(if_ctx *ctx, const char *vname, int value)
1437 if (ioctl_ctx_ifr(ctx, SIOCGIFCAP, &ifr) < 0) {
1448 if (ioctl_ctx(ctx, SIOCSIFCAP, &ifr) < 0)
1453 setifcap(if_ctx *ctx, const char *vname, int value)
1458 if (ioctl_ctx_ifr(ctx, SIOCGIFCAP, &ifr) < 0) {
1469 if (ioctl_ctx(ctx, SIOCSIFCAP, &ifr) < 0)
1474 setifcapnv(if_ctx *ctx, const char *vname, const char *arg)
1483 if (ioctl_ctx_ifr(ctx, SIOCGIFCAP, &ifr) < 0)
1514 if (ioctl_ctx(ctx, SIOCSIFCAPNV, (caddr_t)&ifr) < 0)
1522 setifmetric(if_ctx *ctx, const char *val, int dummy __unused)
1527 if (ioctl_ctx_ifr(ctx, SIOCSIFMETRIC, &ifr) < 0)
1532 setifmtu(if_ctx *ctx, const char *val, int dummy __unused)
1537 if (ioctl_ctx_ifr(ctx, SIOCSIFMTU, &ifr) < 0)
1542 setifpcp(if_ctx *ctx, const char *val, int arg __unused)
1554 if (ioctl_ctx_ifr(ctx, SIOCSLANPCP, &ifr) == -1)
1559 disableifpcp(if_ctx *ctx, const char *val __unused, int arg __unused)
1564 if (ioctl_ctx_ifr(ctx, SIOCSLANPCP, &ifr) == -1)
1569 setifname(if_ctx *ctx, const char *val, int dummy __unused)
1574 ifr_set_name(&ifr, ctx->ifname);
1579 if (ioctl_ctx(ctx, SIOCSIFNAME, (caddr_t)&ifr) < 0) {
1583 ifname_update(ctx, newname);
1588 setifdescr(if_ctx *ctx, const char *val, int dummy __unused)
1606 if (ioctl_ctx_ifr(ctx, SIOCSIFDESCR, &ifr) < 0)
1613 unsetifdescr(if_ctx *ctx, const char *val __unused, int value __unused)
1615 setifdescr(ctx, "", 0);
1676 print_ifcap_nv(if_ctx *ctx)
1690 if (ioctl_ctx_ifr(ctx, SIOCGIFCAPNV, &ifr) != 0)
1712 if (ctx->args->supmedia) {
1730 if (ioctl_ctx(ctx, SIOCGIFCAP, (caddr_t)&ifr) != 0)
1735 print_ifcap(if_ctx *ctx)
1739 if (ioctl_ctx_ifr(ctx, SIOCGIFCAP, &ifr) != 0)
1743 print_ifcap_nv(ctx);
1748 if (ctx->args->supmedia && ifr.ifr_reqcap != 0) {
1758 print_ifstatus(if_ctx *ctx)
1762 strlcpy(ifs.ifs_name, ctx->ifname, sizeof ifs.ifs_name);
1763 if (ioctl_ctx(ctx, SIOCGIFSTATUS, &ifs) == 0)
1768 print_metric(if_ctx *ctx)
1772 if (ioctl_ctx_ifr(ctx, SIOCGIFMETRIC, &ifr) != -1)
1778 print_mtu(if_ctx *ctx)
1782 if (ioctl_ctx_ifr(ctx, SIOCGIFMTU, &ifr) != -1)
1787 print_description(if_ctx *ctx)
1791 ifr_set_name(&ifr, ctx->ifname);
1796 if (ioctl_ctx(ctx, SIOCGIFDESCR, &ifr) == 0) {
1818 status(if_ctx *ctx, const struct sockaddr_dl *sdl __unused, struct ifaddrs *ifa)
1822 struct ifconfig_args *args = ctx->args;
1835 old_s = ctx->io_s;
1836 ctx->io_s = s;
1838 printf("%s: flags=%x", ctx->ifname, ifa->ifa_flags);
1840 print_metric(ctx);
1841 print_mtu(ctx);
1844 print_description(ctx);
1846 print_ifcap(ctx);
1848 tunnel_status(ctx);
1859 p->af_status(ctx, ift);
1861 args->afp->af_status(ctx, ift);
1881 af_other_status(ctx);
1883 args->afp->af_other_status(ctx);
1885 print_ifstatus(ctx);
1887 sfp_status(ctx);
1890 ctx->io_s = old_s;
1896 tunnel_status(if_ctx *ctx)
1898 af_all_tunnel_status(ctx);