mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
initscripts: Configure output device in routes
Without an explicit output device, the kernel might use a different output device than intended by the user. Therefore, use the interface name of connections to specify it if it is available. Otherwise, educate the user about this potential problem with a warning. This aligns the behavior with NetworkManager which configures the output device in routes when activating profiles on devices. Fixes: https://bugzilla.redhat.com/2168735 Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
parent
e4cc5c138f
commit
7c0579ddfc
5 changed files with 398 additions and 3 deletions
|
|
@ -531,6 +531,19 @@ class IfcfgUtil:
|
|||
line = r["network"] + "/" + str(r["prefix"])
|
||||
if r["gateway"]:
|
||||
line += " via " + r["gateway"]
|
||||
if connection["interface_name"]:
|
||||
line += " dev " + connection["interface_name"]
|
||||
else:
|
||||
warn_fcn(
|
||||
"The connection {0} does not specify an interface name. "
|
||||
"Therefore, the route to {1}/{2} will be configured without "
|
||||
"the output device and the kernel will choose it "
|
||||
"automatically which might result in an unwanted device being "
|
||||
"used. To avoid this, specify `interface_name` in the "
|
||||
"connection appropriately.".format(
|
||||
connection["name"], r["network"], r["prefix"]
|
||||
),
|
||||
)
|
||||
if r["metric"] != -1:
|
||||
line += " metric " + str(r["metric"])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue