chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sd-rtnl: improve detection of broadcast messages
[elogind.git]
/
src
/
libsystemd
/
sd-rtnl
/
rtnl-message.c
diff --git
a/src/libsystemd/sd-rtnl/rtnl-message.c
b/src/libsystemd/sd-rtnl/rtnl-message.c
index e7e3799286124af22b2838002dbd98af486aec86..d24769b4b99905b05094d782dff6fe48bb1ed31d 100644
(file)
--- a/
src/libsystemd/sd-rtnl/rtnl-message.c
+++ b/
src/libsystemd/sd-rtnl/rtnl-message.c
@@
-20,7
+20,6
@@
***/
#include <netinet/in.h>
***/
#include <netinet/in.h>
-#include <netinet/ether.h>
#include <stdbool.h>
#include <unistd.h>
#include <stdbool.h>
#include <unistd.h>
@@
-649,13
+648,13
@@
int sd_rtnl_message_get_family(sd_rtnl_message *m, int *family) {
return 0;
}
return 0;
}
- return -E
NOTSU
P;
+ return -E
OPNOTSUP
P;
}
int sd_rtnl_message_is_broadcast(sd_rtnl_message *m) {
assert_return(m, -EINVAL);
}
int sd_rtnl_message_is_broadcast(sd_rtnl_message *m) {
assert_return(m, -EINVAL);
- return
!m->hdr->nlmsg_pid
;
+ return
m->broadcast
;
}
int sd_rtnl_message_link_get_ifindex(sd_rtnl_message *m, int *ifindex) {
}
int sd_rtnl_message_link_get_ifindex(sd_rtnl_message *m, int *ifindex) {
@@
-1431,7
+1430,7
@@
static int socket_recv_message(int fd, struct iovec *iov, uint32_t *_group, bool
assert(fd >= 0);
assert(iov);
assert(fd >= 0);
assert(iov);
- r = recvmsg(fd, &msg, MSG_TRUNC |
MSG_CMSG_CLOEXEC |
(peek ? MSG_PEEK : 0));
+ r = recvmsg(fd, &msg, MSG_TRUNC | (peek ? MSG_PEEK : 0));
if (r < 0) {
/* no data */
if (errno == ENOBUFS)
if (r < 0) {
/* no data */
if (errno == ENOBUFS)
@@
-1467,7
+1466,7
@@
static int socket_recv_message(int fd, struct iovec *iov, uint32_t *_group, bool
/* not from the kernel, ignore */
if (peek) {
/* drop the message */
/* not from the kernel, ignore */
if (peek) {
/* drop the message */
- r = recvmsg(fd, &msg,
MSG_CMSG_CLOEXEC
);
+ r = recvmsg(fd, &msg,
0
);
if (r < 0)
return (errno == EAGAIN || errno == EINTR) ? 0 : -errno;
}
if (r < 0)
return (errno == EAGAIN || errno == EINTR) ? 0 : -errno;
}
@@
-1561,7
+1560,7
@@
int socket_read_message(sd_rtnl *rtnl) {
/* check that we support this message type */
r = type_system_get_type(NULL, &nl_type, new_msg->nlmsg_type);
if (r < 0) {
/* check that we support this message type */
r = type_system_get_type(NULL, &nl_type, new_msg->nlmsg_type);
if (r < 0) {
- if (r == -E
NOTSU
P)
+ if (r == -E
OPNOTSUP
P)
log_debug("sd-rtnl: ignored message with unknown type: %i",
new_msg->nlmsg_type);
log_debug("sd-rtnl: ignored message with unknown type: %i",
new_msg->nlmsg_type);
@@
-1578,6
+1577,8
@@
int socket_read_message(sd_rtnl *rtnl) {
if (r < 0)
return r;
if (r < 0)
return r;
+ m->broadcast = !!group;
+
m->hdr = memdup(new_msg, new_msg->nlmsg_len);
if (!m->hdr)
return -ENOMEM;
m->hdr = memdup(new_msg, new_msg->nlmsg_len);
if (!m->hdr)
return -ENOMEM;