Page MenuHomeFreeBSD

D52335.1778494561.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D52335.1778494561.diff

diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -526,7 +526,7 @@
#define V_member_ifaddrs VNET(member_ifaddrs)
SYSCTL_BOOL(_net_link_bridge, OID_AUTO, member_ifaddrs,
CTLFLAG_RW | CTLFLAG_VNET, &VNET_NAME(member_ifaddrs), false,
- "Allow layer 3 addresses on bridge members");
+ "Allow layer 3 addresses on bridge members (deprecated)");
static bool
bridge_member_ifaddrs(void)
@@ -1447,25 +1447,31 @@
#endif
/*
- * If member_ifaddrs is disabled, do not allow an Ethernet-like
- * interface with assigned IP addresses to be added to a bridge.
+ * If member_ifaddrs is disabled, do not allow an like interface with
+ * assigned IP addresses to be added to a bridge. Skip this check for
+ * gif interfaces, because the IP address assigned to a gif interface
+ * is separate from the bridge's Ethernet segment.
*/
- if (!V_member_ifaddrs && ifs->if_type != IFT_GIF) {
+ if (ifs->if_type != IFT_GIF) {
struct ifaddr *ifa;
CK_STAILQ_FOREACH(ifa, &ifs->if_addrhead, ifa_link) {
-#ifdef INET
- if (ifa->ifa_addr->sa_family == AF_INET)
- return (EXTERROR(EINVAL,
- "Member interface may not have "
- "an IPv4 address configured"));
-#endif
-#ifdef INET6
- if (ifa->ifa_addr->sa_family == AF_INET6)
+ if (ifa->ifa_addr->sa_family != AF_INET &&
+ ifa->ifa_addr->sa_family != AF_INET6)
+ continue;
+
+ if (V_member_ifaddrs) {
+ if_printf(sc->sc_ifp,
+ "WARNING: Adding member interface %s which "
+ "has an IP address assigned is deprecated "
+ "and will be unsupported in a future "
+ "release.\n", ifs->if_xname);
+ break;
+ } else {
return (EXTERROR(EINVAL,
"Member interface may not have "
- "an IPv6 address configured"));
-#endif
+ "an IP address assigned"));
+ }
}
}
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -523,8 +523,15 @@
* Check if bridge wants to allow adding addrs to member interfaces.
*/
if (ifp->if_bridge != NULL && ifp->if_type != IFT_GIF &&
- bridge_member_ifaddrs_p != NULL && !bridge_member_ifaddrs_p())
- return (EINVAL);
+ bridge_member_ifaddrs_p != NULL) {
+ if (bridge_member_ifaddrs_p())
+ if_printf(ifp, "WARNING: Assigning an IP address to "
+ "an interface which is also a bridge member is "
+ "deprecated and will be unsupported in a future "
+ "release.\n");
+ else
+ return (EINVAL);
+ }
/*
* See whether address already exist.
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1235,11 +1235,20 @@
int carp_attached = 0;
int error;
- /* Check if this interface is a bridge member */
+ /*
+ * Check if bridge wants to allow adding addrs to member interfaces.
+ */
if (ifp->if_bridge != NULL && ifp->if_type != IFT_GIF &&
- bridge_member_ifaddrs_p != NULL && !bridge_member_ifaddrs_p()) {
- error = EINVAL;
- goto out;
+ bridge_member_ifaddrs_p != NULL) {
+ if (bridge_member_ifaddrs_p()) {
+ if_printf(ifp, "WARNING: Assigning an IP address to "
+ "an interface which is also a bridge member is "
+ "deprecated and will be unsupported in a future "
+ "release.\n");
+ } else {
+ error = EINVAL;
+ goto out;
+ }
}
/*

File Metadata

Mime Type
text/plain
Expires
Mon, May 11, 10:16 AM (53 m, 19 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28675326
Default Alt Text
D52335.1778494561.diff (3 KB)

Event Timeline