package: remove some old pack

This commit is contained in:
coolsnowwolf 2020-07-07 12:38:06 +08:00
parent bb51e8a978
commit 3b4a069b2e
27 changed files with 0 additions and 17678 deletions

View File

@ -1,41 +0,0 @@
#
# Copyright (C) 2018 TDT AG <development@tdt.de>
#
# This is free software, licensed under the GNU General Public License v2.
# See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=proto-bonding
PKG_VERSION:=2018-06-11
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=
PKG_MAINTAINER:=Helge Mader <ma@dev.tdt.de>
include $(INCLUDE_DIR)/package.mk
define Package/proto-bonding
SECTION:=net
CATEGORY:=Network
TITLE:=Link Aggregation (Channel Bonding) proto handler
DEPENDS:=+kmod-bonding
endef
define Package/proto-bonding/description
This package contains the channel bonding proto handler for netifd
endef
define Build/Compile
endef
define Package/proto-bonding/install
$(INSTALL_DIR) $(1)/lib/netifd/proto/
$(INSTALL_BIN) ./files/lib/netifd/proto/bonding.sh \
$(1)/lib/netifd/proto/
endef
$(eval $(call BuildPackage,proto-bonding))

View File

@ -1,211 +0,0 @@
#!/bin/sh
#
# Copyright (C) 2018 TDT AG <development@tdt.de>
#
# This is free software, licensed under the GNU General Public License v2.
# See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
#
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
INCLUDE_ONLY=1
BONDING_MASTERS="/sys/class/net/bonding_masters"
set_driver_values() {
local varname
for varname in "$@"; do
local value
json_get_var value "$varname"
[ -n "$value" ] && echo "$value" > /sys/class/net/"$link"/bonding/"$varname"
done
}
proto_bonding_init_config() {
no_device=1
available=1
proto_config_add_string "ifname"
proto_config_add_string "ipaddr"
proto_config_add_string "netmask"
proto_config_add_string "bonding_policy"
proto_config_add_string "link_monitoring"
proto_config_add_string "slaves"
proto_config_add_string "all_slaves_active"
proto_config_add_string "min_links"
proto_config_add_string "ad_actor_sys_prio"
proto_config_add_string "ad_actor_system"
proto_config_add_string "ad_select"
proto_config_add_string "lacp_rate"
proto_config_add_string "packets_per_slave"
proto_config_add_string "xmit_hash_policy"
proto_config_add_string "primary"
proto_config_add_string "primary_reselect"
proto_config_add_string "lp_interval"
proto_config_add_string "tlb_dynamic_lb"
proto_config_add_string "resend_igmp"
proto_config_add_string "fail_over_mac"
proto_config_add_string "num_grat_arp__num_unsol_na"
proto_config_add_string "arp_interval"
proto_config_add_string "arp_ip_target"
proto_config_add_string "arp_all_targets"
proto_config_add_string "arp_validate"
proto_config_add_string "miimon"
proto_config_add_string "downdelay"
proto_config_add_string "updelay"
proto_config_add_string "use_carrier"
}
proto_bonding_setup() {
local cfg="$1"
local link="bonding-$cfg"
# Check for loaded kernel bonding driver (/sys/class/net/bonding_masters exists)
[ -f "$BONDING_MASTERS" ] || {
echo "$cfg" "setup: bonding_masters does not exist in sysfs (kernel module not loaded?)"
proto_notify_error "$cfg" "setup: bonding_masters does not exist in sysfs (kernel module not loaded?)"
proto_block_restart "$cfg"
return
}
# Add bonding interface to system
echo "+$link" > "$BONDING_MASTERS"
# Set bonding policy (with corresponding parameters)
local bonding_policy
json_get_vars bonding_policy
case "$bonding_policy" in
802.3ad)
echo "$bonding_policy" > /sys/class/net/"$link"/bonding/mode
set_driver_values min_links ad_actor_sys_prio ad_actor_system ad_select lacp_rate
;;
balance-rr)
echo "$bonding_policy" > /sys/class/net/"$link"/bonding/mode
set_driver_values packets_per_slave xmit_hash_policy
;;
balance-tlb)
echo "$bonding_policy" > /sys/class/net/"$link"/bonding/mode
set_driver_values primary primary_reselect lp_interval tlb_dynamic_lb resend_igmp xmit_hash_policy
;;
balance-alb)
echo "$bonding_policy" > /sys/class/net/"$link"/bonding/mode
set_driver_values primary primary_reselect lp_interval tlb_dynamic_lb resend_igmp xmit_hash_policy
;;
active-backup)
echo "$bonding_policy" > /sys/class/net/"$link"/bonding/mode
set_driver_values primary primary_reselect fail_over_mac num_grat_arp__num_unsol_na xmit_hash_policy
;;
esac
# Set link monitoring (with corresponding parameters)
local link_monitoring
json_get_vars link_monitoring
case "$link_monitoring" in
arp)
local arp_interval arp_ip_target arp_all_targets arp_validate
json_get_vars arp_interval arp_ip_target arp_all_targets arp_validate
[ -n "$arp_interval" -a "$arp_interval" != 0 ] && echo "$arp_interval" > /sys/class/net/"$link"/bonding/arp_interval
IFS=' '
for target in $arp_ip_target; do
echo "+$target" > /sys/class/net/"$link"/bonding/arp_ip_target
done
[ -n "$arp_all_targets" ] && echo "$arp_all_targets" > /sys/class/net/"$link"/bonding/arp_all_targets
[ -n "$arp_validate" ] && echo "$arp_validate" > /sys/class/net/"$link"/bonding/arp_validate
;;
mii)
local miimon downdelay updelay use_carrier
json_get_vars miimon downdelay updelay use_carrier
[ -n "$miimon" -a "$miimon" != 0 ] && echo "$miimon" > /sys/class/net/"$link"/bonding/miimon
[ -n "$downdelay" ] && echo "$downdelay" > /sys/class/net/"$link"/bonding/downdelay
[ -n "$updelay" ] && echo "$updelay" > /sys/class/net/"$link"/bonding/updelay
[ -n "$use_carrier" ] && echo "$use_carrier" > /sys/class/net/"$link"/bonding/use_carrier
;;
esac
# Add slaves to bonding interface
local slaves
json_get_vars slaves
for slave in $slaves; do
if [ "$(cat /proc/net/dev |grep "$slave")" == "" ]; then
echo "$cfg" "ERROR IN CONFIGURATION - $slave: No such device"
proto_notify_error "$cfg" "ERROR IN CONFIGURATION - $slave: No such device"
proto_block_restart "$cfg"
return
fi
ifconfig "$slave" down
sleep 1
echo "+$slave" > /sys/class/net/"$link"/bonding/slaves
ifconfig "$slave" up
done
[ -n "$all_slaves_active" ] && echo "$all_slaves_active" > /sys/class/net/"$link"/bonding/all_slaves_active
local ipaddr netmask
json_get_vars ipaddr netmask
# ATTENTION
#All json vars have to be read before the line below, as the
# json object will be overwritten by proto_init_update
# ATTENTION
proto_init_update "$link" 1
# For static configuration we _MUST_ have an IP address
[ -z "$ipaddr" ] && {
echo "$cfg" "INVALID LOCAL ADDRESS"
proto_notify_error "$cfg" "INVALID_LOCAL_ADDRESS"
proto_block_restart "$cfg"
return
}
proto_add_ipv4_address "$ipaddr" "$netmask"
proto_send_update "$cfg"
}
proto_bonding_teardown() {
local cfg="$1"
local link="bonding-$cfg"
# Check for loaded kernel bonding driver (/sys/class/net/bonding_masters exists)
[ -f "$BONDING_MASTERS" ] || {
echo "$cfg" "teardown: bonding_masters does not exist in sysfs (kernel module not loaded?)"
proto_notify_error "$cfg" "teardown: bonding_masters does not exist in sysfs (kernel module not loaded?)"
proto_block_restart "$cfg"
return
}
echo "-$link" > /sys/class/net/bonding_masters
logger "bonding_teardown($1): $2"
}
add_protocol bonding

