include $(TOPDIR)/rules.mk
PKG_NAME:=netifd
-PKG_VERSION:=2014-09-08.1
+PKG_VERSION:=2016-03-31
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=http://git.openwrt.org/project/netifd.git
+PKG_SOURCE_URL=$(OPENWRT_GIT)/project/netifd.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=46c569989f984226916fec28dd8ef152a664043e
+PKG_SOURCE_VERSION:=39d9ceeb96162a83a3f5fa63e6aaa1ccb38caa62
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
-PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
+PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
# PKG_MIRROR_MD5SUM:=
# CMAKE_INSTALL:=1
-PKG_LICENSE:=GPLv2
+PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=
PKG_BUILD_PARALLEL:=1
procd_set_param watch network.interface
[ -e /proc/sys/kernel/core_pattern ] && {
procd_set_param limits core="unlimited"
- echo '/tmp/%e.%p.%s.%t.core' > /proc/sys/kernel/core_pattern
}
procd_close_instance
}
/sbin/wifi reload_legacy
}
-stop_service() {
+stop() {
/sbin/wifi down
+ procd_kill network ''
}
service_running() {
shutdown() {
ifdown -a
- stop
+ sleep 1
}
set_classless_routes() {
local max=128
- local type
while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do
- proto_add_ipv4_route "${1%%/*}" "${1##*/}" "$2"
+ proto_add_ipv4_route "${1%%/*}" "${1##*/}" "$2" "$ip"
max=$(($max-1))
shift 2
done
# TODO: apply $broadcast
for i in $router; do
- proto_add_ipv4_route 0.0.0.0 0 "$i"
+ proto_add_ipv4_route "$i" 32 "" "$ip"
+ proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip"
+
+ for r in $CUSTOMROUTES; do
+ proto_add_ipv4_route "${r%%/*}" "${r##*/}" "$i" "$ip"
+ done
done
# CIDR STATIC ROUTES (rfc3442)
done
proto_add_data
- [ -n "$ZONE" ] && json_add_string zone "$ZONE"
+ [ -n "$ZONE" ] && json_add_string zone "$ZONE"
+ [ -n "$ntpsrv" ] && json_add_string ntpserver "$ntpsrv"
+ [ -n "$timesvr" ] && json_add_string timeserver "$timesvr"
+ [ -n "$hostname" ] && json_add_string hostname "$hostname"
+ [ -n "$message" ] && json_add_string message "$message"
+ [ -n "$timezone" ] && json_add_int timezone "$timezone"
+ [ -n "$lease" ] && json_add_int leasetime "$lease"
proto_close_data
proto_send_update "$INTERFACE"
local ip6rdbr="${ip6rd%% *}"
[ -n "$ZONE" ] || ZONE=$(fw3 -q network $INTERFACE)
- [ -z "$IFACE6RD" -o "$IFACE6RD" = 1 ] && IFACE6RD=${INTERFACE}_6rd
+ [ -z "$IFACE6RD" -o "$IFACE6RD" = 1 ] && IFACE6RD=${INTERFACE}_6
json_init
json_add_string name "$IFACE6RD"
[ -n "$IFACE6RD_DELEGATE" ] && json_add_boolean delegate "$IFACE6RD_DELEGATE"
[ -n "$ZONE6RD" ] || ZONE6RD=$ZONE
[ -n "$ZONE6RD" ] && json_add_string zone "$ZONE6RD"
+ [ -n "$MTU6RD" ] && json_add_string mtu "$MTU6RD"
json_close_object
ubus call network add_dynamic "$(json_dump)"
fi
-
- # TODO
- # [ -n "$ntpsrv" ] && change_state network "$ifc" lease_ntpsrv "$ntpsrv"
- # [ -n "$timesvr" ] && change_state network "$ifc" lease_timesrv "$timesvr"
- # [ -n "$hostname" ] && change_state network "$ifc" lease_hostname "$hostname"
- # [ -n "$timezone" ] && change_state network "$ifc" lease_timezone "$timezone"
}
deconfig_interface() {
esac
# user rules
-[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user
+[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user "$@"
exit 0
proto_config_add_string clientid
proto_config_add_string vendorid
proto_config_add_boolean 'broadcast:bool'
+ proto_config_add_boolean 'release:bool'
proto_config_add_string 'reqopts:list(string)'
proto_config_add_string iface6rd
proto_config_add_string sendopts
proto_config_add_boolean delegate
proto_config_add_string zone6rd
proto_config_add_string zone
+ proto_config_add_string mtu6rd
+ proto_config_add_string customroutes
}
proto_dhcp_setup() {
local config="$1"
local iface="$2"
- local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
- json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
+ local ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
+ json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
local opt dhcpopts
for opt in $reqopts; do
done
[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
+ [ "$release" = 1 ] && release="-R" || release=
[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
[ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append dhcpopts "-O 212"
[ -n "$zone6rd" ] && proto_export "ZONE6RD=$zone6rd"
[ -n "$zone" ] && proto_export "ZONE=$zone"
+ [ -n "$mtu6rd" ] && proto_export "MTU6RD=$mtu6rd"
+ [ -n "$customroutes" ] && proto_export "CUSTOMROUTES=$customroutes"
[ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
proto_export "INTERFACE=$config"
proto_run_command "$config" udhcpc \
-p /var/run/udhcpc-$iface.pid \
-s /lib/netifd/dhcp.script \
- -f -t 0 -i "$iface" \
+ -f -R -t 0 -i "$iface" \
${ipaddr:+-r $ipaddr} \
${hostname:+-H $hostname} \
${vendorid:+-V $vendorid} \
- $clientid $broadcast $dhcpopts
+ $clientid $broadcast $release $dhcpopts
}
proto_dhcp_renew() {
fi
}
- local radio_devs
- local network="$1"
+ network="$1"
config_load wireless
config_foreach find_related_radios wifi-iface
- local dev
for dev in $(echo "$radio_devs" | sort -u); do
/sbin/wifi up "$dev"
done
+++ /dev/null
-diff -urN netifd-2012-10-29/utils.c netifd-2012-10-29.new/utils.c
---- netifd-2012-10-29/utils.c 2012-11-23 17:15:39.000000000 +0100
-+++ netifd-2012-10-29.new/utils.c 2012-11-23 17:16:53.409244361 +0100
-@@ -17,6 +17,7 @@
-
- #include <arpa/inet.h>
- #include <netinet/in.h>
-+#include <sys/socket.h>
-
- void
- __vlist_simple_init(struct vlist_simple_tree *tree, int offset)
+++ /dev/null
---- a/system-linux.c 2016-07-12 22:51:38.000000000 +0300
-+++ b/system-linux.c 2016-07-13 11:21:26.820071423 +0300
-@@ -1103,7 +1103,7 @@ read_string_file(int dir_fd, const char
- char *c;
- int fd;
-
-- fd = openat(dir_fd, file, O_RDONLY);
-+ fd = open(file, O_RDONLY);
- if (fd < 0)
- return false;
-
--- /dev/null
+--- a/system-linux.c 2016-07-20 21:00:45.002413843 +0300
++++ b/system-linux.c 2016-07-20 20:11:46.000000000 +0300
+@@ -989,6 +989,7 @@ int system_bridge_addbr(struct device *b
+ return 0;
+ }
+
++#ifdef CONFIG_MACVLAN
+ int system_macvlan_add(struct device *macvlan, struct device *dev, struct macvlan_config *cfg)
+ {
+ struct nl_msg *msg;
+@@ -1048,6 +1049,7 @@ nla_put_failure:
+ nlmsg_free(msg);
+ return -ENOMEM;
+ }
++#endif
+
+ static int system_link_del(const char *ifname)
+ {
+@@ -1067,10 +1069,12 @@ static int system_link_del(const char *i
+ return system_rtnl_call(msg);
+ }
+
++#ifdef CONFIG_MACVLAN
+ int system_macvlan_del(struct device *macvlan)
+ {
+ return system_link_del(macvlan->ifname);
+ }
++#endif
+
+ static int system_vlan(struct device *dev, int id)
+ {
+@@ -1469,7 +1473,11 @@ read_string_file(int dir_fd, const char
+ char *c;
+ int fd;
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,33)
+ fd = openat(dir_fd, file, O_RDONLY);
++#else
++ fd = open(file, O_RDONLY);
++#endif
+ if (fd < 0)
+ return false;
+
+@@ -1938,8 +1946,10 @@ static int system_iprule(struct iprule *
+ if (rule->flags & IPRULE_IN)
+ nla_put(msg, FRA_IFNAME, strlen(rule->in_dev) + 1, rule->in_dev);
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,33)
+ if (rule->flags & IPRULE_OUT)
+ nla_put(msg, FRA_OIFNAME, strlen(rule->out_dev) + 1, rule->out_dev);
++#endif
+
+ if (rule->flags & IPRULE_SRC)
+ nla_put(msg, FRA_SRC, alen, &rule->src_addr);
+--- a/macvlan.c 2016-07-20 20:11:46.000000000 +0300
++++ b/macvlan.c 2016-07-20 22:15:32.726092978 +0300
+@@ -81,7 +81,9 @@ static int
+ macvlan_set_down(struct macvlan_device *mvdev)
+ {
+ mvdev->set_state(&mvdev->dev, false);
++#ifdef CONFIG_MACVLAN
+ system_macvlan_del(&mvdev->dev);
++#endif
+ device_release(&mvdev->parent);
+
+ return 0;
+@@ -96,6 +98,7 @@ macvlan_set_up(struct macvlan_device *mv
+ if (ret < 0)
+ return ret;
+
++#ifdef CONFIG_MACVLAN
+ ret = system_macvlan_add(&mvdev->dev, mvdev->parent.dev, &mvdev->config);
+ if (ret < 0)
+ goto release;
+@@ -110,6 +113,7 @@ delete:
+ system_macvlan_del(&mvdev->dev);
+ release:
+ device_release(&mvdev->parent);
++#endif
+ return ret;
+ }
+