diff options
author | Tom Gundersen <teg@jklm.no> | 2014-03-15 20:02:24 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-03-15 20:04:42 +0100 |
commit | 6a8402d956a6f89910530e6b364c79be821d2d9d (patch) | |
tree | 1004cdf876bc60649cde7c6bb784e7a51f1aed10 /src | |
parent | d2d66d1ce7da459ee2a01ac033197dbd053df9f8 (diff) |
sd-rtnl: make RTM_NEWLINK report EEXIST by default
Use RTM_SETLINK to update an existing link.
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-message.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index fca1ff667a..7ea68f18ae 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -166,8 +166,7 @@ int sd_rtnl_message_new_link(sd_rtnl *rtnl, sd_rtnl_message **ret, int r; assert_return(rtnl_message_type_is_link(nlmsg_type), -EINVAL); - assert_return(nlmsg_type == RTM_NEWLINK || - nlmsg_type == RTM_SETLINK || index > 0, -EINVAL); + assert_return(nlmsg_type != RTM_DELLINK || index > 0, -EINVAL); assert_return(ret, -EINVAL); r = message_new(rtnl, ret, NLMSG_SPACE(sizeof(struct ifinfomsg))); @@ -177,7 +176,7 @@ int sd_rtnl_message_new_link(sd_rtnl *rtnl, sd_rtnl_message **ret, (*ret)->hdr->nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)); (*ret)->hdr->nlmsg_type = nlmsg_type; if (nlmsg_type == RTM_NEWLINK) - (*ret)->hdr->nlmsg_flags |= NLM_F_CREATE; + (*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_EXCL; ifi = NLMSG_DATA((*ret)->hdr); |