View File

@ -1,48 +0,0 @@
#
# Copyright (c) 2015 Justin Liu
# Author: Justin Liu <rssnsj@gmail.com>
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ipset-lists
PKG_VERSION:=20181104
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/ipset-lists
CATEGORY:=Network
TITLE:=Service for IPSET address tables
MAINTAINER:=Justin Liu <rssnsj@gmail.com>
DEPENDS:=+ipset
endef
define Package/ipset-lists/conffiles
/etc/gfwlist/china-banned
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Compile/Default
endef
Build/Compile = $(Build/Compile/Default)
define Package/ipset-lists/install
$(CP) -a files/* $(1)/
endef
define Package/ipset-lists/postinst
#!/bin/sh
if [ -e /etc/openwrt_release ]; then
/etc/init.d/ipset.sh restart
/etc/init.d/ipset.sh enable || :
fi
endef
$(eval $(call BuildPackage,ipset-lists))

File diff suppressed because it is too large Load Diff

View File

@ -1,95 +0,0 @@
v.youku.com
api.youku.com
v2.tudou.com
www.tudou.com
s.plcloud.music.qq.com
i.y.qq.com
hot.vrs.sohu.com
live.tv.sohu.com
pad.tv.sohu.com
my.tv.sohu.com
hot.vrs.letv.com
data.video.qiyi.com
cache.video.qiyi.com
cache.vip.qiyi.com
vv.video.qq.com
tt.video.qq.com
ice.video.qq.com
tjsa.video.qq.com
a10.video.qq.com
xyy.video.qq.com
vcq.video.qq.com
vsh.video.qq.com
vbj.video.qq.com
bobo.video.qq.com
flvs.video.qq.com
bkvv.video.qq.com
info.zb.qq.com
geo.js.kankan.xunlei.com
web-play.pptv.com
web-play.pplive.cn
dyn.ugc.pps.tv
v.pps.tv
inner.kandian.com
ipservice.163.com
so.open.163.com
zb.s.qq.com
ip.kankan.xunlei.com
vxml.56.com
music.sina.com.cn
play.baidu.com
v.iask.com
tv.weibo.com
wtv.v.iask.com
video.sina.com.cn
www.yinyuetai.com
api.letv.com
live.gslb.letv.com
static.itv.letv.com
ip.apps.cntv.cn
vdn.apps.cntv.cn
vdn.live.cntv.cn
vip.sports.cntv.cn
a.play.api.3g.youku.com
i.play.api.3g.youku.com
api.3g.youku.com
tv.api.3g.youku.com
play.api.3g.youku.com
play.api.3g.tudou.com
tv.api.3g.tudou.com
api.3g.tudou.com
api.tv.sohu.com
access.tv.sohu.com
iface.iqiyi.com
iface2.iqiyi.com
cache.m.iqiyi.com
dynamic.app.m.letv.com
dynamic.meizi.app.m.letv.com
dynamic.search.app.m.letv.com
dynamic.live.app.m.letv.com
listso.m.areainfo.ppstream.com
epg.api.pptv.com
play.api.pptv.com
m.letv.com
interface.bilibili.com
3g.music.qq.com
mqqplayer.3g.qq.com
proxy.music.qq.com
proxymc.qq.com
ip2.kugou.com
ip.kugou.com
client.api.ttpod.com
mobi.kuwo.cn
mobilefeedback.kugou.com
tingapi.ting.baidu.com
music.baidu.com
serviceinfo.sdk.duomi.com
music.163.com
www.xiami.com
spark.api.xiami.com
iplocation.geo.qiyi.com
sns.video.qq.com
v5.pc.duomi.com
tms.is.ysten.com
internal.check.duokanbox.com
openapi.youku.com

View File

@ -1,28 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2014 Justin Liu <rssnsj@gmail.com>
START=21
start()
{
local file
for file in /etc/ipset/*; do
[ -f $file ] || continue
ipset restore < $file
done
}
stop()
{
local file
for file in /etc/ipset/*; do
[ -f $file ] || continue
ipset destroy `basename $file`
done
}
restart()
{
stop >/dev/null 2>&1
start
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
create local hash:net family inet hashsize 1024 maxelem 65536
add local 10.0.0.0/8
add local 127.0.0.0/8
add local 172.16.0.0/12
add local 192.168.0.0/16
add local 224.0.0.0/3

View File

@ -1,8 +0,0 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Domain Lists Settings"
msgstr "域名列表设置"
msgid "Domain Lists"
msgstr "域名列表"

View File

@ -1,3 +0,0 @@
update:
./gen-china-routes.sh > ../files/etc/ipset/china
./gen-gfwlist.sh > ../files/etc/gfwlist/china-banned

File diff suppressed because it is too large Load Diff

View File

@ -1,83 +0,0 @@
#!/bin/bash -e
#
# Script for generating China IPv4 route table by merging APNIC.net data and IPIP.net data
#
china_routes_ipip()
{
[ -f ipip.txt ] || wget -4 https://cdn.jsdelivr.net/gh/17mon/china_ip_list/china_ip_list.txt -O ipip.txt >&2 || exit 1
cat ipip.txt | xargs netmask | awk '{print $1}'
}
china_routes_apnic()
{
[ -f apnic.txt ] || wget -4 http://ftp.apnic.net/stats/apnic/delegated-apnic-latest -O apnic.txt >&2 || exit 1
cat apnic.txt | awk -F'|' -vc=CN '
function tobits(c) { for(n=0; c>=2; c/=2) n++; return 32-n; }
$2==c&&$3=="ipv4" { printf("%s/%d\n", $4, tobits($5)) }' |
xargs netmask | awk '{print $1}'
}
china_routes_merged()
{
[ -x ./ipv4-merger ] || gcc ipv4_merger.c -o ipv4-merger >&2
china_routes_apnic > china.apnic
china_routes_ipip > china.ipip
# Merge them together
cat china.apnic china.ipip | ./ipv4-merger | sed 's/\-/:/g' |
xargs netmask | awk '{print $1}' | awk -F/ '$2<=24' > china.merged
cat china.merged
}
# $1: ipset name
convert_routes_to_ipset()
{
local ipset_name="$1"
echo "create $ipset_name hash:net family inet hashsize 1024 maxelem 65536"
awk -vt="$ipset_name" '{ printf("add %s %s\n", t, $0) }'
}
generate_china_ipset()
{
china_routes_merged | convert_routes_to_ipset china
}
generate_inverted_china_routes()
{
(
china_routes_merged
echo 0.0.0.0/8 10.0.0.0/8 100.64.0.0/10 127.0.0.0/8 172.16.0.0/12 192.168.0.0/16 224.0.0.0/3
) |
xargs netmask -r | awk '{print $1}' |
awk -F- '
function iptoint(ip) { split(ip,arr,"."); n=0; for(i=1;i<=4;i++) n=n*256+arr[i]; return n; }
function inttoip(n) { a=int(n/16777216); b=int(n%16777216/65536); c=int(n%65536/256); d=n%256; return a "." b "." c "." d; }
BEGIN { st=0 }
{ x=st; y=iptoint($1); st=iptoint($2)+1; if(y>x) { print inttoip(x) ":" inttoip(y-1); } }' |
xargs netmask | awk '{print $1}'
}
##
case "$1" in
"")
generate_china_ipset
;;
-c)
china_routes_merged
;;
-r)
generate_inverted_china_routes
;;
*)
echo "Usage:"
echo " $0 generate China routes in ipset format"
echo " $0 -c generate China routes in IP/prefix format"
echo " $0 -r generate invert China routes"
;;
*)
esac

View File

@ -1,27 +0,0 @@
#!/bin/sh -e
generate_china_banned()
{
if [ ! -f gfwlist.txt ]; then
wget https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O gfwlist.b64 >&2
cat gfwlist.b64 | base64 -d > gfwlist.txt
rm -f gfwlist.b64
fi
cat gfwlist.txt base-gfwlist.txt | sort -u |
sed 's#!.\+##; s#|##g; s#@##g; s#http:\/\/##; s#https:\/\/##;' |
sed '/\*/d; /apple\.com/d; /sina\.cn/d; /sina\.com\.cn/d; /baidu\.com/d; /qq\.com/d' |
sed '/^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+$/d' |
grep '^[0-9a-zA-Z\.-]\+$' | grep '\.' | sed 's#^\.\+##' | rev | sort -u |
awk '
BEGIN { prev = "________"; } {
cur = $0;
if (index(cur, prev) == 1 && substr(cur, 1 + length(prev) ,1) == ".") {
} else {
print cur;
prev = cur;
}
}' | rev | sort -u
}
generate_china_banned

