The Samba-Bugzilla – Attachment 11259 Details for
Bug 11399
Support for public IPs on VLANs is broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for v4-2 branch
BZ-11399-v4-2.patch (text/plain), 9.93 KB, created by
Martin Schwenke
on 2015-07-15 09:52:55 UTC
(
hide
)
Description:
Patch for v4-2 branch
Filename:
MIME Type:
Creator:
Martin Schwenke
Created:
2015-07-15 09:52:55 UTC
Size:
9.93 KB
patch
obsolete
>From c848d70e088f5472b638e52831e643b592f2d162 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 7 Jul 2015 20:49:38 +1000 >Subject: [PATCH 1/5] ctdb-scripts: Fix regression in VLAN interface support > >Commit 6471541d6d2bc9f2af0ff92b280abbd1d933cf88 broke support for VLAN >interfaces. Releasing a public IP address depends on >ip_maskbits_iface() and for a VLAN interface this will return an >interface of the form <vlan>@<iface>, which can't be fed back into >"ip" commands. > >Update ip_maskbits_iface() to drop the '@' and everything after it. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11399 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >Reported-by: Jan Schwaratzki <jschwaratzki@ddn.com> >(cherry picked from commit 87c5c96b767aa317dd620f89ac3e11bb40dae70f) >--- > ctdb/config/functions | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/ctdb/config/functions b/ctdb/config/functions >index e0270a3..6b38844 100755 >--- a/ctdb/config/functions >+++ b/ctdb/config/functions >@@ -895,7 +895,8 @@ ip_maskbits_iface () > > ip addr show to "${_addr}/${_bits}" 2>/dev/null | \ > awk -v family="${_family}" \ >- 'NR == 1 { iface = $2; sub(":$", "", iface) } \ >+ 'NR == 1 { iface = $2; sub(":$", "", iface) ; \ >+ sub("@.*", "", iface) } \ > $1 ~ /inet/ { mask = $2; sub(".*/", "", mask); \ > print mask, iface, family }' > } >-- >2.1.4 > > >From 87f0d31d1bff04289fe7aa6bac5699e962e0f18e Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Wed, 8 Jul 2015 21:23:48 +1000 >Subject: [PATCH 2/5] ctdb-scripts: Support monitoring of interestingly named > VLANs on bonds > >VLAN interfaces on bonds with a name other than <iface>.<id>@<iface> >are not currently supported. That is, where the VLAN name isn't based >on the underlying bond name. Such VLAN interfaces can be created with >the "ip link" command, as opposed to the "vconfig" command, or by >renaming a VLAN interface. > >This is improved by determining the underlying interface name for a >VLAN from the output of "ip link". > >No serious attempt is made to support VLANs with '@' in their name, >although this seems to be legal. Why would you do that? > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11399 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit bc71251433ce618c95c674d7cbe75b01a94adad9) >--- > ctdb/config/events.d/10.interface | 28 ++++++++++++++++++++++++++-- > 1 file changed, 26 insertions(+), 2 deletions(-) > >diff --git a/ctdb/config/events.d/10.interface b/ctdb/config/events.d/10.interface >index 51d1b97..bcd5cf9 100755 >--- a/ctdb/config/events.d/10.interface >+++ b/ctdb/config/events.d/10.interface >@@ -52,6 +52,30 @@ get_all_interfaces () > all_interfaces=$(echo $all_interfaces $ctdb_ifaces | tr ' ' '\n' | sort -u) > } > >+get_real_iface () >+{ >+ # Output of "ip link show <iface>" >+ _iface_info="$1" >+ >+ # Extract the full interface description to see if it is a VLAN >+ _t=$(echo "$_iface_info" | >+ awk 'NR == 1 { iface = $2; sub(":$", "", iface) ; \ >+ print iface }') >+ case "$_t" in >+ *@*) >+ # VLAN: use the underlying interface, after the '@' >+ echo "${_t##*@}" >+ ;; >+ *) >+ # Not a regular VLAN. For backward compatibility, assume >+ # there is some other sort of VLAN that doesn't have the >+ # '@' in the output and only use what is before a '.'. If >+ # there is no '.' then this will be the whole interface >+ # name. >+ echo "${_t%%.*}" >+ esac >+} >+ > monitor_interfaces() > { > get_all_interfaces >@@ -65,7 +89,7 @@ monitor_interfaces() > # problem with an interface then set fail=true and continue. > for iface in $all_interfaces ; do > >- ip link show $iface 2>/dev/null >/dev/null || { >+ _iface_info=$(ip link show $iface 2>&1) || { > echo "ERROR: Interface $iface does not exist but it is used by public addresses." > mark_down $iface > continue >@@ -74,7 +98,7 @@ monitor_interfaces() > # These interfaces are sometimes bond devices > # When we use VLANs for bond interfaces, there will only > # be an entry in /proc for the underlying real interface >- realiface=`echo $iface |sed -e 's/\..*$//'` >+ realiface=$(get_real_iface "$_iface_info") > bi=$(get_proc "net/bonding/$realiface" 2>/dev/null) && { > echo "$bi" | grep -q 'Currently Active Slave: None' && { > echo "ERROR: No active slaves for bond device $realiface" >-- >2.1.4 > > >From 07050bc15694e54341a18b09922ff9233aaee8c3 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Wed, 8 Jul 2015 21:39:51 +1000 >Subject: [PATCH 3/5] ctdb-tests: Interface number in "ip link show" stub > defaults to 42 > >It needs to have a default for the standalone case, when it is not run >in a loop inside "ip addr show". > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11399 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 4f84d42b511a4c9a79bd835eeca0a80082e76227) >--- > ctdb/tests/eventscripts/stubs/ip | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/ctdb/tests/eventscripts/stubs/ip b/ctdb/tests/eventscripts/stubs/ip >index e8f17d8..660ad7e 100755 >--- a/ctdb/tests/eventscripts/stubs/ip >+++ b/ctdb/tests/eventscripts/stubs/ip >@@ -66,7 +66,7 @@ ip_link_show () > _state="DOWN" > _flags="" > fi >- echo "${n}: ${dev}: <BROADCAST,MULTICAST${_flags}> mtu 1500 qdisc pfifo_fast state ${_state} qlen 1000" >+ echo "${n:-42}: ${dev}: <BROADCAST,MULTICAST${_flags}> mtu 1500 qdisc pfifo_fast state ${_state} qlen 1000" > echo " link/ether ${mac} brd ff:ff:ff:ff:ff:ff" > } > >-- >2.1.4 > > >From 2e7433eada7b9b85af7d9ece32344438dba12b07 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Wed, 8 Jul 2015 22:14:51 +1000 >Subject: [PATCH 4/5] ctdb-tests: Add VLAN support to the "ip link" stub > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11399 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 8e41cb1e4e7b4a7d92628771260649ded4432772) >--- > ctdb/tests/eventscripts/stubs/ip | 48 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 48 insertions(+) > >diff --git a/ctdb/tests/eventscripts/stubs/ip b/ctdb/tests/eventscripts/stubs/ip >index 660ad7e..2021758 100755 >--- a/ctdb/tests/eventscripts/stubs/ip >+++ b/ctdb/tests/eventscripts/stubs/ip >@@ -23,15 +23,58 @@ ip_link () > esac > ;; > show) shift ; ip_link_show "$@" ;; >+ add*) shift ; ip_link_add "$@" ;; > del*) shift ; ip_link_delete "$@" ;; > *) not_implemented "$*" ;; > esac > } > >+ip_link_add () >+{ >+ _link="" >+ _name="" >+ _type="" >+ >+ while [ -n "$1" ] ; do >+ case "$1" in >+ link) >+ _link="$2" >+ shift 2 >+ ;; >+ name) >+ _name="$2" >+ shift 2 >+ ;; >+ type) >+ if [ "$2" != "vlan" ] ; then >+ not_implemented "link type $1" >+ fi >+ _type="$2" >+ shift 2 >+ ;; >+ id) shift 2 ;; >+ *) not_implemented "$1" ;; >+ esac >+ done >+ >+ case "$_type" in >+ vlan) >+ if [ -z "$_name" -o -z "$_link" ] ; then >+ not_implemented "ip link add with null name or link" >+ fi >+ >+ mkdir -p "${FAKE_IP_STATE}/interfaces-vlan" >+ echo "$_link" >"${FAKE_IP_STATE}/interfaces-vlan/${_name}" >+ ip_link_set_down "$_name" >+ ;; >+ esac >+} >+ > ip_link_delete () > { > mkdir -p "${FAKE_IP_STATE}/interfaces-deleted" > touch "${FAKE_IP_STATE}/interfaces-deleted/$1" >+ rm -f "${FAKE_IP_STATE}/interfaces-vlan/$1" > } > > ip_link_set_up () >@@ -59,6 +102,11 @@ ip_link_show () > exit 255 > fi > >+ if [ -r "${FAKE_IP_STATE}/interfaces-vlan/${dev}" ] ; then >+ read _link <"${FAKE_IP_STATE}/interfaces-vlan/${dev}" >+ dev="${dev}@${_link}" >+ fi >+ > mac=$(echo $dev | md5sum | sed -r -e 's@(..)(..)(..)(..)(..)(..).*@\1:\2:\3:\4:\5:\6@') > _state="UP" > _flags=",UP,LOWER_UP" >-- >2.1.4 > > >From d2d7055470a16d04059061058748f57f6d64c5a6 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Wed, 8 Jul 2015 22:22:09 +1000 >Subject: [PATCH 5/5] ctdb-tests: Add some 10.interfaces VLAN tests > >One without a bond, one with a bond. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11399 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 8ed0cacaf4aa9fc63b8c8d610a6164c5d01e473a) >--- > ctdb/tests/eventscripts/10.interface.monitor.017.sh | 20 ++++++++++++++++++++ > ctdb/tests/eventscripts/10.interface.monitor.018.sh | 20 ++++++++++++++++++++ > 2 files changed, 40 insertions(+) > create mode 100755 ctdb/tests/eventscripts/10.interface.monitor.017.sh > create mode 100755 ctdb/tests/eventscripts/10.interface.monitor.018.sh > >diff --git a/ctdb/tests/eventscripts/10.interface.monitor.017.sh b/ctdb/tests/eventscripts/10.interface.monitor.017.sh >new file mode 100755 >index 0000000..6e30040 >--- /dev/null >+++ b/ctdb/tests/eventscripts/10.interface.monitor.017.sh >@@ -0,0 +1,20 @@ >+#!/bin/sh >+ >+. "${TEST_SCRIPTS_DIR}/unit.sh" >+ >+define_test "1 VLAN, link down" >+ >+setup_ctdb >+ >+iface=$(ctdb_get_1_interface) >+ >+ethtool_interfaces_down "$iface" >+ >+# This just exercises the VLAN checking code, which will allow us to >+# determine that real0 is not a bond. >+realiface="real0" >+ip link add link "$realiface" name "$iface" type vlan id 11 >+ip link set "${iface}@${realiface}" up >+ >+required_result 1 "ERROR: No link on the public network interface ${iface}" >+simple_test >diff --git a/ctdb/tests/eventscripts/10.interface.monitor.018.sh b/ctdb/tests/eventscripts/10.interface.monitor.018.sh >new file mode 100755 >index 0000000..aac23b8 >--- /dev/null >+++ b/ctdb/tests/eventscripts/10.interface.monitor.018.sh >@@ -0,0 +1,20 @@ >+#!/bin/sh >+ >+. "${TEST_SCRIPTS_DIR}/unit.sh" >+ >+define_test "VLAN on bond, active slaves, link down" >+ >+setup_ctdb >+ >+iface=$(ctdb_get_1_interface) >+ >+bond="bond0" >+ >+setup_bond "$bond" "" "down" >+ >+ip link add link "$bond" name "$iface" type vlan id 11 >+ip link set "${iface}@${bond}" up >+ >+required_result 1 "ERROR: public network interface ${bond} is down" >+ >+simple_test >-- >2.1.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
amitay
:
review+
Actions:
View
Attachments on
bug 11399
: 11259