🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=docker-lan-bridge
PKG_VERSION:=1.0.1
PKG_RELEASE:=1
PKG_MAINTAINER:=jjm2473 <jjm2473@gmail.com>
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
TITLE:=Docker LAN Bridge
PKGARCH:=all
DEPENDS:=+ip-full
URL:=https://github.com/linkease/openwrt-app-actions
endef
define Package/$(PKG_NAME)/description
Facilitates bridging Docker containers to the LAN
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/etc/uci-defaults $(1)/etc/init.d $(1)/etc/hotplug.d/net
$(INSTALL_CONF) ./files/docker-lan.uci $(1)/etc/uci-defaults/docker-lan
$(INSTALL_BIN) ./files/docker-lan.init $(1)/etc/init.d/docker-lan
$(INSTALL_DATA) ./files/docker-lan.hotplug $(1)/etc/hotplug.d/net/11-docker-lan
endef
$(eval $(call BuildPackage,docker-lan-bridge))
@@ -0,0 +1,2 @@
[ "$ACTION" = add -a "$DEVICENAME" = br-lan ] && ip link set docker-lan-d master docker-lan
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh /etc/rc.common
START=15
boot() {
ip link add docker-lan type bridge
ip link add docker-lan-op type veth peer name docker-lan-d
ip link set docker-lan-d master docker-lan
ip link set docker-lan-op up
ip link set docker-lan-d up
}
start() {
# in case docker-lan was destroyed
ip link add docker-lan type bridge 2>/dev/null
ip link set docker-lan-d master docker-lan 2>/dev/null
docker network inspect docker-lan -f '{{.Name}}' >/dev/null 2>&1 && return 0
local lanip=`ip addr show dev br-lan | grep -m1 'inet ' | head -1 | sed -nE 's#.*inet ([0-9\.]*)/([0-9]*) .*#\1#p'`
local dockerip=172.25.1
if [ -n "$lanip" ]; then
local lanip3=`echo "$lanip" | cut -d. -f3`
local lanip4=`echo "$lanip" | cut -d. -f4`
dockerip=172.$(( $lanip3 & 7 | 24 )).$lanip4
fi
docker network create --subnet $dockerip.0/24 --gateway $dockerip.1 --ip-range $dockerip.0/25 \
-d bridge -o com.docker.network.bridge.name=docker-lan docker-lan
}
+38
View File
@@ -0,0 +1,38 @@
#!/bin/sh
/etc/init.d/docker-lan boot 2>/dev/null
uci_find_section()
{
local config="$1"
local type="$2"
local key="$3"
local value="$4"
local section
uci show $config | grep -E '^'$config'\.[^\.]+\.'$key'='"'$value'"'$' | sed 's/\.'$key'='"'$value'"'$//' | while read section; do
[ "$type" = "`uci get "$section"`" ] && echo $section
done
}
section=`uci_find_section network device name br-lan | head -n1`
if [ -n "$section" ]; then
uci get "$section.ports" | grep -wq docker-lan-op || uci add_list "$section.ports=docker-lan-op"
else
ifnames="`uci get network.lan.device`"
if [ -n "$ifnames" ]; then
echo "$ifnames" | grep -wq docker-lan-op || {
ifnames="$ifnames docker-lan-op"
uci set network.lan.device="$ifnames"
uci set network.lan.type='bridge'
}
else
echo "uci get lan ports failed!" >&2
exit 1
fi
fi
uci commit network
/etc/init.d/network reload
exit 0