View File

@ -1,338 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
typedef u_int32_t u32;
typedef int bool;
#define true 1
#define false 0
typedef unsigned gfp_t;
static inline char *ipv4_hltos(u32 u, char *s)
{
static char ss[20];
if (!s)
s = ss;
sprintf(s, "%d.%d.%d.%d",
(int)(u >> 24) & 0xff, (int)(u >> 16) & 0xff,
(int)(u >> 8) & 0xff, (int)u & 0xff );
return s;
}
static inline u32 ipv4_stohl(const char *s)
{
int u[4];
if (sscanf(s, "%d.%d.%d.%d", &u[0], &u[1], &u[2], &u[3]) == 4) {
return (((u32)u[0] & 0xff) << 24) |
(((u32)u[1] & 0xff) << 16) |
(((u32)u[2] & 0xff) << 8) |
(((u32)u[3] & 0xff));
} else
return 0xffffffff;
}
static inline bool is_ipv4_addr(const char *s)
{
int u[4];
if (sscanf(s, "%d.%d.%d.%d", &u[0], &u[1], &u[2], &u[3]) == 4)
return true;
else
return false;
}
struct ipv4_range {
u32 start;
u32 end;
};
struct sa_open_data {
struct ipv4_range *tmp_base;
size_t tmp_size;
size_t tmp_length;
int errors;
};
static int __touch_tmp_base(struct sa_open_data *od, gfp_t gfp)
{
if (!od->tmp_base) {
/**
* Allocate a temporary table with twice the size of the previous
* table or at least 100, on which new entries can be inserted.
*/
if (od->tmp_size < 100)
od->tmp_size = 100;
od->tmp_base = (struct ipv4_range *)malloc(
sizeof(struct ipv4_range) * od->tmp_size /*, gfp*/ );
if (!od->tmp_base) {
fprintf(stderr,
"salist: cannot allocate the temporary list for enlarging it.\n");
return -ENOMEM;
}
od->tmp_length = 0;
}
return 0;
}
static int ipv4_list_add_range(struct sa_open_data *od, u32 start,
u32 end, gfp_t gfp)
{
struct ipv4_range *cur;
int ret;
/* Ignore a new range if it or a larger range already exists */
//if (salist_check_ipv4(od->table, start, end))
// return 0;
if ((ret = __touch_tmp_base(od, gfp)) < 0)
return ret;
/* Check if the size is efficient. Enlarge it if needed. */
if (od->tmp_length + 1 >= od->tmp_size) {
size_t old_size = od->tmp_size;
struct ipv4_range *old_base = od->tmp_base;
od->tmp_size *= 2;
od->tmp_base = (struct ipv4_range *)realloc(od->tmp_base,
sizeof(struct ipv4_range) * od->tmp_size);
if (!od->tmp_base) {
od->tmp_size = old_size;
od->tmp_base = old_base;
return -ENOMEM;
}
}
cur = &od->tmp_base[od->tmp_length++];
cur->start = start;
cur->end = end;
return 0;
}
static inline int ipv4_list_add_netmask(struct sa_open_data *od,
u32 net, u32 net_mask, gfp_t gfp)
{
u32 start = net & net_mask;
u32 end = net | ~net_mask;
return ipv4_list_add_range(od, start, end, gfp);
}
static int ipv4_list_add_net(struct sa_open_data *od, u32 net,
int net_bits, gfp_t gfp)
{
u32 net_mask;
if(net_bits == 0)
net_mask = 0x00000000;
else
net_mask = ~(((u32)1 << (32 - net_bits)) - 1);
//printf("%d: %08x, %08x\n", net_bits, net_mask, net_size);
return ipv4_list_add_netmask(od, net, net_mask, gfp);
}
static int salist_cmd_parse(struct sa_open_data *od, char *cmd, gfp_t gfp)
{
char *a1 = NULL, *a2 = NULL;
char *sep;
char sc;
int n = 32;
/* Case 3: Append an item */
/* Check IP description part: network segment or range? */
if ((sep = strchr(cmd, '/'))) { }
else if ((sep = strchr(cmd, '-'))) { }
else if ((sep = strchr(cmd, ':'))) { }
if (sep) {
/* Describes a subnet or range. */
sc = *sep;
*sep = '\0';
a1 = cmd;
a2 = sep + 1;
if (*a2 == '\0') {
fprintf(stderr, "Nothing after '%c'.\n", sc);
return -EINVAL;
}
} else {
/* Describes a single IP. */
sc = '\0';
a1 = cmd;
}
switch (sc) {
case '/':
/* 10.10.20.0/24 */
/* ------------------------------------ */
if (is_ipv4_addr(a2)) {
ipv4_list_add_netmask(od, ipv4_stohl(a1), ipv4_stohl(a2), gfp);
} else {
sscanf(a2, "%d", &n);
ipv4_list_add_net(od, ipv4_stohl(a1), n, gfp);
}
/* ------------------------------------ */
break;
case ':':
case '-':
/* 10.10.20.0-10.20.0.255 */
/* ------------------------------------ */
ipv4_list_add_range(od, ipv4_stohl(a1), ipv4_stohl(a2), gfp);
/* ------------------------------------ */
break;
default:
if (is_ipv4_addr(a1)) {
/* Single IP address. */
u32 ip = ipv4_stohl(a1);
/* ------------------------------------ */
ipv4_list_add_range(od, ip, ip, gfp);
/* ------------------------------------ */
} else {
fprintf(stderr, "Invalid IP address '%s'.\n", a1);
return -EINVAL;
}
break;
}
return 0;
}
static int ipv4_range_sort_cmp(const void *a, const void *b)
{
struct ipv4_range *ra = (struct ipv4_range *)a;
struct ipv4_range *rb = (struct ipv4_range *)b;
if (ra->start > rb->start) {
return 1;
} else if (ra->start < rb->start) {
return -1;
} else if (ra->end > rb->end) {
return 1;
} else if (ra->end < rb->end) {
return -1;
} else {
return 0;
}
}
static void ipv4_range_swap(void *a, void *b, int size)
{
struct ipv4_range *ra = (struct ipv4_range *)a;
struct ipv4_range *rb = (struct ipv4_range *)b;
struct ipv4_range tmp;
tmp = *ra;
*ra = *rb;
*rb = tmp;
}
static struct sa_open_data *salist_open(void)
{
struct sa_open_data *od = NULL;
od = (struct sa_open_data *)malloc(sizeof(*od));
if (!od) {
fprintf(stderr, "salist: cannot allocate sa_open_data.\n");
return NULL;
}
memset(od, 0, sizeof(*od));
od->errors = 0;
return od;
}
static int salist_close(struct sa_open_data *od)
{
size_t ri, wi;
struct ipv4_range *old_base;
/* Flush the table if any modification has been done */
if (od->tmp_base) {
/* Sort the table and merge entries as many as possible. */
if (od->tmp_length >= 2) {
qsort(od->tmp_base, od->tmp_length, sizeof(struct ipv4_range),
ipv4_range_sort_cmp);
for (wi = 0, ri = 1; ri < od->tmp_length; ri++) {
/* NOTICE: 0xffffffff + 1 ? */
if (od->tmp_base[wi].end == (u32)(-1)) {
/* Nothing */
} else if (od->tmp_base[ri].start <= od->tmp_base[wi].end + 1) {
/* The two ranges overlap, so merge the 2nd to the 1st one */
if (od->tmp_base[ri].end > od->tmp_base[wi].end)
od->tmp_base[wi].end = od->tmp_base[ri].end;
} else {
wi++;
if (wi < ri)
od->tmp_base[wi] = od->tmp_base[ri];
}
}
od->tmp_length = wi + 1;
}
/* Reduce the size */
if (od->tmp_length < od->tmp_size) {
struct ipv4_range *__tmp = od->tmp_base;
od->tmp_base = (struct ipv4_range *)malloc(
sizeof(struct ipv4_range) * (od->tmp_length ? od->tmp_length : 1));
if (od->tmp_base) {
memcpy(od->tmp_base, __tmp,
sizeof(struct ipv4_range) * od->tmp_length);
free(__tmp);
} else {
fprintf(stderr, "[%s:%d] Failed to allocate temporary table.\n",
__FUNCTION__, __LINE__);
/* If failed to allocate new memory, do not reduce it. */
od->tmp_base = __tmp;
}
}
/* Dump the table instead */
}
if (od->errors) {
fprintf(stderr, "[%s] %d errors detected during table operation.\n",
__FUNCTION__, od->errors);
}
return 0;
}
static void sa_open_data_dump(struct sa_open_data *od)
{
size_t i;
char s1[20], s2[20];
for (i = 0; i < od->tmp_length; i++) {
printf("%s-%s\n", ipv4_hltos(od->tmp_base[i].start, s1),
ipv4_hltos(od->tmp_base[i].end, s2));
}
}
int main(int argc, char *argv[])
{
struct sa_open_data *od;
char lbuf[128];
od = salist_open();
while (fgets(lbuf, sizeof(lbuf), stdin)) {
size_t llen = strlen(lbuf);
if (llen > 0 && lbuf[llen - 1] == '\n')
lbuf[--llen] = '\0';
if (llen > 0 && lbuf[llen - 1] == '\r')
lbuf[--llen] = '\0';
if (llen == 0)
continue;
salist_cmd_parse(od, lbuf, 0);
}
salist_close(od);
sa_open_data_dump(od);
return 0;
}

