mirror of
https://github.com/sheumann/hush.git
synced 2024-11-05 06:07:00 +00:00
Eric Spakman writes:
The attached patch adds "mtu" and "hwaddress" to the inet6 method and "mtu", "hwaddr" and "pointopoint" to the inet4 method (just like in the ifupdown part). Note: "hwaddress" can't be used with the busybox ip applet (this function isn't implemented in bb ip yet), but it can be of use with an external "full blown" ip package. The patch also removes "label" from the loopback configuration, labels (subinterfaces) aren't used with loopback interfaces. It further solves a problem in the bootp method, "ifconfig down %interface%" should be "ifconfig %interface% down" and it's now also possible to use ip with bootp. The patch is fully tested with both busybox ip and "stand-alone" ip and I didn't saw any problems.
This commit is contained in:
parent
d3652bf334
commit
fdd2a0f318
@ -388,7 +388,7 @@ static int loopback_up6(struct interface_defn_t *ifd, execfn *exec)
|
|||||||
{
|
{
|
||||||
#ifdef CONFIG_FEATURE_IFUPDOWN_IP
|
#ifdef CONFIG_FEATURE_IFUPDOWN_IP
|
||||||
int result;
|
int result;
|
||||||
result =execute("ip addr add ::1 dev %iface% label %label%", ifd, exec);
|
result =execute("ip addr add ::1 dev %iface%", ifd, exec);
|
||||||
result += execute("ip link set %iface% up", ifd, exec);
|
result += execute("ip link set %iface% up", ifd, exec);
|
||||||
return( result);
|
return( result);
|
||||||
#else
|
#else
|
||||||
@ -409,8 +409,8 @@ static int static_up6(struct interface_defn_t *ifd, execfn *exec)
|
|||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
#ifdef CONFIG_FEATURE_IFUPDOWN_IP
|
#ifdef CONFIG_FEATURE_IFUPDOWN_IP
|
||||||
result = execute("ip addr add %address%/%netmask% dev %iface% label %label%", ifd, exec);
|
result = execute("ip addr add %address%/%netmask% dev %iface% [[label %label%]]", ifd, exec);
|
||||||
result += execute("ip link set %iface% up", ifd, exec);
|
result += execute("ip link set [[mtu %mtu%]] [[address %hwaddress%]] %iface% up", ifd, exec);
|
||||||
result += execute("[[ ip route add ::/0 via %gateway% ]]", ifd, exec);
|
result += execute("[[ ip route add ::/0 via %gateway% ]]", ifd, exec);
|
||||||
#else
|
#else
|
||||||
result = execute("ifconfig %iface% [[media %media%]] [[hw %hwaddress%]] [[mtu %mtu%]] up", ifd, exec);
|
result = execute("ifconfig %iface% [[media %media%]] [[hw %hwaddress%]] [[mtu %mtu%]] up", ifd, exec);
|
||||||
@ -467,7 +467,7 @@ static int loopback_up(struct interface_defn_t *ifd, execfn *exec)
|
|||||||
{
|
{
|
||||||
#ifdef CONFIG_FEATURE_IFUPDOWN_IP
|
#ifdef CONFIG_FEATURE_IFUPDOWN_IP
|
||||||
int result;
|
int result;
|
||||||
result = execute("ip addr add 127.0.0.1/8 dev %iface% label %label%", ifd, exec);
|
result = execute("ip addr add 127.0.0.1/8 dev %iface%", ifd, exec);
|
||||||
result += execute("ip link set %iface% up", ifd, exec);
|
result += execute("ip link set %iface% up", ifd, exec);
|
||||||
return(result);
|
return(result);
|
||||||
#else
|
#else
|
||||||
@ -492,8 +492,8 @@ static int static_up(struct interface_defn_t *ifd, execfn *exec)
|
|||||||
int result;
|
int result;
|
||||||
#ifdef CONFIG_FEATURE_IFUPDOWN_IP
|
#ifdef CONFIG_FEATURE_IFUPDOWN_IP
|
||||||
result = execute("ip addr add %address%/%bnmask% [[broadcast %broadcast%]] "
|
result = execute("ip addr add %address%/%bnmask% [[broadcast %broadcast%]] "
|
||||||
"dev %iface% label %label%", ifd, exec);
|
"dev %iface% [[peer %pointopoint%]] [[label %label%]]", ifd, exec);
|
||||||
result += execute("ip link set %iface% up", ifd, exec);
|
result += execute("ip link set [[mtu %mtu%]] [[address %hwaddress%]] %iface% up", ifd, exec);
|
||||||
result += execute("[[ ip route add default via %gateway% dev %iface% ]]", ifd, exec);
|
result += execute("[[ ip route add default via %gateway% dev %iface% ]]", ifd, exec);
|
||||||
#else
|
#else
|
||||||
result = execute("ifconfig %iface% %address% netmask %netmask% "
|
result = execute("ifconfig %iface% %address% netmask %netmask% "
|
||||||
@ -569,7 +569,11 @@ static int bootp_up(struct interface_defn_t *ifd, execfn *exec)
|
|||||||
|
|
||||||
static int bootp_down(struct interface_defn_t *ifd, execfn *exec)
|
static int bootp_down(struct interface_defn_t *ifd, execfn *exec)
|
||||||
{
|
{
|
||||||
return( execute("ifconfig down %iface%", ifd, exec));
|
#ifdef CONFIG_FEATURE_IFUPDOWN_IP
|
||||||
|
return(execute("ip link set %iface% down", ifd, exec));
|
||||||
|
#else
|
||||||
|
return(execute("ifconfig %iface% down", ifd, exec));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ppp_up(struct interface_defn_t *ifd, execfn *exec)
|
static int ppp_up(struct interface_defn_t *ifd, execfn *exec)
|
||||||
|
Loading…
Reference in New Issue
Block a user