Bug 12516 - /etc/iproute2/rt_tables gets populated with multiple 'default' entries
Summary: /etc/iproute2/rt_tables gets populated with multiple 'default' entries
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: CTDB (show other bugs)
Version: 4.5.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-13 11:53 UTC by Barry Evans
Modified: 2017-01-27 05:16 UTC (History)
4 users (show)

See Also:


Attachments
Patch for master and probably 4.5 (1.59 KB, patch)
2017-01-15 20:34 UTC, Martin Schwenke
no flags Details
Patches for v4-6 (3.42 KB, patch)
2017-01-17 05:12 UTC, Amitay Isaacs
martins: review+
Details
Patches for v4-5 (3.42 KB, patch)
2017-01-17 05:12 UTC, Amitay Isaacs
martins: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Barry Evans 2017-01-13 11:53:51 UTC
After every stop of CTDB, existing entries in /etc/iproute2/rt_tables are 'doubled'.

This appears to have started since https://git.samba.org/?p=samba.git;a=commit;h=0ca00267cd2620a14968961738bcd2a69b597e95

# reserved values
# reserved values
# reserved values
# reserved values
#
#
#
#
#
#
#
#
255     local
255     local
255     local
255     local
254     main
254     main
254     main
254     main
253     default
253     default
253     default
253     default
0       unspec
0       unspec
0       unspec
0       unspec
# local
# local
# local
# local
#
#
#
#
#1      inr.ruhep
#1      inr.ruhep
#1      inr.ruhep
#1      inr.ruhep
10      ctdb.10.50.5.43

Many thanks
Comment 1 Martin Schwenke 2017-01-15 20:26:10 UTC
Wow.  That's horrible.  awk behaves sensibly if there is an implicit continuation in a conditions and/or action.  However, if that implicit continuation is between conditions and actions then you end up with an implicit action associated with the condition, plus an action that always runs.  I guess it makes sense.

So, I think the only hunk where that matters is in clean_up_table_ids(),  Patch to come...
Comment 2 Martin Schwenke 2017-01-15 20:34:27 UTC
Created attachment 12829 [details]
Patch for master and probably 4.5

I'll see if it is possible to write a test for this.  If not, I'll do some hand testing before deciding that this is the right thing to do...  :-)
Comment 3 Martin Schwenke 2017-01-16 03:18:34 UTC
Barry, are you happy with a:

  Reported-by: Barry Evans <bevans@pixitmedia.com>

tag in the commit for the fix?
Comment 4 Amitay Isaacs 2017-01-17 05:12:17 UTC
Created attachment 12836 [details]
Patches for v4-6
Comment 5 Amitay Isaacs 2017-01-17 05:12:57 UTC
Created attachment 12837 [details]
Patches for v4-5
Comment 6 Martin Schwenke 2017-01-17 05:33:58 UTC
Hi Karolin,

This is ready for 4.5 and 4.6.

Thanks...
Comment 7 Karolin Seeger 2017-01-24 20:12:28 UTC
(In reply to Martin Schwenke from comment #6)
Pushed to autobuild-v4-{6,5}-test.
Comment 8 Karolin Seeger 2017-01-27 05:16:52 UTC
(In reply to Karolin Seeger from comment #7)
Pushed to both branches.
Closing out bug report.

Thanks!