Add WireGuard support with wg-quick
This commit is contained in:
parent
a16f7a8821
commit
83d09c39c7
5 changed files with 84 additions and 2 deletions
|
@ -62,7 +62,7 @@
|
|||
OPENVPN_SUPPORT="no"
|
||||
|
||||
# build and install WireGuard support (yes / no)
|
||||
WIREGUARD_SUPPORT="no"
|
||||
WIREGUARD_SUPPORT="yes"
|
||||
|
||||
# build and install diskmounter support (udevil)
|
||||
# this service provide auto mounting support for external drives in the
|
||||
|
|
|
@ -25,6 +25,7 @@ makeinstall_target() {
|
|||
mkdir -p $INSTALL/usr/bin
|
||||
cp $PKG_DIR/scripts/wg-keygen $INSTALL/usr/bin
|
||||
cp $PKG_BUILD/src/wg $INSTALL/usr/bin
|
||||
cp $PKG_BUILD/src/wg-quick/linux.bash $INSTALL/usr/bin/wg-quick
|
||||
|
||||
mkdir -p $INSTALL/usr
|
||||
cp -R $PKG_DIR/config $INSTALL/usr
|
||||
|
|
|
@ -298,7 +298,7 @@ CONFIG_FEATURE_FANCY_SLEEP=y
|
|||
# CONFIG_SPLIT is not set
|
||||
# CONFIG_FEATURE_SPLIT_FANCY is not set
|
||||
CONFIG_STAT=y
|
||||
# CONFIG_FEATURE_STAT_FORMAT is not set
|
||||
CONFIG_FEATURE_STAT_FORMAT=y
|
||||
# CONFIG_FEATURE_STAT_FILESYSTEM is not set
|
||||
# CONFIG_STTY is not set
|
||||
# CONFIG_SUM is not set
|
||||
|
|
|
@ -160,6 +160,9 @@ makeinstall_target() {
|
|||
# create /etc/hostname
|
||||
ln -sf /proc/sys/kernel/hostname ${INSTALL}/etc/hostname
|
||||
|
||||
# create folder for named tables support
|
||||
ln -sf /storage/.config/iproute2 $INSTALL/etc/iproute2
|
||||
|
||||
# add webroot
|
||||
mkdir -p ${INSTALL}/usr/www
|
||||
echo "It works" > ${INSTALL}/usr/www/index.html
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
kkoshelev@gmail.com
|
||||
Those to support ip commands needed by wg-quick script.
|
||||
1. "ip rule" now supports "not" keyword.
|
||||
2. "ip" command now supports arbitrary numeric routing tables above 1024.
|
||||
|
||||
--- a/networking/libiproute/iprule.c 2021-01-01 05:30:02.000000000 -0800
|
||||
+++ b/iprule.c 2022-05-10 16:32:10.781087924 -0700
|
||||
@@ -19,6 +19,7 @@
|
||||
/* from <linux/fib_rules.h>: */
|
||||
#define FRA_SUPPRESS_IFGROUP 13
|
||||
#define FRA_SUPPRESS_PREFIXLEN 14
|
||||
+#define FIB_RULE_INVERT 0x00000002
|
||||
|
||||
#include "ip_common.h" /* #include "libbb.h" is inside */
|
||||
#include "rt_names.h"
|
||||
@@ -31,18 +32,18 @@
|
||||
|
||||
/* If you add stuff here, update iprule_full_usage */
|
||||
static const char keywords[] ALIGN1 =
|
||||
- "from\0""to\0""preference\0""order\0""priority\0"
|
||||
+ "not\0""from\0""to\0""preference\0""order\0""priority\0"
|
||||
"tos\0""fwmark\0""realms\0""table\0""lookup\0"
|
||||
"suppress_prefixlength\0""suppress_ifgroup\0"
|
||||
"dev\0""iif\0""nat\0""map-to\0""type\0""help\0"
|
||||
;
|
||||
-#define keyword_preference (keywords + sizeof("from") + sizeof("to"))
|
||||
+#define keyword_preference (keywords + sizeof("not") + sizeof("from") + sizeof("to"))
|
||||
#define keyword_fwmark (keyword_preference + sizeof("preference") + sizeof("order") + sizeof("priority") + sizeof("tos"))
|
||||
#define keyword_realms (keyword_fwmark + sizeof("fwmark"))
|
||||
#define keyword_suppress_prefixlength (keyword_realms + sizeof("realms") + sizeof("table") + sizeof("lookup"))
|
||||
#define keyword_suppress_ifgroup (keyword_suppress_prefixlength + sizeof("suppress_prefixlength"))
|
||||
enum {
|
||||
- ARG_from = 1, ARG_to, ARG_preference, ARG_order, ARG_priority,
|
||||
+ ARG_not = 1, ARG_from, ARG_to, ARG_preference, ARG_order, ARG_priority,
|
||||
ARG_tos, ARG_fwmark, ARG_realms, ARG_table, ARG_lookup,
|
||||
ARG_suppress_prefixlength, ARG_suppress_ifgroup,
|
||||
ARG_dev, ARG_iif, ARG_nat, ARG_map_to, ARG_type, ARG_help,
|
||||
@@ -78,6 +79,10 @@
|
||||
printf("%u:\t", tb[RTA_PRIORITY] ?
|
||||
*(unsigned*)RTA_DATA(tb[RTA_PRIORITY])
|
||||
: 0);
|
||||
+
|
||||
+ if (r->rtm_flags & FIB_RULE_INVERT)
|
||||
+ printf("not ");
|
||||
+
|
||||
printf("from ");
|
||||
if (tb[RTA_SRC]) {
|
||||
if (r->rtm_src_len != host_len) {
|
||||
@@ -230,7 +235,9 @@
|
||||
key = index_in_substrings(keywords, *argv) + 1;
|
||||
if (key == 0) /* no match found in keywords array, bail out. */
|
||||
invarg_1_to_2(*argv, applet_name);
|
||||
- if (key == ARG_from) {
|
||||
+ if (key == ARG_not) {
|
||||
+ req.r.rtm_flags |= FIB_RULE_INVERT;
|
||||
+ } else if (key == ARG_from) {
|
||||
inet_prefix dst;
|
||||
NEXT_ARG();
|
||||
get_prefix(&dst, *argv, req.r.rtm_family);
|
||||
--- a/networking/libiproute/rt_names.c 2021-01-01 05:30:02.000000000 -0800
|
||||
+++ b/rt_names.c 2022-05-10 16:50:30.298597124 -0700
|
||||
@@ -251,7 +251,14 @@
|
||||
int FAST_FUNC rtnl_rttable_a2n(uint32_t *id, char *arg)
|
||||
{
|
||||
rtnl_rttable_initialize();
|
||||
- return rtnl_a2n(rtnl_rttable_tab, id, arg, 0);
|
||||
+ if (!rtnl_a2n(rtnl_rttable_tab, id, arg, 0)) return 0;
|
||||
+
|
||||
+ unsigned i = bb_strtou(arg, NULL, 0);
|
||||
+ if (i > RT_TABLE_MAX) {
|
||||
+ *id = i;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in a new issue