View File

@ -1,139 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ksmbd-tools
PKG_VERSION:=3.2.6
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/cifsd-team/ksmbd-tools/tar.gz/$(PKG_VERSION)?
PKG_HASH:=595029adb899fd8b4c49bea75bce4e3c3466811ef7089b2a55960174e720d919
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=autogen.sh
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=glib2
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
TAR_OPTIONS+= --strip-components 1
TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
define Package/ksmbd-tools/Default
SECTION:=net
CATEGORY:=Network
SUBMENU:=Filesystem
TITLE:=Kernel SMB
URL:=https://github.com/cifsd-team/cifsd-tools
DEPENDS:= $(ICONV_DEPENDS) $(INTL_DEPENDS)
endef
define Package/ksmbd-tools/Default/description
Userspace tools to manage the SMB kernel fileserver (ksmbd.ko).
The config file location is /etc/ksmbd/smb.conf
endef
define Package/ksmbd-server
$(call Package/ksmbd-tools/Default)
TITLE+= server
DEPENDS+= +kmod-fs-ksmbd +libnl-core +libnl-genl
endef
define Package/ksmbd-server/description
installs: ksmbd.mountd
This provides the basic fileserver service and is the minimum needed to serve 'guest only' file shares or use a existing user database file ksmbdpwd.db.
endef
define Package/ksmbd-server/config
select PACKAGE_wsdd2
endef
define Package/ksmbd-utils
$(call Package/ksmbd-tools/Default)
TITLE+= user management-util
endef
define Package/ksmbd-utils/description
installs: ksmbd.adduser (ksmbd.addshare)
Tool needed to create the ksmbdpwd.db, to manage per user share passwords.
NOTE: Not needed for 'guest only' shares.
endef
define Package/ksmbd-utils/config
config KSMBD_UTILS_SHAREADD
bool "Add ksmbd.addshare util"
depends on PACKAGE_ksmbd-utils
help
Add the ksmbd.addshare tool, to directly manipulate the /etc/ksmbd/smb.conf.
default n
endef
define Package/ksmbd-avahi-service
$(call Package/ksmbd-tools/Default)
TITLE+= (Avahi service)
DEPENDS:= +avahi-daemon
endef
define Package/ksmbd-avahi-service/description
installs: smb.service
This package contains the service definition for announcing the
Ksmbd (smb/445) Daemon service via mDNS/DNS-SD.
endef
CONFIGURE_ARGS += \
--disable-shared \
--enable-static
CONFIGURE_VARS += GLIB_LIBS="$(STAGING_DIR)/usr/lib/libglib-2.0.a"
TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed -liconv $(if $(INTL_FULL),-lintl)
define Package/ksmbd-server/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ksmbd.mountd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/ksmbd $(1)/etc/init.d
$(INSTALL_CONF) ./files/ksmbd.config $(1)/etc/config/ksmbd
$(INSTALL_DATA) ./files/smb.conf.template $(1)/etc/ksmbd/
$(INSTALL_BIN) ./files/ksmbd.init $(1)/etc/init.d/ksmbd
# copy examples until we have a wiki page
$(INSTALL_DATA) ./files/ksmbd.config.example $(1)/etc/ksmbd/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/Documentation/configuration.txt $(1)/etc/ksmbd/
endef
define Package/ksmbd-utils/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ksmbd.adduser $(1)/usr/sbin/
ifeq ($(CONFIG_KSMBD_UTILS_SHAREADD),y)
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ksmbd.addshare $(1)/usr/sbin/
endif
endef
define Package/ksmbd-avahi-service/install
$(INSTALL_DIR) $(1)/etc/avahi/services
$(INSTALL_DATA) ./files/smb.service $(1)/etc/avahi/services/
endef
define Package/ksmbd-server/conffiles
/etc/config/ksmbd
/etc/ksmbd/smb.conf.template
/etc/ksmbd/smb.conf
/etc/ksmbd/ksmbdpwd.db
endef
define Package/ksmbd-avahi-service/conffiles
/etc/avahi/services/smb.service
endef
$(eval $(call BuildPackage,ksmbd-server))
$(eval $(call BuildPackage,ksmbd-utils))
$(eval $(call BuildPackage,ksmbd-avahi-service))

