chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bus: update kdbus.h and always subscribe to KDBUS_HELLO_ATTACH_NAMES
[elogind.git]
/
src
/
libsystemd-rtnl
/
rtnl-util.c
diff --git
a/src/libsystemd-rtnl/rtnl-util.c
b/src/libsystemd-rtnl/rtnl-util.c
index d40858a63b24fbc5a8d2962bdbca2cb9d52dc227..4e7661bb7775a1185d8c7eb31e108f4793bc83d4 100644
(file)
--- a/
src/libsystemd-rtnl/rtnl-util.c
+++ b/
src/libsystemd-rtnl/rtnl-util.c
@@
-34,7
+34,7
@@
int rtnl_set_link_name(sd_rtnl *rtnl, int ifindex, const char *name) {
assert(ifindex > 0);
assert(name);
assert(ifindex > 0);
assert(name);
- r = sd_rtnl_message_link_new(RTM_
NEW
LINK, ifindex, 0, 0, &message);
+ r = sd_rtnl_message_link_new(RTM_
SET
LINK, ifindex, 0, 0, &message);
if (r < 0)
return r;
if (r < 0)
return r;
@@
-49,7
+49,8
@@
int rtnl_set_link_name(sd_rtnl *rtnl, int ifindex, const char *name) {
return 0;
}
return 0;
}
-int rtnl_set_link_properties(sd_rtnl *rtnl, int ifindex, const struct ether_addr *mac, unsigned mtu) {
+int rtnl_set_link_properties(sd_rtnl *rtnl, int ifindex, const char *alias,
+ const struct ether_addr *mac, unsigned mtu) {
_cleanup_sd_rtnl_message_unref_ sd_rtnl_message *message = NULL;
bool need_update = false;
int r;
_cleanup_sd_rtnl_message_unref_ sd_rtnl_message *message = NULL;
bool need_update = false;
int r;
@@
-57,13
+58,22
@@
int rtnl_set_link_properties(sd_rtnl *rtnl, int ifindex, const struct ether_addr
assert(rtnl);
assert(ifindex > 0);
assert(rtnl);
assert(ifindex > 0);
- if (!mac && mtu == 0)
+ if (!
alias && !
mac && mtu == 0)
return 0;
return 0;
- r = sd_rtnl_message_link_new(RTM_
NEW
LINK, ifindex, 0, 0, &message);
+ r = sd_rtnl_message_link_new(RTM_
SET
LINK, ifindex, 0, 0, &message);
if (r < 0)
return r;
if (r < 0)
return r;
+ if (alias) {
+ r = sd_rtnl_message_append(message, IFLA_IFALIAS, alias);
+ if (r < 0)
+ return r;
+
+ need_update = true;
+
+ }
+
if (mac) {
r = sd_rtnl_message_append(message, IFLA_ADDRESS, mac);
if (r < 0)
if (mac) {
r = sd_rtnl_message_append(message, IFLA_ADDRESS, mac);
if (r < 0)