Updated LinkHandler#change to retry commands with SETLINK when they fail with NEWLINK
This commit is contained in:
@@ -210,8 +210,16 @@ module Netlink
|
|||||||
iplink_modify(RTM_NEWLINK, NLM_F_CREATE|NLM_F_EXCL, opt)
|
iplink_modify(RTM_NEWLINK, NLM_F_CREATE|NLM_F_EXCL, opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# This will submit a change. If the kernel replies "protocol not
|
||||||
|
# supported" resend the request with a SETLINK instead of NEWLINK flag.
|
||||||
|
#
|
||||||
def change(opt)
|
def change(opt)
|
||||||
iplink_modify(RTM_NEWLINK, NLM_F_REPLACE, opt)
|
begin
|
||||||
|
iplink_modify(RTM_NEWLINK, NLM_F_REPLACE, opt)
|
||||||
|
rescue Errno::EOPNOTSUPP
|
||||||
|
iplink_modify(RTM_SETLINK, NLM_F_REPLACE, opt)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def replace(opt)
|
def replace(opt)
|
||||||
|
Reference in New Issue
Block a user