View File

@ -1,7 +0,0 @@
config globals
option workgroup 'WORKGROUP'
option description 'OpenWrt'
option name 'OpenWrt'
option autoshare '0'

View File

@ -1,11 +0,0 @@
config globals
option 'description' 'Ksmbd on OpenWrt'
config share
option name 'testshare'
option path '/tmp'
option read_only 'no'
option guest_ok 'yes'
option create_mask '0666'
option dir_mask '0777'
option force_root '1'

View File

@ -1,207 +0,0 @@
#!/bin/sh /etc/rc.common
START=98
USE_PROCD=1
SMBD_IFACE=""
smb_header()
{
config_get SMBD_IFACE $1 interface "lan"
# resolve interfaces
local interfaces
interfaces=$(
. /lib/functions/network.sh
local net
for net in $SMBD_IFACE; do
local device
network_is_up $net || continue
network_get_device device "$net"
echo -n "${device:-$net} "
done
)
local workgroup description
local hostname
hostname="$(cat /proc/sys/kernel/hostname)"
config_get workgroup $1 workgroup "WORKGROUP"
config_get description $1 description "Ksmbd on OpenWrt"
config_get_bool ALLOW_LEGACY_PROTOCOLS $1 allow_legacy_protocols 0
sed -e "s#|NAME|#$hostname#g" \
-e "s#|WORKGROUP|#$workgroup#g" \
-e "s#|DESCRIPTION|#$description#g" \
-e "s#|INTERFACES|#$interfaces#g" \
/etc/ksmbd/smb.conf.template > /var/etc/ksmbd/smb.conf
{
printf "\n######### Dynamic written config options #########\n"
if [ "$ALLOW_LEGACY_PROTOCOLS" -eq 1 ]; then
logger -p daemon.info -t 'ksmbd' "Legacy Protocols allowed, don't use this option for secure environments!"
printf "\tserver min protocol = NT1\n"
printf "\tserver signing = disabled\n"
fi
} >> /var/etc/ksmbd/smb.conf
[ -e /etc/ksmbd/smb.conf ] || ln -nsf /var/etc/ksmbd/smb.conf /etc/ksmbd/smb.conf
if [ ! -L /etc/ksmbd/smb.conf ]; then
logger -p daemon.warn -t 'ksmbd' "Local custom /etc/ksmbd/smb.conf file detected, all UCI/Luci config settings are ignored!"
fi
}
smb_add_share()
{
local name
local path
local comment
local users
local create_mask
local dir_mask
local browseable
local read_only
local writeable
local guest_ok
local force_root
local write_list
local read_list
local hide_dot_files
local veto_files
local inherit_owner
local force_create_mode
local force_directory_mode
config_get name $1 name
config_get path $1 path
config_get comment $1 comment
config_get users $1 users
config_get create_mask $1 create_mask
config_get dir_mask $1 dir_mask
config_get browseable $1 browseable
config_get read_only $1 read_only
config_get writeable $1 writeable
config_get guest_ok $1 guest_ok
config_get_bool force_root $1 force_root 0
config_get write_list $1 write_list
config_get read_list $1 read_list
config_get hide_dot_files $1 hide_dot_files
config_get veto_files $1 veto_files
config_get inherit_owner $1 inherit_owner
config_get force_create_mode $1 force_create_mode
config_get force_directory_mode $1 force_directory_mode
[ -z "$name" ] || [ -z "$path" ] && return
{
printf "\n[%s]\n\tpath = %s\n" "$name" "$path"
[ -n "$comment" ] && printf "\tcomment = %s\n" "$comment"
if [ "$force_root" -eq 1 ]; then
printf "\tforce user = %s\n" "root"
printf "\tforce group = %s\n" "root"
else
[ -n "$users" ] && printf "\tvalid users = %s\n" "$users"
fi
[ -n "$create_mask" ] && printf "\tcreate mask = %s\n" "$create_mask"
[ -n "$dir_mask" ] && printf "\tdirectory mask = %s\n" "$dir_mask"
[ -n "$force_create_mode" ] && printf "\tforce create mode = %s\n" "$force_create_mode"
[ -n "$force_directory_mode" ] && printf "\tforce directory mode = %s\n" "$force_directory_mode"
[ -n "$browseable" ] && printf "\tbrowseable = %s\n" "$browseable"
[ -n "$read_only" ] && printf "\tread only = %s\n" "$read_only"
[ -n "$writeable" ] && printf "\twriteable = %s\n" "$writeable"
[ -n "$guest_ok" ] && printf "\tguest ok = %s\n" "$guest_ok"
[ -n "$inherit_owner" ] && printf "\tinherit owner = %s\n" "$inherit_owner"
[ -n "$write_list" ] && printf "\twrite list = %s\n" "$write_list"
[ -n "$read_list" ] && printf "\tread list = %s\n" "$read_list"
[ -n "$hide_dot_files" ] && printf "\thide dot files = %s\n" "$hide_dot_files"
[ -n "$veto_files" ] && printf "\tveto files = %s\n" "$veto_files"
} >> /var/etc/ksmbd/smb.conf
}
init_config()
{
mkdir -p /var/etc/ksmbd
config_load ksmbd
config_foreach smb_header globals
config_foreach smb_add_share share
}
service_triggers()
{
# PROCD_RELOAD_DELAY=1000
procd_add_reload_trigger "dhcp" "system" "ksmbd"
local i
for i in $SMBD_IFACE; do
procd_add_reload_interface_trigger $i
done
}
kill_server()
{
if [ -e /sys/module/ksmbd ]; then
if [ -e /sys/class/ksmbd-control/kill_server ]; then
logger -p daemon.info -t 'ksmbd' "triggering kill_server"
echo hard > /sys/class/ksmbd-control/kill_server
fi
fi
}
start_service()
{
init_config
if [ ! -e /etc/ksmbd/smb.conf ]; then
logger -p daemon.error -t 'ksmbd' "missing config /etc/ksmbd/smb.conf!"
exit 1
fi
# NOTE: We don't do a soft-reload via signal, since [global] smb.conf setting changes will be ignored, so always reset hard.
kill_server
[ ! -e /sys/module/ksmbd ] && modprobe ksmbd 2> /dev/null
if [ ! -e /sys/module/ksmbd ]; then
logger -p daemon.error -t 'ksmbd' "modprobe of ksmbd module failed, can\'t start ksmbd!"
exit 1
fi
logger -p daemon.notice -t 'ksmbd' "Starting Ksmbd userspace service."
procd_open_instance
procd_add_mdns "smb" "tcp" "445"
procd_set_param command /usr/sbin/ksmbd.mountd --n
procd_set_param file /etc/ksmbd/smb.conf
procd_set_param limits nofile=16384
procd_close_instance
}
stop_service()
{
logger -p daemon.notice -t 'ksmbd' "Stopping Ksmbd userspace service."
killall ksmbd.mountd > /dev/null 2>&1
[ -e /sys/module/ksmbd ] && rmmod ksmbd > /dev/null 2>&1
# kill server if we cant rmmod
[ -e /sys/module/ksmbd ] && kill_server
# next try
[ -e /sys/module/ksmbd ] && rmmod ksmbd > /dev/null 2>&1
if [ -e /sys/module/ksmbd ]; then
logger -p daemon.error -t 'ksmbd' "module still loaded after kill_server?"
fi
[ -f /tmp/ksmbd.lock ] && rm /tmp/ksmbd.lock
}
# reload_service() {
# restart "$@"
# }

