Lines Matching refs:ifd
166 int (*up)(struct interface_defn_t *ifd, execfn *e) FAST_FUNC;
167 int (*down)(struct interface_defn_t *ifd, execfn *e) FAST_FUNC;
267 static char *get_var(const char *id, size_t idlen, struct interface_defn_t *ifd) in get_var() argument
282 return ifd->iface; in get_var()
285 return ifd->iface; in get_var()
287 for (i = 0; i < ifd->n_options; i++) { in get_var()
288 if (strncmpz(id, ifd->option[i].name, idlen) == 0) { in get_var()
289 return ifd->option[i].value; in get_var()
328 static char *parse(const char *command, struct interface_defn_t *ifd) in parse() argument
383 varvalue = get_var(command, nextpercent - command, ifd); in parse()
401 varvalue = get_var("netmask", 7, ifd); in parse()
438 static int execute(const char *command, struct interface_defn_t *ifd, execfn *exec) in execute() argument
443 out = parse(command, ifd); in execute()
463 static int FAST_FUNC loopback_up6(struct interface_defn_t *ifd, execfn *exec) in loopback_up6() argument
467 result = execute("ip addr add ::1 dev %iface%", ifd, exec); in loopback_up6()
468 result += execute("ip link set %iface% up", ifd, exec); in loopback_up6()
471 return execute("ifconfig %iface% add ::1", ifd, exec); in loopback_up6()
475 static int FAST_FUNC loopback_down6(struct interface_defn_t *ifd, execfn *exec) in loopback_down6() argument
478 return execute("ip link set %iface% down", ifd, exec); in loopback_down6()
480 return execute("ifconfig %iface% del ::1", ifd, exec); in loopback_down6()
484 static int FAST_FUNC manual_up_down6(struct interface_defn_t *ifd UNUSED_PARAM, execfn *exec UNUSED… in manual_up_down6()
489 static int FAST_FUNC static_up6(struct interface_defn_t *ifd, execfn *exec) in static_up6() argument
493 result = execute("ip addr add %address%/%netmask% dev %iface%[[ label %label%]]", ifd, exec); in static_up6()
494 result += execute("ip link set[[ mtu %mtu%]][[ addr %hwaddress%]] %iface% up", ifd, exec); in static_up6()
496 …result += execute("[[ip route add ::/0 via %gateway% dev %iface%]][[ metric %metric%]]", ifd, exec… in static_up6()
498 …result = execute("ifconfig %iface%[[ media %media%]][[ hw %hwaddress%]][[ mtu %mtu%]] up", ifd, ex… in static_up6()
499 result += execute("ifconfig %iface% add %address%/%netmask%", ifd, exec); in static_up6()
500 result += execute("[[route -A inet6 add ::/0 gw %gateway%[[ metric %metric%]]]]", ifd, exec); in static_up6()
505 static int FAST_FUNC static_down6(struct interface_defn_t *ifd, execfn *exec) in static_down6() argument
507 if (!if_nametoindex(ifd->iface)) in static_down6()
510 return execute("ip link set %iface% down", ifd, exec); in static_down6()
512 return execute("ifconfig %iface% down", ifd, exec); in static_down6()
517 static int FAST_FUNC v4tunnel_up(struct interface_defn_t *ifd, execfn *exec) in v4tunnel_up() argument
521 "%endpoint%[[ local %local%]][[ ttl %ttl%]]", ifd, exec); in v4tunnel_up()
522 result += execute("ip link set %iface% up", ifd, exec); in v4tunnel_up()
523 result += execute("ip addr add %address%/%netmask% dev %iface%", ifd, exec); in v4tunnel_up()
525 result += execute("[[ip route add ::/0 via %gateway% dev %iface%]]", ifd, exec); in v4tunnel_up()
529 static int FAST_FUNC v4tunnel_down(struct interface_defn_t * ifd, execfn * exec) in v4tunnel_down() argument
531 return execute("ip tunnel del %iface%", ifd, exec); in v4tunnel_down()
555 static int FAST_FUNC loopback_up(struct interface_defn_t *ifd, execfn *exec) in loopback_up() argument
559 result = execute("ip addr add 127.0.0.1/8 dev %iface%", ifd, exec); in loopback_up()
560 result += execute("ip link set %iface% up", ifd, exec); in loopback_up()
563 return execute("ifconfig %iface% 127.0.0.1 up", ifd, exec); in loopback_up()
567 static int FAST_FUNC loopback_down(struct interface_defn_t *ifd, execfn *exec) in loopback_down() argument
571 result = execute("ip addr flush dev %iface%", ifd, exec); in loopback_down()
572 result += execute("ip link set %iface% down", ifd, exec); in loopback_down()
575 return execute("ifconfig %iface% 127.0.0.1 down", ifd, exec); in loopback_down()
579 static int FAST_FUNC static_up(struct interface_defn_t *ifd, execfn *exec) in static_up() argument
584 "dev %iface%[[ peer %pointopoint%]][[ label %label%]]", ifd, exec); in static_up()
585 result += execute("ip link set[[ mtu %mtu%]][[ addr %hwaddress%]] %iface% up", ifd, exec); in static_up()
586 …result += execute("[[ip route add default via %gateway% dev %iface%[[ metric %metric%]]]]", ifd, e… in static_up()
592 ifd, exec); in static_up()
595 ifd, exec); in static_up()
596 result += execute("[[route add default gw %gateway%[[ metric %metric%]] %iface%]]", ifd, exec); in static_up()
601 static int FAST_FUNC static_down(struct interface_defn_t *ifd, execfn *exec) in static_down() argument
605 if (!if_nametoindex(ifd->iface)) in static_down()
611 result = execute("ip addr flush dev %iface%[[ label %label%]]", ifd, exec); in static_down()
612 result += execute("ip link set %iface% down", ifd, exec); in static_down()
618 result += execute("ifconfig %iface% down", ifd, exec); in static_down()
652 static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec) in dhcp_up() argument
657 if (!execute("ip link set[[ addr %hwaddress%]] %iface% up", ifd, exec)) in dhcp_up()
661 if (!execute("ifconfig %iface%[[ hw %hwaddress%]] up", ifd, exec)) in dhcp_up()
666 return execute(ext_dhcp_clients[i].startcmd, ifd, exec); in dhcp_up()
672 static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec) in dhcp_up() argument
676 if (!execute("ip link set[[ addr %hwaddress%]] %iface% up", ifd, exec)) in dhcp_up()
680 if (!execute("ifconfig %iface%[[ hw %hwaddress%]] up", ifd, exec)) in dhcp_up()
685 ifd, exec); in dhcp_up()
688 static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd UNUSED_PARAM, in dhcp_up()
696 static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec) in dhcp_down() argument
703 result = execute(ext_dhcp_clients[i].stopcmd, ifd, exec); in dhcp_down()
715 result += static_down(ifd, exec); in dhcp_down()
719 static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec) in dhcp_down() argument
725 ifd, exec); in dhcp_down()
732 result += static_down(ifd, exec); in dhcp_down()
736 static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd UNUSED_PARAM, in dhcp_down()
743 static int FAST_FUNC manual_up_down(struct interface_defn_t *ifd UNUSED_PARAM, execfn *exec UNUSED_… in manual_up_down()
748 static int FAST_FUNC bootp_up(struct interface_defn_t *ifd, execfn *exec) in bootp_up() argument
752 " --returniffail --serverbcast", ifd, exec); in bootp_up()
755 static int FAST_FUNC ppp_up(struct interface_defn_t *ifd, execfn *exec) in ppp_up() argument
757 return execute("pon[[ %provider%]]", ifd, exec); in ppp_up()
760 static int FAST_FUNC ppp_down(struct interface_defn_t *ifd, execfn *exec) in ppp_down() argument
762 return execute("poff[[ %provider%]]", ifd, exec); in ppp_down()
765 static int FAST_FUNC wvdial_up(struct interface_defn_t *ifd, execfn *exec) in wvdial_up() argument
768 "-p /var/run/wvdial.%iface% -b -m --[[ %provider%]]", ifd, exec); in wvdial_up()
771 static int FAST_FUNC wvdial_down(struct interface_defn_t *ifd, execfn *exec) in wvdial_down() argument
774 "-p /var/run/wvdial.%iface% -s 2", ifd, exec); in wvdial_down()
795 static int FAST_FUNC link_up_down(struct interface_defn_t *ifd UNUSED_PARAM, execfn *exec UNUSED_PA… in link_up_down()
1178 static int execute_all(struct interface_defn_t *ifd, const char *opt) in execute_all() argument
1189 for (i = 0; i < ifd->n_options; i++) { in execute_all()
1190 if (strcmp(ifd->option[i].name, opt) == 0) { in execute_all()
1191 if (!doit(ifd->option[i].value)) { in execute_all()