netifd: don't touch interfaces that with none proto

This commit is contained in:
jjm2473 2022-04-19 17:15:51 +08:00
parent f22f089c47
commit 4347c6ec07
2 changed files with 54 additions and 1 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=netifd PKG_NAME:=netifd
PKG_RELEASE:=1 PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git

View File

@ -0,0 +1,53 @@
From 5233a5c4e27a4d2dd311da5f12ce910d81583127 Mon Sep 17 00:00:00 2001
From: jjm2473 <1129525450@qq.com>
Date: Tue, 19 Apr 2022 17:05:41 +0800
Subject: [PATCH] don't touch interfaces that with none proto
some interfaces like docker0 just for firewall handling, generated by dockerd, should not be touched
---
interface.c | 2 +-
proto.c | 2 +-
proto.h | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/interface.c b/interface.c
index b3bb601..55f8e84 100644
--- a/interface.c
+++ b/interface.c
@@ -647,7 +647,7 @@ interface_claim_device(struct interface *iface)
interface_add_user(&iface->parent_iface, parent);
} else if (iface->device &&
!(iface->proto_handler->flags & PROTO_FLAG_NODEV)) {
- dev = device_get(iface->device, true);
+ dev = device_get(iface->device, (iface->proto_handler->flags & PROTO_FLAG_EXTDEV)?2:1);
interface_set_device_config(iface, dev);
} else {
dev = iface->ext_dev.dev;
diff --git a/proto.c b/proto.c
index 01473f2..2838a91 100644
--- a/proto.c
+++ b/proto.c
@@ -565,7 +565,7 @@ default_proto_attach(const struct proto_handler *h,
static const struct proto_handler no_proto = {
.name = "none",
- .flags = PROTO_FLAG_IMMEDIATE,
+ .flags = PROTO_FLAG_IMMEDIATE|PROTO_FLAG_EXTDEV,
.attach = default_proto_attach,
};
diff --git a/proto.h b/proto.h
index 26a54bd..31b619b 100644
--- a/proto.h
+++ b/proto.h
@@ -40,6 +40,7 @@ enum {
PROTO_FLAG_LASTERROR = (1 << 5),
PROTO_FLAG_TEARDOWN_ON_L3_LINK_DOWN = (1 << 6),
PROTO_FLAG_NO_TASK = (1 << 7),
+ PROTO_FLAG_EXTDEV = (1 << 8),
};
struct interface_proto_state {
--
2.24.3 (Apple Git-128)