View File

@ -1,14 +0,0 @@
[global]
netbios name = |NAME|
server string = |DESCRIPTION|
workgroup = |WORKGROUP|
interfaces = |INTERFACES|
bind interfaces only = yes
ipc timeout = 20
deadtime = 15
map to guest = Bad User
smb2 max read = 64K
smb2 max write = 64K
smb2 max trans = 64K
cache read buffers = no
cache trans buffers = no

View File

@ -1,9 +0,0 @@
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_smb._tcp</type>
<port>445</port>
</service>
</service-group>

View File

@ -1,70 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ksmbd
PKG_VERSION:=3.1.6
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/cifsd-team/cifsd/archive/$(PKG_VERSION)/
PKG_HASH:=09c1eb39d9dcc9baf6bc9c5a2b91bcea377352bfc507ebdd10a370fffa7c31b4
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
TAR_OPTIONS+= --strip-components 1
TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
define KernelPackage/fs-ksmbd
SUBMENU:=Filesystems
TITLE:=SMB kernel server support
URL:=https://github.com/cifsd-team/cifsd
FILES:=$(PKG_BUILD_DIR)/ksmbd.ko
DEPENDS:= \
+kmod-nls-base \
+kmod-nls-utf8 \
+kmod-crypto-md4 \
+kmod-crypto-md5 \
+kmod-crypto-hmac \
+kmod-crypto-arc4 \
+kmod-crypto-ecb \
+kmod-crypto-des \
+kmod-crypto-sha256 \
+kmod-crypto-cmac \
+kmod-crypto-sha512 \
+kmod-crypto-aead \
+kmod-crypto-ccm \
+kmod-crypto-gcm
endef
define KernelPackage/fs-ksmbd/description
Ksmbd is an In-kernel SMBv(1)2/3 fileserver.
It's an implementation of the SMB protocol in kernel space for sharing files and IPC services over network.
endef
define KernelPackage/fs-ksmbd/config
config KSMBD_SMB_INSECURE_SERVER
bool "Support for insecure SMB1/CIFS and SMB2.0 protocols"
depends on PACKAGE_kmod-fs-ksmbd
help
This enables deprecated insecure protocols dialects: SMB1/CIFS and SMB2.0.
default y
endef
ifeq ($(CONFIG_KSMBD_SMB_INSECURE_SERVER),y)
PKG_EXTRA_KCONFIG:=CONFIG_SMB_INSECURE_SERVER=y
EXTRA_CFLAGS += -DCONFIG_SMB_INSECURE_SERVER=1
endif
define Build/Compile
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
$(PKG_EXTRA_KCONFIG) \
CONFIG_SMB_SERVER=m \
modules
endef
$(eval $(call KernelPackage,fs-ksmbd))

