[PATCH net 00/12] net: iflink and link-netnsid fixes
by Sabrina Dubroca
In a lot of places, we use this kind of comparison to detect if a
device has a lower link:
dev->ifindex != dev_get_iflink(dev)
This seems to be a leftover of the pre-netns days, when the ifindex
was unique over the whole system. Nowadays, with network namespaces,
it's very easy to create a device with the same ifindex as its lower
link:
ip netns add main
ip netns add peer
ip -net main link add dummy0 type dummy
ip -net main link add link dummy0 macvlan0 netns peer type macvlan
ip -net main link show type dummy
9: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop ...
ip -net peer link show type macvlan
9: macvlan0@if9: <BROADCAST,MULTICAST> mtu 1500 qdisc noop ...
To detect if a device has a lower link, we can simply check the
existence of the dev->netdev_ops->ndo_get_iflink operation, instead of
checking its return value. In particular, I attempted to fix one of
these checks in commit feadc4b6cf42 ("rtnetlink: always put IFLA_LINK
for links with a link-netnsid"), but this patch isn't correct, since
tunnel devices can export IFLA_LINK_NETNSID without IFLA_LINK. That
patch needs to be reverted.
This series will fix all those bogus comparisons, and export missing
IFLA_LINK_NETNSID attributes in bridge and ipv6 dumps.
ipvlan and geneve are also missing the get_link_net operation, so
userspace can't know when those device are cross-netns. There are a
couple of other device types that have an ndo_get_iflink op but no
get_link_net (virt_wifi, ipoib), and should probably also have a
get_link_net.
Sabrina Dubroca (12):
ipvlan: add get_link_net
geneve: add get_link_net
Revert "rtnetlink: always put IFLA_LINK for links with a link-netnsid"
rtnetlink: always put IFLA_LINK for links with ndo_get_iflink
bridge: always put IFLA_LINK for ports with ndo_get_iflink
bridge: advertise IFLA_LINK_NETNSID when dumping bridge ports
ipv6: always put IFLA_LINK for devices with ndo_get_iflink
ipv6: advertise IFLA_LINK_NETNSID when dumping ipv6 addresses
net: link_watch: fix operstate when the link has the same index as the
device
net: link_watch: fix detection of urgent events
batman-adv: fix iflink detection in batadv_is_on_batman_iface
batman-adv: fix detection of lower link in batadv_get_real_netdevice
drivers/net/can/vxcan.c | 2 +-
drivers/net/geneve.c | 8 ++++++++
drivers/net/ipvlan/ipvlan_main.c | 9 +++++++++
drivers/net/veth.c | 2 +-
include/net/rtnetlink.h | 4 ++++
net/batman-adv/hard-interface.c | 4 ++--
net/bridge/br_netlink.c | 4 +++-
net/core/link_watch.c | 4 ++--
net/core/rtnetlink.c | 25 ++++++++++++-------------
net/ipv6/addrconf.c | 11 ++++++++++-
10 files changed, 52 insertions(+), 21 deletions(-)
--
2.28.0
8 months, 3 weeks
[PATCH] alfred: notify event listener via unix socket
by Marek Lindner
The alfred server instance accepts event notification registration
via the unix socket. These notification sockets only inform
registered parties of the availibility of an alfred datatype change.
The actual data itself needs to be retrieved via the existing data
retrieval mechanisms.
Unlike the update-command this event monitor allows:
- multiple parallel listeners
- programmatic access to changes without requiring multiple processes
The alfred client allows to monitor events via the newly added '-E'
(event monitor) command line option. Serving as debugging tool and
example code at the same time.
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
---
alfred.h | 15 ++++++
client.c | 54 ++++++++++++++++++++
main.c | 10 +++-
man/alfred.8 | 3 ++
packet.h | 26 ++++++++++
recv.c | 4 +-
server.c | 5 ++
unix_sock.c | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++
8 files changed, 257 insertions(+), 2 deletions(-)
diff --git a/alfred.h b/alfred.h
index 2d98a30..f442c48 100644
--- a/alfred.h
+++ b/alfred.h
@@ -94,6 +94,7 @@ enum clientmode {
CLIENT_CHANGE_INTERFACE,
CLIENT_CHANGE_BAT_IFACE,
CLIENT_SERVER_STATUS,
+ CLIENT_EVENT_MONITOR,
};
struct interface {
@@ -110,8 +111,15 @@ struct interface {
struct list_head list;
};
+struct event_listener {
+ int fd;
+
+ struct list_head list;
+};
+
struct globals {
struct list_head interfaces;
+ struct list_head event_listeners;
char *net_iface;
struct server *best_server; /* NULL if we are a server ourselves */
@@ -157,6 +165,7 @@ int alfred_client_modeswitch(struct globals *globals);
int alfred_client_change_interface(struct globals *globals);
int alfred_client_change_bat_iface(struct globals *globals);
int alfred_client_server_status(struct globals *globals);
+int alfred_client_event_monitor(struct globals *globals);
/* recv.c */
int recv_alfred_packet(struct globals *globals, struct interface *interface,
int recv_sock);
@@ -186,6 +195,12 @@ int unix_sock_open_client(struct globals *globals);
int unix_sock_close(struct globals *globals);
int unix_sock_req_data_finish(struct globals *globals,
struct transaction_head *head);
+int unix_sock_events_select_prepare(struct globals *globals, fd_set *fds,
+ fd_set *errfds, int maxsock);
+void unix_sock_events_select_handle(struct globals *globals,
+ fd_set *fds, fd_set *errfds);
+void unix_sock_events_close_all(struct globals *globals);
+void unix_sock_event_notify(struct globals *globals, uint8_t type);
/* vis.c */
int vis_update_data(struct globals *globals);
/* netsock.c */
diff --git a/client.c b/client.c
index 81cdd7c..9e88f47 100644
--- a/client.c
+++ b/client.c
@@ -452,3 +452,57 @@ err:
unix_sock_close(globals);
return 0;
}
+
+int alfred_client_event_monitor(struct globals *globals)
+{
+ struct alfred_event_register_v0 event_register;
+ struct alfred_event_notify_v0 event_notify;
+ int ret, len;
+
+ if (unix_sock_open_client(globals))
+ return -1;
+
+ len = sizeof(event_register);
+
+ event_register.header.type = ALFRED_EVENT_REGISTER;
+ event_register.header.version = ALFRED_VERSION;
+ event_register.header.length = 0;
+
+ ret = write(globals->unix_sock, &event_register, len);
+ if (ret != len) {
+ fprintf(stderr, "%s: only wrote %d of %d bytes: %s\n",
+ __func__, ret, len, strerror(errno));
+ goto err;
+ }
+
+ while (true) {
+ len = read(globals->unix_sock, &event_notify, sizeof(event_notify));
+ if (len == 0) {
+ fprintf(stdout, "Server closed the connection\n");
+ goto err;
+ }
+
+ if (len < 0) {
+ perror("read from unix socket failed");
+ goto err;
+ }
+
+ if (len != sizeof(event_notify)) {
+ fprintf(stderr, "notify read bytes: %d (expected: %zu)\n",
+ len, sizeof(event_notify));
+ goto err;
+ }
+
+ if (event_notify.header.version != ALFRED_VERSION)
+ continue;
+
+ if (event_notify.header.type != ALFRED_EVENT_NOTIFY)
+ continue;
+
+ fprintf(stdout, "Event: type = %d\n", event_notify.type);
+ }
+
+err:
+ unix_sock_close(globals);
+ return 0;
+}
diff --git a/main.c b/main.c
index 68d6efd..98bf64d 100644
--- a/main.c
+++ b/main.c
@@ -39,6 +39,7 @@ static void alfred_usage(void)
printf(" -I, --change-interface [interface] change to the specified interface(s)\n");
printf(" -B, --change-bat-iface [interface] change to the specified batman-adv interface\n");
printf(" -S, --server-status request server status info such as mode & interfaces\n");
+ printf(" -E, --event-monitor monitor alfred data record update eventss\n");
printf("\n");
printf("server mode options:\n");
printf(" -i, --interface specify the interface (or comma separated list of interfaces) to listen on\n");
@@ -164,6 +165,7 @@ static struct globals *alfred_init(int argc, char *argv[])
{"change-interface", required_argument, NULL, 'I'},
{"change-bat-iface", required_argument, NULL, 'B'},
{"server-status", required_argument, NULL, 'S'},
+ {"event-monitor", required_argument, NULL, 'E'},
{"unix-path", required_argument, NULL, 'u'},
{"update-command", required_argument, NULL, 'c'},
{"version", no_argument, NULL, 'v'},
@@ -181,6 +183,7 @@ static struct globals *alfred_init(int argc, char *argv[])
memset(globals, 0, sizeof(*globals));
INIT_LIST_HEAD(&globals->interfaces);
+ INIT_LIST_HEAD(&globals->event_listeners);
globals->net_iface = NULL;
globals->opmode = OPMODE_SECONDARY;
globals->clientmode = CLIENT_NONE;
@@ -198,7 +201,7 @@ static struct globals *alfred_init(int argc, char *argv[])
time_random_seed();
- while ((opt = getopt_long(argc, argv, "ms:r:hi:b:vV:M:I:B:Su:dc:p:4:f", long_options,
+ while ((opt = getopt_long(argc, argv, "ms:r:hi:b:vV:M:I:B:SEu:dc:p:4:f", long_options,
&opt_ind)) != -1) {
switch (opt) {
case 'r':
@@ -263,6 +266,9 @@ static struct globals *alfred_init(int argc, char *argv[])
case 'S':
globals->clientmode = CLIENT_SERVER_STATUS;
break;
+ case 'E':
+ globals->clientmode = CLIENT_EVENT_MONITOR;
+ break;
case 'u':
globals->unix_path = optarg;
break;
@@ -328,6 +334,8 @@ int main(int argc, char *argv[])
return alfred_client_change_bat_iface(globals);
case CLIENT_SERVER_STATUS:
return alfred_client_server_status(globals);
+ case CLIENT_EVENT_MONITOR:
+ return alfred_client_event_monitor(globals);
}
return 0;
diff --git a/man/alfred.8 b/man/alfred.8
index cf0eafc..ca83f02 100644
--- a/man/alfred.8
+++ b/man/alfred.8
@@ -97,6 +97,9 @@ Change the alfred server to use the new \fBbatman-adv interface\fP
.TP
\fB\-S\fP, \fB\-\-server\-status\fP
Request server status information such as mode & interfaces\fP
+.TP
+\fB\-E\fP, \fB\-\-event\-monitor\fP
+Start alfred event monitor connecting to the alfred server and reporting update events\fP
.
.SH SERVER OPTIONS
.TP
diff --git a/packet.h b/packet.h
index 0c1a2eb..84b027f 100644
--- a/packet.h
+++ b/packet.h
@@ -59,6 +59,8 @@ struct alfred_transaction_mgmt {
* @ALFRED_STATUS_ERROR: Error was detected during the transaction
* @ALFRED_MODESWITCH: Switch between different operation modes
* @ALFRED_CHANGE_INTERFACE: Change the listening interface
+ * @ALFRED_EVENT_REGISTER: Request to be notified about alfred update events
+ * @ALFRED_EVENT_NOTIFY: Data record update has been received
*/
enum alfred_packet_type {
ALFRED_PUSH_DATA = 0,
@@ -70,6 +72,8 @@ enum alfred_packet_type {
ALFRED_CHANGE_INTERFACE = 6,
ALFRED_CHANGE_BAT_IFACE = 7,
ALFRED_SERVER_STATUS = 8,
+ ALFRED_EVENT_REGISTER = 9,
+ ALFRED_EVENT_NOTIFY = 10,
};
/* packets */
@@ -229,6 +233,28 @@ struct alfred_server_status_rep_v0 {
struct alfred_tlv header;
} __packed;
+/**
+ * struct alfred_event_register_v0 - event registration message
+ * @header: TLV header describing the complete packet
+ *
+ * Sent by the client to daemon to register for data record updates
+ */
+struct alfred_event_register_v0 {
+ struct alfred_tlv header;
+} __packed;
+
+/**
+ * struct alfred_event_notify_v0 - event notification message
+ * @header: TLV header describing the complete packet
+ * @type: Type of the data triggering the event
+ *
+ * Sent by the daemon to client on data record update
+ */
+struct alfred_event_notify_v0 {
+ struct alfred_tlv header;
+ uint8_t type;
+} __packed;
+
/**
* struct alfred_status_v0 - Status info of a transaction
* @header: TLV header describing the complete packet
diff --git a/recv.c b/recv.c
index 8acad10..36b3a49 100644
--- a/recv.c
+++ b/recv.c
@@ -76,8 +76,10 @@ static int finish_alfred_push_data(struct globals *globals,
/* check that data was changed */
if (new_entry_created ||
dataset->data.header.length != data_len ||
- memcmp(dataset->buf, data->data, data_len) != 0)
+ memcmp(dataset->buf, data->data, data_len) != 0) {
changed_data_type(globals, data->header.type);
+ unix_sock_event_notify(globals, data->header.type);
+ }
/* free old buffer */
if (dataset->buf) {
diff --git a/server.c b/server.c
index bfc37bc..4078fe6 100644
--- a/server.c
+++ b/server.c
@@ -442,6 +442,8 @@ int alfred_server(struct globals *globals)
maxsock = netsock_prepare_select(globals, &fds, maxsock);
maxsock = netsock_prepare_select(globals, &errfds, maxsock);
+ maxsock = unix_sock_events_select_prepare(globals, &fds,
+ &errfds, maxsock);
ret = pselect(maxsock + 1, &fds, NULL, &errfds, &tv, NULL);
@@ -450,6 +452,8 @@ int alfred_server(struct globals *globals)
} else if (ret) {
netsock_check_error(globals, &errfds);
+ unix_sock_events_select_handle(globals, &fds, &errfds);
+
if (FD_ISSET(globals->unix_sock, &fds)) {
unix_sock_read(globals);
continue;
@@ -478,5 +482,6 @@ int alfred_server(struct globals *globals)
netsock_close_all(globals);
unix_sock_close(globals);
+ unix_sock_events_close_all(globals);
return 0;
}
diff --git a/unix_sock.c b/unix_sock.c
index 3894736..c45564d 100644
--- a/unix_sock.c
+++ b/unix_sock.c
@@ -13,6 +13,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <fcntl.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/un.h>
@@ -84,6 +85,7 @@ static int unix_sock_add_data(struct globals *globals,
struct alfred_push_data_v0 *push,
int client_sock)
{
+ bool new_entry_created = false;
struct alfred_data *data;
struct dataset *dataset;
int len, data_len, ret = -1;
@@ -138,10 +140,17 @@ static int unix_sock_add_data(struct globals *globals,
free(dataset);
goto err;
}
+ new_entry_created = true;
}
dataset->data_source = SOURCE_LOCAL;
clock_gettime(CLOCK_MONOTONIC, &dataset->last_seen);
+ /* check that data was changed */
+ if (new_entry_created ||
+ dataset->data.header.length != data_len ||
+ memcmp(dataset->buf, data->data, data_len) != 0)
+ unix_sock_event_notify(globals, data->header.type);
+
/* free old buffer */
free(dataset->buf);
@@ -472,6 +481,37 @@ err:
return ret;
}
+static int unix_sock_register_listener(struct globals *globals, int client_sock)
+{
+ struct event_listener *listener;
+ int ret;
+
+ ret = fcntl(client_sock, F_GETFL, 0);
+ if (ret < 0) {
+ perror("failed to get file status flags");
+ goto err;
+ }
+
+ ret = fcntl(client_sock, F_SETFL, ret | O_NONBLOCK);
+ if (ret < 0) {
+ perror("failed to set file status flags");
+ goto err;
+ }
+
+ listener = malloc(sizeof(*listener));
+ if (!listener)
+ goto err;
+
+ listener->fd = client_sock;
+ INIT_LIST_HEAD(&listener->list);
+ list_add_tail(&listener->list, &globals->event_listeners);
+ return 0;
+
+err:
+ close(client_sock);
+ return -1;
+}
+
int unix_sock_read(struct globals *globals)
{
int client_sock;
@@ -537,6 +577,9 @@ int unix_sock_read(struct globals *globals)
case ALFRED_SERVER_STATUS:
ret = unix_sock_server_status(globals, client_sock);
break;
+ case ALFRED_EVENT_REGISTER:
+ ret = unix_sock_register_listener(globals, client_sock);
+ break;
default:
/* unknown packet type */
ret = -1;
@@ -555,3 +598,102 @@ int unix_sock_close(struct globals *globals)
close(globals->unix_sock);
return 0;
}
+
+static void unix_sock_event_listener_free(struct event_listener *listener)
+{
+ list_del_init(&listener->list);
+ close(listener->fd);
+ free(listener);
+}
+
+static void unix_sock_event_notify_listener(struct event_listener *listener,
+ uint8_t type)
+{
+ struct alfred_event_notify_v0 notify;
+ int ret;
+
+ notify.header.type = ALFRED_EVENT_NOTIFY;
+ notify.header.version = ALFRED_VERSION;
+ notify.header.length = FIXED_TLV_LEN(notify);
+ notify.type = type;
+
+ ret = write(listener->fd, ¬ify, sizeof(notify));
+ if (ret == sizeof(notify))
+ return;
+
+ unix_sock_event_listener_free(listener);
+}
+
+int unix_sock_events_select_prepare(struct globals *globals, fd_set *fds,
+ fd_set *errfds, int maxsock)
+{
+ struct event_listener *listener;
+
+ list_for_each_entry(listener, &globals->event_listeners, list) {
+ if (listener->fd < 0)
+ continue;
+
+ FD_SET(listener->fd, fds);
+ FD_SET(listener->fd, errfds);
+
+ if (maxsock < listener->fd)
+ maxsock = listener->fd;
+ }
+
+ return maxsock;
+}
+
+void unix_sock_events_select_handle(struct globals *globals,
+ fd_set *fds, fd_set *errfds)
+{
+ struct event_listener *listener, *tmp;
+ char buff[4];
+ int ret;
+
+ list_for_each_entry_safe(listener, tmp,
+ &globals->event_listeners, list) {
+ if (FD_ISSET(listener->fd, fds)) {
+ ret = recv(listener->fd, buff, sizeof(buff),
+ MSG_PEEK | MSG_DONTWAIT);
+ /* listener has hung up */
+ if (ret == 0)
+ unix_sock_event_listener_free(listener);
+ else if (ret > 0) {
+ fprintf(stderr, "Event listener has written to socket: %d - closing\n",
+ listener->fd);
+ unix_sock_event_listener_free(listener);
+ }
+
+ if (ret >= 0)
+ continue;
+ }
+
+ if (FD_ISSET(listener->fd, errfds)) {
+ fprintf(stderr, "Error on event listener detected: %d\n",
+ listener->fd);
+ unix_sock_event_listener_free(listener);
+ continue;
+ }
+ }
+}
+
+void unix_sock_events_close_all(struct globals *globals)
+{
+ struct event_listener *listener, *tmp;
+
+ list_for_each_entry_safe(listener, tmp,
+ &globals->event_listeners, list) {
+ unix_sock_event_listener_free(listener);
+ }
+}
+
+void unix_sock_event_notify(struct globals *globals, uint8_t type)
+{
+ struct event_listener *listener, *tmp;
+
+ /* if event notify is unsuccessful, listener socket is closed */
+ list_for_each_entry_safe(listener, tmp,
+ &globals->event_listeners, list) {
+ unix_sock_event_notify_listener(listener, type);
+ }
+}
--
2.32.0.rc0
9 months
[PATCH] batman-adv: remove unnecessary type castings
by Yu Zhe
remove unnecessary void* type castings.
Signed-off-by: Yu Zhe <yuzhe(a)nfschina.com>
---
net/batman-adv/translation-table.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 8478034d3abf..cbf96eebf05b 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -2766,7 +2766,7 @@ static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv,
u32 i;
tt_tot = batadv_tt_entries(tt_len);
- tt_change = (struct batadv_tvlv_tt_change *)tvlv_buff;
+ tt_change = tvlv_buff;
if (!valid_cb)
return;
@@ -3994,7 +3994,7 @@ static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
if (tvlv_value_len < sizeof(*tt_data))
return;
- tt_data = (struct batadv_tvlv_tt_data *)tvlv_value;
+ tt_data = tvlv_value;
tvlv_value_len -= sizeof(*tt_data);
num_vlan = ntohs(tt_data->num_vlan);
@@ -4037,7 +4037,7 @@ static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
if (tvlv_value_len < sizeof(*tt_data))
return NET_RX_SUCCESS;
- tt_data = (struct batadv_tvlv_tt_data *)tvlv_value;
+ tt_data = tvlv_value;
tvlv_value_len -= sizeof(*tt_data);
tt_vlan_len = sizeof(struct batadv_tvlv_tt_vlan_data);
@@ -4129,7 +4129,7 @@ static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
goto out;
batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
- roaming_adv = (struct batadv_tvlv_roam_adv *)tvlv_value;
+ roaming_adv = tvlv_value;
batadv_dbg(BATADV_DBG_TT, bat_priv,
"Received ROAMING_ADV from %pM (client %pM)\n",
--
2.25.1
9 months, 1 week
Re: [PATCH] batman-adv: remove unnecessary type castings
by Sven Eckelmann
Hi,
we neither received your mail via the mailing list nor our private mail
servers. It seems your mail setup is broken:
Apr 21 15:48:37 dvalin postfix/smtpd[10256]: NOQUEUE: reject: RCPT from unknown[2400:dd01:100f:2:72e2:84ff:fe10:5f45]: 450 4.7.1 <ha.nfschina.com>: Helo command rejected: Host not found; from=<yuzhe(a)nfschina.com> to=<sven(a)narfation.org> proto=ESMTP helo=<ha.nfschina.co>
And when I test it myself, it is also not working:
$ dig @8.8.8.8 ha.nfschina.com
; <<>> DiG 9.16.27-Debian <<>> @8.8.8.8 ha.nfschina.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 39639
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;ha.nfschina.com. IN A
;; AUTHORITY SECTION:
nfschina.com. 600 IN SOA dns11.hichina.com. hostmaster.hichina.com. 2022011002 3600 1200 86400 600
;; Query time: 328 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Apr 22 09:51:56 CEST 2022
;; MSG SIZE rcvd: 105
Please fix this before sending patches out.
But the kernel test bot already demonstrated why this patch is not a good
idea. You can improve it and resent it but I will not accept it in this form.
Kind regards,
Sven
9 months, 1 week
[PATCH] batctl: ping: Skip sleep after last packet
by Sven Eckelmann
The -i option for ping is documented as interval between ping requests. But
the sleep was also applied after all the requested pings already sent out.
As result, the user had to wait additional time until the statistics for
the (limited) ping test was printed.
Just skip the last sleep in case there will be no next ping packet to avoid
this problem.
Reported-by: Roman Le bg <roman(a)romanlebg.fr>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
ping.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ping.c b/ping.c
index 7565dcd..3681e7e 100644
--- a/ping.c
+++ b/ping.c
@@ -282,6 +282,10 @@ static int ping(struct state *state, int argc, char **argv)
}
sleep:
+ /* skip last sleep in case no more packets will be sent out */
+ if (loop_count == 0)
+ continue;
+
if (loop_interval > 0)
sleep(loop_interval);
else if ((tv.tv_sec != 0) || (tv.tv_usec != 0))
--
2.30.2
9 months, 2 weeks
Re: [PATCH] batman-adv: remove unnecessary type castings
by kernel test robot
Hi Yu,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.18-rc3 next-20220421]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Yu-Zhe/batman-adv-remove-u...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b253435746d9a4a701b5f09211b9c14d3370d0da
config: parisc-randconfig-s031-20220421 (https://download.01.org/0day-ci/archive/20220422/202204221227.5z0xsJa9-lk...)
compiler: hppa-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/intel-lab-lkp/linux/commit/2474b41c585e849d3546e0aba8f...
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Yu-Zhe/batman-adv-remove-unnecessary-type-castings/20220421-235254
git checkout 2474b41c585e849d3546e0aba8f3c862735a04ff
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=parisc SHELL=/bin/bash net/batman-adv/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> net/batman-adv/bridge_loop_avoidance.c:68:42: sparse: sparse: incorrect type in initializer (different modifiers) @@ expected struct batadv_bla_claim *claim @@ got void const *data @@
net/batman-adv/bridge_loop_avoidance.c:68:42: sparse: expected struct batadv_bla_claim *claim
net/batman-adv/bridge_loop_avoidance.c:68:42: sparse: got void const *data
>> net/batman-adv/bridge_loop_avoidance.c:68:42: sparse: sparse: incorrect type in initializer (different modifiers) @@ expected struct batadv_bla_claim *claim @@ got void const *data @@
net/batman-adv/bridge_loop_avoidance.c:68:42: sparse: expected struct batadv_bla_claim *claim
net/batman-adv/bridge_loop_avoidance.c:68:42: sparse: got void const *data
--
>> net/batman-adv/translation-table.c:109:12: sparse: sparse: incorrect type in assignment (different modifiers) @@ expected struct batadv_tt_common_entry *tt @@ got void const *data @@
net/batman-adv/translation-table.c:109:12: sparse: expected struct batadv_tt_common_entry *tt
net/batman-adv/translation-table.c:109:12: sparse: got void const *data
>> net/batman-adv/translation-table.c:109:12: sparse: sparse: incorrect type in assignment (different modifiers) @@ expected struct batadv_tt_common_entry *tt @@ got void const *data @@
net/batman-adv/translation-table.c:109:12: sparse: expected struct batadv_tt_common_entry *tt
net/batman-adv/translation-table.c:109:12: sparse: got void const *data
vim +68 net/batman-adv/bridge_loop_avoidance.c
53
54 static void batadv_bla_periodic_work(struct work_struct *work);
55 static void
56 batadv_bla_send_announce(struct batadv_priv *bat_priv,
57 struct batadv_bla_backbone_gw *backbone_gw);
58
59 /**
60 * batadv_choose_claim() - choose the right bucket for a claim.
61 * @data: data to hash
62 * @size: size of the hash table
63 *
64 * Return: the hash index of the claim
65 */
66 static inline u32 batadv_choose_claim(const void *data, u32 size)
67 {
> 68 struct batadv_bla_claim *claim = data;
69 u32 hash = 0;
70
71 hash = jhash(&claim->addr, sizeof(claim->addr), hash);
72 hash = jhash(&claim->vid, sizeof(claim->vid), hash);
73
74 return hash % size;
75 }
76
--
0-DAY CI Kernel Test Service
https://01.org/lkp
9 months, 2 weeks
Re: [PATCH] batman-adv: remove unnecessary type castings
by kernel test robot
Hi Yu,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.18-rc3 next-20220421]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Yu-Zhe/batman-adv-remove-u...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b253435746d9a4a701b5f09211b9c14d3370d0da
config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20220422/202204221034.hfPA4RPW-lk...)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5bd87350a5ae429baf8f373cb226a57b62f87280)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/2474b41c585e849d3546e0aba8f...
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Yu-Zhe/batman-adv-remove-unnecessary-type-castings/20220421-235254
git checkout 2474b41c585e849d3546e0aba8f3c862735a04ff
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/batman-adv/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
>> net/batman-adv/bridge_loop_avoidance.c:68:27: error: initializing 'struct batadv_bla_claim *' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
struct batadv_bla_claim *claim = data;
^ ~~~~
1 error generated.
--
>> net/batman-adv/translation-table.c:109:5: error: assigning to 'struct batadv_tt_common_entry *' from 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
tt = data;
^ ~~~~
1 error generated.
vim +68 net/batman-adv/bridge_loop_avoidance.c
53
54 static void batadv_bla_periodic_work(struct work_struct *work);
55 static void
56 batadv_bla_send_announce(struct batadv_priv *bat_priv,
57 struct batadv_bla_backbone_gw *backbone_gw);
58
59 /**
60 * batadv_choose_claim() - choose the right bucket for a claim.
61 * @data: data to hash
62 * @size: size of the hash table
63 *
64 * Return: the hash index of the claim
65 */
66 static inline u32 batadv_choose_claim(const void *data, u32 size)
67 {
> 68 struct batadv_bla_claim *claim = data;
69 u32 hash = 0;
70
71 hash = jhash(&claim->addr, sizeof(claim->addr), hash);
72 hash = jhash(&claim->vid, sizeof(claim->vid), hash);
73
74 return hash % size;
75 }
76
--
0-DAY CI Kernel Test Service
https://01.org/lkp
9 months, 2 weeks
Re: [PATCH] batman-adv: remove unnecessary type castings
by kernel test robot
Hi Yu,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.18-rc3 next-20220421]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Yu-Zhe/batman-adv-remove-u...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b253435746d9a4a701b5f09211b9c14d3370d0da
config: x86_64-randconfig-a013 (https://download.01.org/0day-ci/archive/20220422/202204221051.PRtLc0f7-lk...)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/2474b41c585e849d3546e0aba8f...
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Yu-Zhe/batman-adv-remove-unnecessary-type-castings/20220421-235254
git checkout 2474b41c585e849d3546e0aba8f3c862735a04ff
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash net/batman-adv/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
net/batman-adv/bridge_loop_avoidance.c: In function 'batadv_choose_claim':
>> net/batman-adv/bridge_loop_avoidance.c:68:42: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
68 | struct batadv_bla_claim *claim = data;
| ^~~~
--
net/batman-adv/translation-table.c: In function 'batadv_choose_tt':
>> net/batman-adv/translation-table.c:109:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
109 | tt = data;
| ^
vim +/const +68 net/batman-adv/bridge_loop_avoidance.c
53
54 static void batadv_bla_periodic_work(struct work_struct *work);
55 static void
56 batadv_bla_send_announce(struct batadv_priv *bat_priv,
57 struct batadv_bla_backbone_gw *backbone_gw);
58
59 /**
60 * batadv_choose_claim() - choose the right bucket for a claim.
61 * @data: data to hash
62 * @size: size of the hash table
63 *
64 * Return: the hash index of the claim
65 */
66 static inline u32 batadv_choose_claim(const void *data, u32 size)
67 {
> 68 struct batadv_bla_claim *claim = data;
69 u32 hash = 0;
70
71 hash = jhash(&claim->addr, sizeof(claim->addr), hash);
72 hash = jhash(&claim->vid, sizeof(claim->vid), hash);
73
74 return hash % size;
75 }
76
--
0-DAY CI Kernel Test Service
https://01.org/lkp
9 months, 2 weeks
Re: [PATCH] batman-adv: remove unnecessary type castings
by kernel test robot
Hi Yu,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.18-rc3 next-20220421]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Yu-Zhe/batman-adv-remove-u...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b253435746d9a4a701b5f09211b9c14d3370d0da
config: m68k-defconfig (https://download.01.org/0day-ci/archive/20220422/202204221027.ETcMYyKP-lk...)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/2474b41c585e849d3546e0aba8f...
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Yu-Zhe/batman-adv-remove-unnecessary-type-castings/20220421-235254
git checkout 2474b41c585e849d3546e0aba8f3c862735a04ff
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash net/batman-adv/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
net/batman-adv/bridge_loop_avoidance.c: In function 'batadv_choose_claim':
>> net/batman-adv/bridge_loop_avoidance.c:68:42: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
68 | struct batadv_bla_claim *claim = data;
| ^~~~
vim +/const +68 net/batman-adv/bridge_loop_avoidance.c
53
54 static void batadv_bla_periodic_work(struct work_struct *work);
55 static void
56 batadv_bla_send_announce(struct batadv_priv *bat_priv,
57 struct batadv_bla_backbone_gw *backbone_gw);
58
59 /**
60 * batadv_choose_claim() - choose the right bucket for a claim.
61 * @data: data to hash
62 * @size: size of the hash table
63 *
64 * Return: the hash index of the claim
65 */
66 static inline u32 batadv_choose_claim(const void *data, u32 size)
67 {
> 68 struct batadv_bla_claim *claim = data;
69 u32 hash = 0;
70
71 hash = jhash(&claim->addr, sizeof(claim->addr), hash);
72 hash = jhash(&claim->vid, sizeof(claim->vid), hash);
73
74 return hash % size;
75 }
76
--
0-DAY CI Kernel Test Service
https://01.org/lkp
9 months, 2 weeks