Bug 11680 - ip_maskbits_iface iface parse error
Summary: ip_maskbits_iface iface parse error
Status: RESOLVED FIXED
Alias: None
Product: CTDB 2.5.x or older
Classification: Unclassified
Component: ctdb (show other bugs)
Version: 2.5.5
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: Martin Schwenke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-18 16:16 UTC by James Pitts
Modified: 2016-04-02 00:27 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Pitts 2016-01-18 16:16:06 UTC
When using VLAN public interfaces the ip_maskbits_iface in /etc/ctdb/functions does not correctly parse the iface name. The following error is an example of the result:

2015/12/02 01:31:09.760391 [26341]: 10.interface: /etc/ctdb/functions: line 193: /proc/sys/net/ipv4/conf/eth1.3970@eth1/promote_secondaries: No such file or directory

The old version of this function handled this correctly:

ip_maskbits_iface ()
{
    _addr="$1"

    ip addr show to "${_addr}/32" 2>/dev/null | \
        awk '$1 == "inet" { print gensub(".*/", "", 1, $2), $NF }'
}

HOWEVER the new version of this function does not appear to parse correctly and leaves the "@eth1":

ip_maskbits_iface ()
{
    _addr="$1"

    case "$_addr" in
    *:*) _family="inet6" ; _bits=128 ;;
    *)   _family="inet"  ; _bits=32  ;;
    esac

    ip addr show to "${_addr}/${_bits}" 2>/dev/null | \
    awk -v family="${_family}" \
        'NR == 1 { iface = $2; sub(":$", "", iface) } \
             $1 ~ /inet/ { mask = $2; sub(".*/", "", mask); \
                           print mask, iface, family }'
}
Comment 1 Volker Lendecke 2016-01-20 07:34:15 UTC
Is it possible that this is fixed in Samba (which has included ctdb with Samba 4.2) with

https://git.samba.org/?p=samba.git;a=commitdiff;h=87c5c96b76

?
Comment 2 Martin Schwenke 2016-01-22 08:53:08 UTC
James, can you please try to see if the following commit fixes the problem?

  https://git.samba.org/?p=martins/samba.git;a=commitdiff;h=87c5c96b767aa317dd620f89ac3e11bb40dae70f

If not, can you please paste the output of "ip addr show eth1.3970" so I can see  how it behaves with the parsing code?

Thanks...
Comment 3 Martin Schwenke 2016-01-22 08:56:36 UTC
Yep, my question is the same as Volker's.  Unfortunate scrolling in my browser meant I only saw the 1st line of his response...  :-(
Comment 4 James Pitts 2016-01-22 09:55:36 UTC
Yes Volker that does fix the issue!

-           'NR == 1 { iface = $2; sub(":$", "", iface) } \
+           'NR == 1 { iface = $2; sub(":$", "", iface) ; \
+                      sub("@.*", "", iface) } \

Once the /etc/ctdb/functions file has the above change everything works fine.
Comment 5 Martin Schwenke 2016-04-02 00:27:04 UTC
This is fixed in CTDB 2.5.6, which has just been released.

From the release notes...

This will be the last stable release of CTDB 2.5.x.  CTDB 2.5.6 should only
be used with Samba releases prior to Samba 4.2.x (i.e. Samba releases
3.6.x, 4.0.x and 4.1.x).

Please note that Samba releases 3.6.x, 4.0.x and 4.1.x are out of support.
If you are still using any of these releases for clustered samba with CTDB
2.5.x, please switch to latest Samba 4.3.x or 4.4.0 (Since Samba 4.2.0
release CTDB is part of Samba).