View File

@ -1,10 +0,0 @@
--- a/glob.h 2019-12-08
+++ b/glob.h 2019-12-08
@@ -7,6 +7,8 @@
#ifndef __KSMBD_GLOB_H
#define __KSMBD_GLOB_H
+#undef CONFIG_MODULE_STRIPPED
+
#include <linux/ctype.h>
#include <linux/version.h>

View File

@ -1,70 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ksmbd
PKG_VERSION:=3.2.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/cifsd-team/cifsd/tar.gz/$(PKG_VERSION)?
PKG_HASH:=16ad304c09d5f04ddbe99d21ca9df8a9a6d8e35b21ff0e205f212f8c545b979b
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
TAR_OPTIONS+= --strip-components 1
TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
define KernelPackage/fs-ksmbd
SUBMENU:=Filesystems
TITLE:=SMB kernel server support
URL:=https://github.com/cifsd-team/cifsd
FILES:=$(PKG_BUILD_DIR)/ksmbd.ko
DEPENDS:= \
+kmod-nls-base \
+kmod-nls-utf8 \
+kmod-crypto-md4 \
+kmod-crypto-md5 \
+kmod-crypto-hmac \
+kmod-crypto-arc4 \
+kmod-crypto-ecb \
+kmod-crypto-des \
+kmod-crypto-sha256 \
+kmod-crypto-cmac \
+kmod-crypto-sha512 \
+kmod-crypto-aead \
+kmod-crypto-ccm \
+kmod-crypto-gcm
endef
define KernelPackage/fs-ksmbd/description
Ksmbd is an In-kernel SMBv(1)2/3 fileserver.
It's an implementation of the SMB protocol in kernel space for sharing files and IPC services over network.
endef
define KernelPackage/fs-ksmbd/config
config KSMBD_SMB_INSECURE_SERVER
bool "Support for insecure SMB1/CIFS and SMB2.0 protocols"
depends on PACKAGE_kmod-fs-ksmbd
help
This enables deprecated insecure protocols dialects: SMB1/CIFS and SMB2.0.
default y
endef
ifeq ($(CONFIG_KSMBD_SMB_INSECURE_SERVER),y)
PKG_EXTRA_KCONFIG:=CONFIG_SMB_INSECURE_SERVER=y
EXTRA_CFLAGS += -DCONFIG_SMB_INSECURE_SERVER=1
endif
define Build/Compile
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
$(PKG_EXTRA_KCONFIG) \
CONFIG_SMB_SERVER=m \
modules
endef
$(eval $(call KernelPackage,fs-ksmbd))

View File

@ -1,11 +0,0 @@
--- a/glob.h
+++ b/glob.h
@@ -7,6 +7,8 @@
#ifndef __KSMBD_GLOB_H
#define __KSMBD_GLOB_H
+#undef CONFIG_MODULE_STRIPPED
+
#include <linux/ctype.h>
#include <linux/version.h>

View File

