Skip to content

Commit a648a59

Browse files
Paolo Abenidavem330
authored andcommitted
net: adjust socket level ICW to cope with ipv6 variant of {recv, send}msg
After the previous patch we have ipv{6,4} variants for {recv,send}msg, we should use the generic _INET ICW variant to call into the proper build-in. This also allows dropping the now unused and rather ugly _INET4 ICW macro v1 -> v2: - use ICW macro to declare inet6_{recv,send}msg - fix a couple of checkpatch offender in the code context Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 68ab5d1 commit a648a59

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

net/socket.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,6 @@
103103
#include <net/busy_poll.h>
104104
#include <linux/errqueue.h>
105105

106-
/* proto_ops for ipv4 and ipv6 use the same {recv,send}msg function */
107-
#if IS_ENABLED(CONFIG_INET)
108-
#define INDIRECT_CALL_INET4(f, f1, ...) INDIRECT_CALL_1(f, f1, __VA_ARGS__)
109-
#else
110-
#define INDIRECT_CALL_INET4(f, f1, ...) f(__VA_ARGS__)
111-
#endif
112-
113106
#ifdef CONFIG_NET_RX_BUSY_POLL
114107
unsigned int sysctl_net_busy_read __read_mostly;
115108
unsigned int sysctl_net_busy_poll __read_mostly;
@@ -641,10 +634,13 @@ EXPORT_SYMBOL(__sock_tx_timestamp);
641634

642635
INDIRECT_CALLABLE_DECLARE(int inet_sendmsg(struct socket *, struct msghdr *,
643636
size_t));
637+
INDIRECT_CALLABLE_DECLARE(int inet6_sendmsg(struct socket *, struct msghdr *,
638+
size_t));
644639
static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg)
645640
{
646-
int ret = INDIRECT_CALL_INET4(sock->ops->sendmsg, inet_sendmsg, sock,
647-
msg, msg_data_left(msg));
641+
int ret = INDIRECT_CALL_INET(sock->ops->sendmsg, inet6_sendmsg,
642+
inet_sendmsg, sock, msg,
643+
msg_data_left(msg));
648644
BUG_ON(ret == -EIOCBQUEUED);
649645
return ret;
650646
}
@@ -870,12 +866,15 @@ void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
870866
EXPORT_SYMBOL_GPL(__sock_recv_ts_and_drops);
871867

872868
INDIRECT_CALLABLE_DECLARE(int inet_recvmsg(struct socket *, struct msghdr *,
873-
size_t , int ));
869+
size_t, int));
870+
INDIRECT_CALLABLE_DECLARE(int inet6_recvmsg(struct socket *, struct msghdr *,
871+
size_t, int));
874872
static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
875873
int flags)
876874
{
877-
return INDIRECT_CALL_INET4(sock->ops->recvmsg, inet_recvmsg, sock, msg,
878-
msg_data_left(msg), flags);
875+
return INDIRECT_CALL_INET(sock->ops->recvmsg, inet6_recvmsg,
876+
inet_recvmsg, sock, msg, msg_data_left(msg),
877+
flags);
879878
}
880879

881880
/**

0 commit comments

Comments
 (0)