0002-Update-netifd-from-Barrier-Breaker.patch 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Sat, 11 Jan 2014 11:47:31 +0100
  3. Subject: Update netifd from Barrier Breaker
  4. diff --git a/package/netifd/Makefile b/package/netifd/Makefile
  5. index 5f2ee03..6f6f30e 100644
  6. --- a/package/netifd/Makefile
  7. +++ b/package/netifd/Makefile
  8. @@ -1,13 +1,13 @@
  9. include $(TOPDIR)/rules.mk
  10. PKG_NAME:=netifd
  11. -PKG_VERSION:=2013-07-16
  12. +PKG_VERSION:=2013-12-29
  13. PKG_RELEASE=$(PKG_SOURCE_VERSION)
  14. PKG_SOURCE_PROTO:=git
  15. PKG_SOURCE_URL:=git://nbd.name/luci2/netifd.git
  16. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  17. -PKG_SOURCE_VERSION:=2674941b06c1ec67f1aff1bff9212e1372106641
  18. +PKG_SOURCE_VERSION:=7d79d0a8aa5a5b4c1ed987af119356438d98fe7b
  19. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  20. PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  21. # PKG_MIRROR_MD5SUM:=
  22. @@ -40,7 +40,7 @@ define Package/netifd/install
  23. $(INSTALL_DIR) $(1)/sbin
  24. $(INSTALL_BIN) $(PKG_BUILD_DIR)/netifd $(1)/sbin/
  25. $(CP) ./files/* $(1)/
  26. - $(CP) $(PKG_BUILD_DIR)/dummy/netifd-proto.sh $(1)/lib/netifd/
  27. + $(CP) $(PKG_BUILD_DIR)/scripts/* $(1)/lib/netifd/
  28. endef
  29. $(eval $(call BuildPackage,netifd))
  30. diff --git a/package/netifd/files/etc/hotplug.d/iface/00-netstate b/package/netifd/files/etc/hotplug.d/iface/00-netstate
  31. index c50cda6..023025c 100644
  32. --- a/package/netifd/files/etc/hotplug.d/iface/00-netstate
  33. +++ b/package/netifd/files/etc/hotplug.d/iface/00-netstate
  34. @@ -1,6 +1,5 @@
  35. [ ifup = "$ACTION" ] && {
  36. uci_toggle_state network "$INTERFACE" up 1
  37. - uci_toggle_state network "$INTERFACE" connect_time $(sed -ne 's![^0-9].*$!!p' /proc/uptime)
  38. [ -n "$DEVICE" ] && {
  39. uci_toggle_state network "$INTERFACE" device "$(uci -q get network.$INTERFACE.ifname)"
  40. uci_toggle_state network "$INTERFACE" ifname "$DEVICE"
  41. diff --git a/package/netifd/files/lib/netifd/dhcp.script b/package/netifd/files/lib/netifd/dhcp.script
  42. index 50163da..77b77f5 100755
  43. --- a/package/netifd/files/lib/netifd/dhcp.script
  44. +++ b/package/netifd/files/lib/netifd/dhcp.script
  45. @@ -44,19 +44,18 @@ setup_interface () {
  46. ip6rd="${ip6rd#* }"
  47. local ip6rdbr="${ip6rd%% *}"
  48. -uci -q batch <<-EOF >/dev/null
  49. -set network.$IFACE6RD.proto=6rd
  50. -set network.$IFACE6RD.auto=0
  51. -set network.$IFACE6RD.peeraddr=$ip6rdbr
  52. -set network.$IFACE6RD.ip4prefixlen=$v4mask
  53. -set network.$IFACE6RD.ip6prefix=$ip6rdprefix
  54. -set network.$IFACE6RD.ip6prefixlen=$ip6rdprefixlen
  55. -commit network
  56. -EOF
  57. + json_init
  58. + json_add_string name "$IFACE6RD"
  59. + json_add_string ifname "@$INTERFACE"
  60. + json_add_string proto "6rd"
  61. + json_add_string peeraddr "$ip6rdbr"
  62. + json_add_int ip4prefixlen "$v4mask"
  63. + json_add_string ip6prefix "$ip6rdprefix"
  64. + json_add_int ip6prefixlen "$ip6rdprefixlen"
  65. + json_add_string tunlink "$INTERFACE"
  66. + json_close_object
  67. - ifdown "$IFACE6RD"
  68. - /etc/init.d/network reload
  69. - ifup "$IFACE6RD"
  70. + ubus call network add_dynamic "$(json_dump)"
  71. fi
  72. # TODO
  73. diff --git a/package/netifd/files/lib/netifd/proto/dhcp.sh b/package/netifd/files/lib/netifd/proto/dhcp.sh
  74. index a270c68..0117b27 100755
  75. --- a/package/netifd/files/lib/netifd/proto/dhcp.sh
  76. +++ b/package/netifd/files/lib/netifd/proto/dhcp.sh
  77. @@ -13,20 +13,25 @@ proto_dhcp_init_config() {
  78. proto_config_add_boolean "broadcast"
  79. proto_config_add_string "reqopts"
  80. proto_config_add_string "iface6rd"
  81. + proto_config_add_string "sendopts"
  82. }
  83. proto_dhcp_setup() {
  84. local config="$1"
  85. local iface="$2"
  86. - local ipaddr hostname clientid vendorid broadcast reqopts iface6rd
  87. - json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd
  88. + local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts
  89. + json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts
  90. local opt dhcpopts
  91. for opt in $reqopts; do
  92. append dhcpopts "-O $opt"
  93. done
  94. + for opt in $sendopts; do
  95. + append dhcpopts "-x $opt"
  96. + done
  97. +
  98. [ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
  99. [ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
  100. [ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
  101. diff --git a/package/netifd/patches/001-musl_af_inet_include.patch b/package/netifd/patches/001-musl_af_inet_include.patch
  102. new file mode 100644
  103. index 0000000..510ee05
  104. --- /dev/null
  105. +++ b/package/netifd/patches/001-musl_af_inet_include.patch
  106. @@ -0,0 +1,11 @@
  107. +diff -urN netifd-2012-10-29/utils.c netifd-2012-10-29.new/utils.c
  108. +--- netifd-2012-10-29/utils.c 2012-11-23 17:15:39.000000000 +0100
  109. ++++ netifd-2012-10-29.new/utils.c 2012-11-23 17:16:53.409244361 +0100
  110. +@@ -17,6 +17,7 @@
  111. +
  112. + #include <arpa/inet.h>
  113. + #include <netinet/in.h>
  114. ++#include <sys/socket.h>
  115. +
  116. + void
  117. + __vlist_simple_init(struct vlist_simple_tree *tree, int offset)