@ -1,93 +0,0 @@
#
# Copyright (C) 2017-2018 Daniel Engberg <daniel.engberg.lists@pyret.net>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libidn2
PKG_VERSION:=2.0.4
PKG_RELEASE:=1
PKG_MAINTAINER:=Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
PKG_LICENSE:=GPL-2.0-or-later LGPL-3.0-or-later
PKG_LICENSE_FILES:=COPYING COPYINGv2 COPYING.LESSERv3
PKG_SOURCE_URL:=@GNU/libidn
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_HASH:=644b6b03b285fb0ace02d241d59483d98bc462729d8bb3608d5cad5532f3d2f0
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
define Package/idn2/Default
SECTION:=net
CATEGORY:=Network
URL:=http://www.gnu.org/software/libidn/
endef
define Package/idn2/Default/description
Libidn2 is a free software implementation of IDNA2008,
Punycode and TR46 in library form. It contains
functionality to convert internationalized domain
names to and from ASCII Compatible Encoding (ACE),
following the IDNA2008 and TR46 standards.
endef
define Package/idn2
$(call Package/idn2/Default)
SUBMENU:=IP Addresses and Names
TITLE:=GNU IDN2 (Internationalized Domain Name) tool
DEPENDS:=+libidn2
endef
define Package/idn2/description
$(call Package/idn2/Default/description)
Command line tool using libidn2
endef
define Package/libidn2
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libunistring $(ICONV_DEPENDS) $(INTL_DEPENDS)
TITLE:=International domain name library (IDNA2008, Punycode and TR46)
URL:=https://www.gnu.org/software/libidn/#libidn2
endef
define Package/libidn2/description
$(call Package/idn2/Default/description)
Library only package
endef
CONFIGURE_ARGS += \
--disable-rpath \
--disable-doc
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/idn2.h $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{la,so}* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libidn2.pc $(1)/usr/lib/pkgconfig/
endef
define Package/idn2/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
endef
define Package/libidn2/install
$(INSTALL_DIR) $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,idn2))
$(eval $(call BuildPackage,libidn2))

View File

@ -1,46 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=wsdd2
PKG_RELEASE:=5
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/Andy2244/wsdd2.git
PKG_SOURCE_DATE:=2019-12-15
PKG_SOURCE_VERSION:=8bcc0c1a42767ba518977a7104fe934f5d89ef31
PKG_MIRROR_HASH:=4eace9130b7e1ddbc5b965fa51286532d3ee2ee14bcd2e116840c7d6d48ad9bc
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
PKG_LICENSE:=GPL-3.0-only
PKG_LICENSE_FILES:=COPYING
include $(INCLUDE_DIR)/package.mk
define Package/wsdd2
SECTION:=net
CATEGORY:=Network
SUBMENU:=IP Addresses and Names
TITLE:=Web Services for Devices (WSD) daemon
URL:=https://kb.netgear.com/2649/NETGEAR-Open-Source-Code-for-Programmers-GPL
endef
define Package/wsdd2/description
Web Services for Devices or Web Services on Devices (WSD),
is a Microsoft API to simplify programming connections to web service
enabled devices, such as printers, scanners and file shares.
This daemon advertises and responds to probe requests from Windows clients looking for file shares.
It also implements LLMNR multicast name lookup services.
endef
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(PKG_BUILD_DIR)/{wsdd2.c,wsd.c,llmnr.c} -o $(PKG_BUILD_DIR)/wsdd2
endef
define Package/wsdd2/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wsdd2 $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/wsdd2.init $(1)/etc/init.d/wsdd2
endef
$(eval $(call BuildPackage,wsdd2))

View File

@ -1,86 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
SMB_CONF=""
BIND_IF_PARM=""
NB_PARM=""
WG_PARM=""
BI_PARM=""
start_service() {
. /lib/functions/network.sh
if [ -e /etc/ksmbd/smb.conf ] && [ -e /etc/init.d/ksmbd ] && /etc/init.d/ksmbd running; then
SMB_CONF="/etc/ksmbd/smb.conf"
fi
if [ -e /etc/samba/smb.conf ]; then
if [ -e /etc/init.d/samba4 ] && /etc/init.d/samba4 running; then
SMB_CONF="/etc/samba/smb.conf"
elif [ -e /etc/init.d/samba ] && /etc/init.d/samba running; then
SMB_CONF="/etc/samba/smb.conf"
fi
fi
if [ -z "$SMB_CONF" ]; then
logger -p daemon.error -t 'wsdd2' "samba36/4 or ksmbd is not running, can't start wsdd2!"
exit 1
fi
local nb_name
nb_name="$(grep -i 'netbios name' $SMB_CONF | awk -F'=' '{print $2}' | tr -d ' \n')"
if [ -n "$nb_name" ]; then
NB_PARM="-N $nb_name"
else
local hostname
hostname="$(cat /proc/sys/kernel/hostname)"
NB_PARM="-N $hostname"
fi
local wg_name
wg_name="$(grep -i 'workgroup' $SMB_CONF | awk -F'=' '{print $2}' | tr -d ' \n')"
if [ -n "$wg_name" ]; then
WG_PARM="-G $wg_name"
else
WG_PARM="-G WORKGROUP"
fi
# resolve lan interface (BUG: No multi-interface binds atm)
local ifname
if network_get_device ifname lan; then
BIND_IF_PARM="-i $ifname"
fi
local board_vendor
local board_model
local board_sku
if [ -e /tmp/sysinfo/board_name ]; then
board_vendor="$(cat /tmp/sysinfo/board_name | awk -F',' '{print $1}' | tr ' ' '_' | tr -d ' \n' | tr ':' '_' | tr ',' '_')"
board_sku="$(cat /tmp/sysinfo/board_name | awk -F',' '{print $2}' | tr ' ' '_' | tr -d ' \n' | tr ':' '_' | tr ',' '_')"
fi
if [ -e /tmp/sysinfo/model ]; then
board_model="$(cat /tmp/sysinfo/model | tr ' ' '_' | tr -d ' \n' | tr ':' '_' | tr ',' '_')"
fi
if [ -n "$board_vendor" ] && [ -n "$board_model" ]; then
if [ -n "$board_sku" ]; then
BI_PARM="-b vendor:$board_vendor,model:$board_model,sku:$board_sku"
else
BI_PARM="-b vendor:$board_vendor,model:$board_model"
fi
fi
procd_open_instance
procd_set_param command /usr/bin/wsdd2 -w $BIND_IF_PARM $NB_PARM $WG_PARM $BI_PARM
procd_set_param respawn
procd_set_param file $SMB_CONF
procd_close_instance
}
service_triggers() {
PROCD_RELOAD_DELAY=1000
procd_add_reload_trigger "dhcp" "system" "samba" "samba4" "ksmbd"
}