backport linemode changes from sle12 (bnc #906345, fate #313155, fate #3...

...13156)