* [PATCH net-next 0/7] net: deduplicate cookie logic
@ 2025-02-06 19:34 Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 1/7] tcp: only initialize sockcm tsflags field Willem de Bruijn
` (6 more replies)
0 siblings, 7 replies; 13+ messages in thread
From: Willem de Bruijn @ 2025-02-06 19:34 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
Reuse standard sk, ip and ipv6 cookie init handlers where possible.
Avoid repeated open coding of the same logic.
Harmonize feature sets across protocols.
Make IPv4 and IPv6 logic more alike.
Simplify adding future new fields with a single init point.
Willem de Bruijn (7):
tcp: only initialize sockcm tsflags field
net: initialize mark in sockcm_init
ipv4: initialize inet socket cookies with sockcm_init
ipv4: remove get_rttos
icmp: reflect tos through ip cookie rather than updating inet_sk
ipv6: replace ipcm6_init calls with ipcm6_init_sk
ipv6: initialize inet socket cookies with sockcm_init
include/net/ip.h | 16 +++++-----------
include/net/ipv6.h | 11 ++---------
include/net/sock.h | 1 +
net/can/raw.c | 2 +-
net/ipv4/icmp.c | 4 ++--
net/ipv4/ip_sockglue.c | 4 ++--
net/ipv4/ping.c | 1 -
net/ipv4/raw.c | 1 -
net/ipv4/tcp.c | 2 +-
net/ipv4/udp.c | 1 -
net/ipv6/ping.c | 3 ---
net/ipv6/raw.c | 15 +++------------
net/ipv6/udp.c | 10 +---------
net/l2tp/l2tp_ip6.c | 8 +-------
net/packet/af_packet.c | 9 ++++-----
15 files changed, 23 insertions(+), 65 deletions(-)
--
2.48.1.502.g6dc24dfdaf-goog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net-next 1/7] tcp: only initialize sockcm tsflags field
2025-02-06 19:34 [PATCH net-next 0/7] net: deduplicate cookie logic Willem de Bruijn
@ 2025-02-06 19:34 ` Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 2/7] net: initialize mark in sockcm_init Willem de Bruijn
` (5 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Willem de Bruijn @ 2025-02-06 19:34 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
TCP only reads the tsflags field. Don't bother initializing others.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
Another option is to entirely avoid sockcm_cookie in the tcp hot path.
Limit its use to the sock_cmsg_send branch:
@@ -1123,13 +1123,17 @@ int tcp_sendmsg_locked(struct sock *sk, struct
msghdr *msg, size_t size)
/* 'common' sending to sendq */
}
- sockcm_init(&sockc, sk);
+ tsflags = READ_ONCE(sk->sk_tsflags);
if (msg->msg_controllen) {
+ struct sockcm_cookie sockc = { .tsflags = tsflags };
+
err = sock_cmsg_send(sk, msg, &sockc);
if (unlikely(err)) {
err = -EINVAL;
goto out_err;
}
+
+ tsflags = sockc.tsflags;
This involves a bit more rework, to have sock_tx_timestamp take a u32
tsflags directly.
---
net/ipv4/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 0d704bda6c41..1f94b4e6c7ec 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1123,7 +1123,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
/* 'common' sending to sendq */
}
- sockcm_init(&sockc, sk);
+ sockc = (struct sockcm_cookie) { .tsflags = READ_ONCE(sk->sk_tsflags)};
if (msg->msg_controllen) {
err = sock_cmsg_send(sk, msg, &sockc);
if (unlikely(err)) {
--
2.48.1.502.g6dc24dfdaf-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 2/7] net: initialize mark in sockcm_init
2025-02-06 19:34 [PATCH net-next 0/7] net: deduplicate cookie logic Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 1/7] tcp: only initialize sockcm tsflags field Willem de Bruijn
@ 2025-02-06 19:34 ` Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 3/7] ipv4: initialize inet socket cookies with sockcm_init Willem de Bruijn
` (4 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Willem de Bruijn @ 2025-02-06 19:34 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
Avoid open coding initialization of sockcm fields.
Avoid reading the sk_priority field twice.
This ensures all callers, existing and future, will correctly try a
cmsg passed mark before sk_mark.
This patch extends support for cmsg mark to:
packet_spkt and packet_tpacket and net/can/raw.c.
This patch extends support for cmsg priority to:
packet_spkt and packet_tpacket.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
include/net/sock.h | 1 +
net/can/raw.c | 2 +-
net/packet/af_packet.c | 9 ++++-----
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 8036b3b79cd8..767a60e80086 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1828,6 +1828,7 @@ static inline void sockcm_init(struct sockcm_cookie *sockc,
const struct sock *sk)
{
*sockc = (struct sockcm_cookie) {
+ .mark = READ_ONCE(sk->sk_mark),
.tsflags = READ_ONCE(sk->sk_tsflags),
.priority = READ_ONCE(sk->sk_priority),
};
diff --git a/net/can/raw.c b/net/can/raw.c
index 46e8ed9d64da..9b1d5f036f57 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -963,7 +963,7 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
skb->dev = dev;
skb->priority = sockc.priority;
- skb->mark = READ_ONCE(sk->sk_mark);
+ skb->mark = sockc.mark;
skb->tstamp = sockc.transmit_time;
skb_setup_tx_timestamp(skb, &sockc);
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index c131e5ceea37..3e9ddf72cd03 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2102,8 +2102,8 @@ static int packet_sendmsg_spkt(struct socket *sock, struct msghdr *msg,
skb->protocol = proto;
skb->dev = dev;
- skb->priority = READ_ONCE(sk->sk_priority);
- skb->mark = READ_ONCE(sk->sk_mark);
+ skb->priority = sockc.priority;
+ skb->mark = sockc.mark;
skb_set_delivery_type_by_clockid(skb, sockc.transmit_time, sk->sk_clockid);
skb_setup_tx_timestamp(skb, &sockc);
@@ -2634,8 +2634,8 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
skb->protocol = proto;
skb->dev = dev;
- skb->priority = READ_ONCE(po->sk.sk_priority);
- skb->mark = READ_ONCE(po->sk.sk_mark);
+ skb->priority = sockc->priority;
+ skb->mark = sockc->mark;
skb_set_delivery_type_by_clockid(skb, sockc->transmit_time, po->sk.sk_clockid);
skb_setup_tx_timestamp(skb, sockc);
skb_zcopy_set_nouarg(skb, ph.raw);
@@ -3039,7 +3039,6 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
goto out_unlock;
sockcm_init(&sockc, sk);
- sockc.mark = READ_ONCE(sk->sk_mark);
if (msg->msg_controllen) {
err = sock_cmsg_send(sk, msg, &sockc);
if (unlikely(err))
--
2.48.1.502.g6dc24dfdaf-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 3/7] ipv4: initialize inet socket cookies with sockcm_init
2025-02-06 19:34 [PATCH net-next 0/7] net: deduplicate cookie logic Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 1/7] tcp: only initialize sockcm tsflags field Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 2/7] net: initialize mark in sockcm_init Willem de Bruijn
@ 2025-02-06 19:34 ` Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 4/7] ipv4: remove get_rttos Willem de Bruijn
` (3 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Willem de Bruijn @ 2025-02-06 19:34 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
Avoid open coding the same logic.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
include/net/ip.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/net/ip.h b/include/net/ip.h
index 9f5e33e371fc..6af16545b3e3 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -94,9 +94,8 @@ static inline void ipcm_init_sk(struct ipcm_cookie *ipcm,
{
ipcm_init(ipcm);
- ipcm->sockc.mark = READ_ONCE(inet->sk.sk_mark);
- ipcm->sockc.priority = READ_ONCE(inet->sk.sk_priority);
- ipcm->sockc.tsflags = READ_ONCE(inet->sk.sk_tsflags);
+ sockcm_init(&ipcm->sockc, &inet->sk);
+
ipcm->oif = READ_ONCE(inet->sk.sk_bound_dev_if);
ipcm->addr = inet->inet_saddr;
ipcm->protocol = inet->inet_num;
--
2.48.1.502.g6dc24dfdaf-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 4/7] ipv4: remove get_rttos
2025-02-06 19:34 [PATCH net-next 0/7] net: deduplicate cookie logic Willem de Bruijn
` (2 preceding siblings ...)
2025-02-06 19:34 ` [PATCH net-next 3/7] ipv4: initialize inet socket cookies with sockcm_init Willem de Bruijn
@ 2025-02-06 19:34 ` Willem de Bruijn
2025-02-07 0:59 ` Willem de Bruijn
2025-02-08 9:24 ` kernel test robot
2025-02-06 19:34 ` [PATCH net-next 5/7] icmp: reflect tos through ip cookie rather than updating inet_sk Willem de Bruijn
` (2 subsequent siblings)
6 siblings, 2 replies; 13+ messages in thread
From: Willem de Bruijn @ 2025-02-06 19:34 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
Initialize the ip cookie tos field when initializing the cookie, in
ipcm_init_sk.
The existing code inverts the standard pattern for initializing cookie
fields. Default is to initialize the field from the sk, then possibly
overwrite that when parsing cmsgs (the unlikely case).
This field inverts that, setting the field to an illegal value and
after cmsg parsing checking whether the value is still illegal and
thus should be overridden.
Be careful to always apply mask INET_DSCP_MASK, as before.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
include/net/ip.h | 11 +++--------
net/ipv4/ip_sockglue.c | 4 ++--
net/ipv4/ping.c | 1 -
net/ipv4/raw.c | 1 -
net/ipv4/udp.c | 1 -
5 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/include/net/ip.h b/include/net/ip.h
index 6af16545b3e3..6819704e2642 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -92,7 +92,9 @@ static inline void ipcm_init(struct ipcm_cookie *ipcm)
static inline void ipcm_init_sk(struct ipcm_cookie *ipcm,
const struct inet_sock *inet)
{
- ipcm_init(ipcm);
+ *ipcm = (struct ipcm_cookie) {
+ .tos = READ_ONCE(inet->tos) & INET_DSCP_MASK,
+ };
sockcm_init(&ipcm->sockc, &inet->sk);
@@ -256,13 +258,6 @@ static inline u8 ip_sendmsg_scope(const struct inet_sock *inet,
return RT_SCOPE_UNIVERSE;
}
-static inline __u8 get_rttos(struct ipcm_cookie* ipc, struct inet_sock *inet)
-{
- u8 dsfield = ipc->tos != -1 ? ipc->tos : READ_ONCE(inet->tos);
-
- return dsfield & INET_DSCP_MASK;
-}
-
/* datagram.c */
int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 6d9c5c20b1c4..98b1e4a8b72e 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -314,8 +314,8 @@ int ip_cmsg_send(struct sock *sk, struct msghdr *msg, struct ipcm_cookie *ipc,
return -EINVAL;
if (val < 0 || val > 255)
return -EINVAL;
- ipc->tos = val;
- ipc->sockc.priority = rt_tos2priority(ipc->tos);
+ ipc->sockc.priority = rt_tos2priority(val);
+ ipc->tos = val & INET_DSCP_MASK;
break;
case IP_PROTOCOL:
if (cmsg->cmsg_len != CMSG_LEN(sizeof(int)))
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 619ddc087957..0215885c6df5 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -768,7 +768,6 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
}
faddr = ipc.opt->opt.faddr;
}
- tos = get_rttos(&ipc, inet);
scope = ip_sendmsg_scope(inet, &ipc, msg);
if (ipv4_is_multicast(daddr)) {
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 4304a68d1db0..b1f3fe7962bf 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -581,7 +581,6 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
daddr = ipc.opt->opt.faddr;
}
}
- tos = get_rttos(&ipc, inet);
scope = ip_sendmsg_scope(inet, &ipc, msg);
uc_index = READ_ONCE(inet->uc_index);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index c472c9a57cf6..97ded5f0ae6c 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1405,7 +1405,6 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
faddr = ipc.opt->opt.faddr;
connected = 0;
}
- tos = get_rttos(&ipc, inet);
scope = ip_sendmsg_scope(inet, &ipc, msg);
if (scope == RT_SCOPE_LINK)
connected = 0;
--
2.48.1.502.g6dc24dfdaf-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 5/7] icmp: reflect tos through ip cookie rather than updating inet_sk
2025-02-06 19:34 [PATCH net-next 0/7] net: deduplicate cookie logic Willem de Bruijn
` (3 preceding siblings ...)
2025-02-06 19:34 ` [PATCH net-next 4/7] ipv4: remove get_rttos Willem de Bruijn
@ 2025-02-06 19:34 ` Willem de Bruijn
2025-02-07 1:01 ` Willem de Bruijn
2025-02-08 10:40 ` kernel test robot
2025-02-06 19:34 ` [PATCH net-next 6/7] ipv6: replace ipcm6_init calls with ipcm6_init_sk Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 7/7] ipv6: initialize inet socket cookies with sockcm_init Willem de Bruijn
6 siblings, 2 replies; 13+ messages in thread
From: Willem de Bruijn @ 2025-02-06 19:34 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
Do not modify socket fields if it can be avoided.
The current code predates the introduction of ip cookies in commit
aa6615814533 ("ipv4: processing ancillary IP_TOS or IP_TTL"). Now that
cookies exist and support tos, update that field directly.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
Tested with ping -Q 32 127.0.0.1 and tcpdump
The existing logic works because inet->tos is read if ipc.tos (and
with that cork->tos) is left unitialized:
iph->tos = (cork->tos != -1) ? cork->tos : READ_ONCE(inet->tos);
---
net/ipv4/icmp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 094084b61bff..9c5e052a7802 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -429,7 +429,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
icmp_param->data.icmph.checksum = 0;
ipcm_init(&ipc);
- inet->tos = ip_hdr(skb)->tos;
+ ipc.tos = ip_hdr(skb)->tos;
ipc.sockc.mark = mark;
daddr = ipc.addr = ip_hdr(skb)->saddr;
saddr = fib_compute_spec_dst(skb);
@@ -735,8 +735,8 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
icmp_param.data.icmph.checksum = 0;
icmp_param.skb = skb_in;
icmp_param.offset = skb_network_offset(skb_in);
- inet_sk(sk)->tos = tos;
ipcm_init(&ipc);
+ ipc.tos = tos;
ipc.addr = iph->saddr;
ipc.opt = &icmp_param.replyopts.opt;
ipc.sockc.mark = mark;
--
2.48.1.502.g6dc24dfdaf-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 6/7] ipv6: replace ipcm6_init calls with ipcm6_init_sk
2025-02-06 19:34 [PATCH net-next 0/7] net: deduplicate cookie logic Willem de Bruijn
` (4 preceding siblings ...)
2025-02-06 19:34 ` [PATCH net-next 5/7] icmp: reflect tos through ip cookie rather than updating inet_sk Willem de Bruijn
@ 2025-02-06 19:34 ` Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 7/7] ipv6: initialize inet socket cookies with sockcm_init Willem de Bruijn
6 siblings, 0 replies; 13+ messages in thread
From: Willem de Bruijn @ 2025-02-06 19:34 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
This initializes tclass and dontfrag before cmsg parsing, removing the
need for explicit checks against -1 in each caller.
Leave hlimit set to -1, because its full initialization
(in ip6_sk_dst_hoplimit) requires more state (dst, flowi6, ..).
This also prepares for calling sockcm_init in a follow-on patch.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
include/net/ipv6.h | 9 ---------
net/ipv6/raw.c | 8 +-------
net/ipv6/udp.c | 7 +------
net/l2tp/l2tp_ip6.c | 8 +-------
4 files changed, 3 insertions(+), 29 deletions(-)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index f5c43ad1565e..46a679d9b334 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -363,15 +363,6 @@ struct ipcm6_cookie {
struct ipv6_txoptions *opt;
};
-static inline void ipcm6_init(struct ipcm6_cookie *ipc6)
-{
- *ipc6 = (struct ipcm6_cookie) {
- .hlimit = -1,
- .tclass = -1,
- .dontfrag = -1,
- };
-}
-
static inline void ipcm6_init_sk(struct ipcm6_cookie *ipc6,
const struct sock *sk)
{
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index a45aba090aa4..ae68d3f7dd32 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -777,7 +777,7 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
fl6.flowi6_mark = READ_ONCE(sk->sk_mark);
fl6.flowi6_uid = sk->sk_uid;
- ipcm6_init(&ipc6);
+ ipcm6_init_sk(&ipc6, sk);
ipc6.sockc.tsflags = READ_ONCE(sk->sk_tsflags);
ipc6.sockc.mark = fl6.flowi6_mark;
ipc6.sockc.priority = READ_ONCE(sk->sk_priority);
@@ -891,9 +891,6 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (hdrincl)
fl6.flowi6_flags |= FLOWI_FLAG_KNOWN_NH;
- if (ipc6.tclass < 0)
- ipc6.tclass = np->tclass;
-
fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
@@ -904,9 +901,6 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (ipc6.hlimit < 0)
ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);
- if (ipc6.dontfrag < 0)
- ipc6.dontfrag = inet6_test_bit(DONTFRAG, sk);
-
if (msg->msg_flags&MSG_CONFIRM)
goto do_confirm;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 6671daa67f4f..8d1ef8e2fe1e 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1494,7 +1494,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
int is_udplite = IS_UDPLITE(sk);
int (*getfrag)(void *, char *, int, int, int, struct sk_buff *);
- ipcm6_init(&ipc6);
+ ipcm6_init_sk(&ipc6, sk);
ipc6.gso_size = READ_ONCE(up->gso_size);
ipc6.sockc.tsflags = READ_ONCE(sk->sk_tsflags);
ipc6.sockc.mark = READ_ONCE(sk->sk_mark);
@@ -1704,9 +1704,6 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
security_sk_classify_flow(sk, flowi6_to_flowi_common(fl6));
- if (ipc6.tclass < 0)
- ipc6.tclass = np->tclass;
-
fl6->flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6->flowlabel);
dst = ip6_sk_dst_lookup_flow(sk, fl6, final_p, connected);
@@ -1752,8 +1749,6 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
WRITE_ONCE(up->pending, AF_INET6);
do_append_data:
- if (ipc6.dontfrag < 0)
- ipc6.dontfrag = inet6_test_bit(DONTFRAG, sk);
up->len += ulen;
err = ip6_append_data(sk, getfrag, msg, ulen, sizeof(struct udphdr),
&ipc6, fl6, dst_rt6_info(dst),
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index f4c1da070826..b98d13584c81 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -547,7 +547,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
fl6.flowi6_mark = READ_ONCE(sk->sk_mark);
fl6.flowi6_uid = sk->sk_uid;
- ipcm6_init(&ipc6);
+ ipcm6_init_sk(&ipc6, sk);
if (lsa) {
if (addr_len < SIN6_LEN_RFC2133)
@@ -634,9 +634,6 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
security_sk_classify_flow(sk, flowi6_to_flowi_common(&fl6));
- if (ipc6.tclass < 0)
- ipc6.tclass = np->tclass;
-
fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
@@ -648,9 +645,6 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (ipc6.hlimit < 0)
ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);
- if (ipc6.dontfrag < 0)
- ipc6.dontfrag = inet6_test_bit(DONTFRAG, sk);
-
if (msg->msg_flags & MSG_CONFIRM)
goto do_confirm;
--
2.48.1.502.g6dc24dfdaf-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next 7/7] ipv6: initialize inet socket cookies with sockcm_init
2025-02-06 19:34 [PATCH net-next 0/7] net: deduplicate cookie logic Willem de Bruijn
` (5 preceding siblings ...)
2025-02-06 19:34 ` [PATCH net-next 6/7] ipv6: replace ipcm6_init calls with ipcm6_init_sk Willem de Bruijn
@ 2025-02-06 19:34 ` Willem de Bruijn
6 siblings, 0 replies; 13+ messages in thread
From: Willem de Bruijn @ 2025-02-06 19:34 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
Avoid open coding the same logic.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
include/net/ipv6.h | 2 ++
net/ipv6/ping.c | 3 ---
net/ipv6/raw.c | 9 +++------
net/ipv6/udp.c | 3 ---
4 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 46a679d9b334..9614006f483c 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -371,6 +371,8 @@ static inline void ipcm6_init_sk(struct ipcm6_cookie *ipc6,
.tclass = inet6_sk(sk)->tclass,
.dontfrag = inet6_test_bit(DONTFRAG, sk),
};
+
+ sockcm_init(&ipc6->sockc, sk);
}
static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np)
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index 46b8adf6e7f8..84d90dd8b3f0 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -119,9 +119,6 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
return -EINVAL;
ipcm6_init_sk(&ipc6, sk);
- ipc6.sockc.priority = READ_ONCE(sk->sk_priority);
- ipc6.sockc.tsflags = READ_ONCE(sk->sk_tsflags);
- ipc6.sockc.mark = READ_ONCE(sk->sk_mark);
fl6.flowi6_oif = oif;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index ae68d3f7dd32..fda640ebd53f 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -769,19 +769,16 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
hdrincl = inet_test_bit(HDRINCL, sk);
+ ipcm6_init_sk(&ipc6, sk);
+
/*
* Get and verify the address.
*/
memset(&fl6, 0, sizeof(fl6));
- fl6.flowi6_mark = READ_ONCE(sk->sk_mark);
+ fl6.flowi6_mark = ipc6.sockc.mark;
fl6.flowi6_uid = sk->sk_uid;
- ipcm6_init_sk(&ipc6, sk);
- ipc6.sockc.tsflags = READ_ONCE(sk->sk_tsflags);
- ipc6.sockc.mark = fl6.flowi6_mark;
- ipc6.sockc.priority = READ_ONCE(sk->sk_priority);
-
if (sin6) {
if (addr_len < SIN6_LEN_RFC2133)
return -EINVAL;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 8d1ef8e2fe1e..1c6c86c0b8a9 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1496,9 +1496,6 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
ipcm6_init_sk(&ipc6, sk);
ipc6.gso_size = READ_ONCE(up->gso_size);
- ipc6.sockc.tsflags = READ_ONCE(sk->sk_tsflags);
- ipc6.sockc.mark = READ_ONCE(sk->sk_mark);
- ipc6.sockc.priority = READ_ONCE(sk->sk_priority);
/* destination address check */
if (sin6) {
--
2.48.1.502.g6dc24dfdaf-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH net-next 4/7] ipv4: remove get_rttos
2025-02-06 19:34 ` [PATCH net-next 4/7] ipv4: remove get_rttos Willem de Bruijn
@ 2025-02-07 0:59 ` Willem de Bruijn
2025-02-07 17:33 ` Willem de Bruijn
2025-02-08 9:24 ` kernel test robot
1 sibling, 1 reply; 13+ messages in thread
From: Willem de Bruijn @ 2025-02-07 0:59 UTC (permalink / raw)
To: Willem de Bruijn, netdev; +Cc: davem, kuba, edumazet, pabeni, Willem de Bruijn
Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
>
> Initialize the ip cookie tos field when initializing the cookie, in
> ipcm_init_sk.
>
> The existing code inverts the standard pattern for initializing cookie
> fields. Default is to initialize the field from the sk, then possibly
> overwrite that when parsing cmsgs (the unlikely case).
>
> This field inverts that, setting the field to an illegal value and
> after cmsg parsing checking whether the value is still illegal and
> thus should be overridden.
>
> Be careful to always apply mask INET_DSCP_MASK, as before.
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
> ---
> include/net/ip.h | 11 +++--------
> net/ipv4/ip_sockglue.c | 4 ++--
> net/ipv4/ping.c | 1 -
> net/ipv4/raw.c | 1 -
> net/ipv4/udp.c | 1 -
> 5 files changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/include/net/ip.h b/include/net/ip.h
> index 6af16545b3e3..6819704e2642 100644
> --- a/include/net/ip.h
> +++ b/include/net/ip.h
> @@ -92,7 +92,9 @@ static inline void ipcm_init(struct ipcm_cookie *ipcm)
> static inline void ipcm_init_sk(struct ipcm_cookie *ipcm,
> const struct inet_sock *inet)
> {
> - ipcm_init(ipcm);
> + *ipcm = (struct ipcm_cookie) {
> + .tos = READ_ONCE(inet->tos) & INET_DSCP_MASK,
> + };
>
> sockcm_init(&ipcm->sockc, &inet->sk);
>
> @@ -256,13 +258,6 @@ static inline u8 ip_sendmsg_scope(const struct inet_sock *inet,
> return RT_SCOPE_UNIVERSE;
> }
>
> -static inline __u8 get_rttos(struct ipcm_cookie* ipc, struct inet_sock *inet)
> -{
> - u8 dsfield = ipc->tos != -1 ? ipc->tos : READ_ONCE(inet->tos);
> -
> - return dsfield & INET_DSCP_MASK;
> -}
> -
> /* datagram.c */
> int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
> int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
> diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
> index 6d9c5c20b1c4..98b1e4a8b72e 100644
> --- a/net/ipv4/ip_sockglue.c
> +++ b/net/ipv4/ip_sockglue.c
> @@ -314,8 +314,8 @@ int ip_cmsg_send(struct sock *sk, struct msghdr *msg, struct ipcm_cookie *ipc,
> return -EINVAL;
> if (val < 0 || val > 255)
> return -EINVAL;
> - ipc->tos = val;
> - ipc->sockc.priority = rt_tos2priority(ipc->tos);
> + ipc->sockc.priority = rt_tos2priority(val);
> + ipc->tos = val & INET_DSCP_MASK;
> break;
> case IP_PROTOCOL:
> if (cmsg->cmsg_len != CMSG_LEN(sizeof(int)))
> diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
> index 619ddc087957..0215885c6df5 100644
> --- a/net/ipv4/ping.c
> +++ b/net/ipv4/ping.c
> @@ -768,7 +768,6 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
> }
> faddr = ipc.opt->opt.faddr;
> }
> - tos = get_rttos(&ipc, inet);
Here and elsewhere, subsequent code needs to use ipc.tos directly.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next 5/7] icmp: reflect tos through ip cookie rather than updating inet_sk
2025-02-06 19:34 ` [PATCH net-next 5/7] icmp: reflect tos through ip cookie rather than updating inet_sk Willem de Bruijn
@ 2025-02-07 1:01 ` Willem de Bruijn
2025-02-08 10:40 ` kernel test robot
1 sibling, 0 replies; 13+ messages in thread
From: Willem de Bruijn @ 2025-02-07 1:01 UTC (permalink / raw)
To: Willem de Bruijn, netdev; +Cc: davem, kuba, edumazet, pabeni, Willem de Bruijn
Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
>
> Do not modify socket fields if it can be avoided.
>
> The current code predates the introduction of ip cookies in commit
> aa6615814533 ("ipv4: processing ancillary IP_TOS or IP_TTL"). Now that
> cookies exist and support tos, update that field directly.
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
>
> ---
>
> Tested with ping -Q 32 127.0.0.1 and tcpdump
>
> The existing logic works because inet->tos is read if ipc.tos (and
> with that cork->tos) is left unitialized:
>
> iph->tos = (cork->tos != -1) ? cork->tos : READ_ONCE(inet->tos);
> ---
> net/ipv4/icmp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
> index 094084b61bff..9c5e052a7802 100644
> --- a/net/ipv4/icmp.c
> +++ b/net/ipv4/icmp.c
> @@ -429,7 +429,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
> icmp_param->data.icmph.checksum = 0;
>
> ipcm_init(&ipc);
> - inet->tos = ip_hdr(skb)->tos;
> + ipc.tos = ip_hdr(skb)->tos;
> ipc.sockc.mark = mark;
> daddr = ipc.addr = ip_hdr(skb)->saddr;
> saddr = fib_compute_spec_dst(skb);
local variable inet is no longer used, needs to be removed.
Will fix in v2.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next 4/7] ipv4: remove get_rttos
2025-02-07 0:59 ` Willem de Bruijn
@ 2025-02-07 17:33 ` Willem de Bruijn
0 siblings, 0 replies; 13+ messages in thread
From: Willem de Bruijn @ 2025-02-07 17:33 UTC (permalink / raw)
To: Willem de Bruijn, Willem de Bruijn, netdev
Cc: davem, kuba, edumazet, pabeni, Willem de Bruijn
Willem de Bruijn wrote:
> Willem de Bruijn wrote:
> > From: Willem de Bruijn <willemb@google.com>
> >
> > Initialize the ip cookie tos field when initializing the cookie, in
> > ipcm_init_sk.
> >
> > The existing code inverts the standard pattern for initializing cookie
> > fields. Default is to initialize the field from the sk, then possibly
> > overwrite that when parsing cmsgs (the unlikely case).
> >
> > This field inverts that, setting the field to an illegal value and
> > after cmsg parsing checking whether the value is still illegal and
> > thus should be overridden.
> >
> > Be careful to always apply mask INET_DSCP_MASK, as before.
> >
> > Signed-off-by: Willem de Bruijn <willemb@google.com>
> > ---
> > include/net/ip.h | 11 +++--------
> > net/ipv4/ip_sockglue.c | 4 ++--
> > net/ipv4/ping.c | 1 -
> > net/ipv4/raw.c | 1 -
> > net/ipv4/udp.c | 1 -
> > 5 files changed, 5 insertions(+), 13 deletions(-)
> >
> > diff --git a/include/net/ip.h b/include/net/ip.h
> > index 6af16545b3e3..6819704e2642 100644
> > --- a/include/net/ip.h
> > +++ b/include/net/ip.h
> > @@ -92,7 +92,9 @@ static inline void ipcm_init(struct ipcm_cookie *ipcm)
> > static inline void ipcm_init_sk(struct ipcm_cookie *ipcm,
> > const struct inet_sock *inet)
> > {
> > - ipcm_init(ipcm);
> > + *ipcm = (struct ipcm_cookie) {
> > + .tos = READ_ONCE(inet->tos) & INET_DSCP_MASK,
> > + };
> >
> > sockcm_init(&ipcm->sockc, &inet->sk);
> >
> > @@ -256,13 +258,6 @@ static inline u8 ip_sendmsg_scope(const struct inet_sock *inet,
> > return RT_SCOPE_UNIVERSE;
> > }
> >
> > -static inline __u8 get_rttos(struct ipcm_cookie* ipc, struct inet_sock *inet)
> > -{
> > - u8 dsfield = ipc->tos != -1 ? ipc->tos : READ_ONCE(inet->tos);
> > -
> > - return dsfield & INET_DSCP_MASK;
> > -}
> > -
> > /* datagram.c */
> > int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
> > int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
> > diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
> > index 6d9c5c20b1c4..98b1e4a8b72e 100644
> > --- a/net/ipv4/ip_sockglue.c
> > +++ b/net/ipv4/ip_sockglue.c
> > @@ -314,8 +314,8 @@ int ip_cmsg_send(struct sock *sk, struct msghdr *msg, struct ipcm_cookie *ipc,
> > return -EINVAL;
> > if (val < 0 || val > 255)
> > return -EINVAL;
> > - ipc->tos = val;
> > - ipc->sockc.priority = rt_tos2priority(ipc->tos);
> > + ipc->sockc.priority = rt_tos2priority(val);
> > + ipc->tos = val & INET_DSCP_MASK;
> > break;
> > case IP_PROTOCOL:
> > if (cmsg->cmsg_len != CMSG_LEN(sizeof(int)))
> > diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
> > index 619ddc087957..0215885c6df5 100644
> > --- a/net/ipv4/ping.c
> > +++ b/net/ipv4/ping.c
> > @@ -768,7 +768,6 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
> > }
> > faddr = ipc.opt->opt.faddr;
> > }
> > - tos = get_rttos(&ipc, inet);
>
> Here and elsewhere, subsequent code needs to use ipc.tos directly.
Actually I misunderstood the purpose of get_rttos.
It only masks the dsfield when passed to the routing layer, with
flowi4_init_output().
The other purpose of ipc->tos, to initialize iph->tos, takes the
unmasked version including ECN bits.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next 4/7] ipv4: remove get_rttos
2025-02-06 19:34 ` [PATCH net-next 4/7] ipv4: remove get_rttos Willem de Bruijn
2025-02-07 0:59 ` Willem de Bruijn
@ 2025-02-08 9:24 ` kernel test robot
1 sibling, 0 replies; 13+ messages in thread
From: kernel test robot @ 2025-02-08 9:24 UTC (permalink / raw)
To: Willem de Bruijn, netdev
Cc: llvm, oe-kbuild-all, davem, kuba, edumazet, pabeni,
Willem de Bruijn
Hi Willem,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Willem-de-Bruijn/tcp-only-initialize-sockcm-tsflags-field/20250207-033912
base: net-next/main
patch link: https://lore.kernel.org/r/20250206193521.2285488-5-willemdebruijn.kernel%40gmail.com
patch subject: [PATCH net-next 4/7] ipv4: remove get_rttos
config: x86_64-buildonly-randconfig-002-20250207 (https://download.01.org/0day-ci/archive/20250208/202502081713.QmBbIMec-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250208/202502081713.QmBbIMec-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502081713.QmBbIMec-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> net/ipv4/raw.c:608:52: warning: variable 'tos' is uninitialized when used here [-Wuninitialized]
608 | flowi4_init_output(&fl4, ipc.oif, ipc.sockc.mark, tos, scope,
| ^~~
net/ipv4/raw.c:489:8: note: initialize the variable 'tos' to silence this warning
489 | u8 tos, scope;
| ^
| = '\0'
1 warning generated.
--
>> net/ipv4/udp.c:1444:52: warning: variable 'tos' is uninitialized when used here [-Wuninitialized]
1444 | flowi4_init_output(fl4, ipc.oif, ipc.sockc.mark, tos, scope,
| ^~~
net/ipv4/udp.c:1284:8: note: initialize the variable 'tos' to silence this warning
1284 | u8 tos, scope;
| ^
| = '\0'
net/ipv4/udp.c:3883:27: warning: bitwise operation between different enumeration types ('enum bpf_reg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
3883 | PTR_TO_BTF_ID_OR_NULL | PTR_TRUSTED },
| ~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~
2 warnings generated.
--
>> net/ipv4/ping.c:781:52: warning: variable 'tos' is uninitialized when used here [-Wuninitialized]
781 | flowi4_init_output(&fl4, ipc.oif, ipc.sockc.mark, tos, scope,
| ^~~
net/ipv4/ping.c:708:8: note: initialize the variable 'tos' to silence this warning
708 | u8 tos, scope;
| ^
| = '\0'
1 warning generated.
vim +/tos +608 net/ipv4/raw.c
c008ba5bdc9fa8 Herbert Xu 2014-11-07 481
1b784140474e4f Ying Xue 2015-03-02 482 static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
^1da177e4c3f41 Linus Torvalds 2005-04-16 483 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 484 struct inet_sock *inet = inet_sk(sk);
bb191c3e874650 David Ahern 2015-10-05 485 struct net *net = sock_net(sk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 486 struct ipcm_cookie ipc;
^1da177e4c3f41 Linus Torvalds 2005-04-16 487 struct rtable *rt = NULL;
77968b78242ee2 David S. Miller 2011-05-08 488 struct flowi4 fl4;
c85be08fc4fa44 Guillaume Nault 2023-05-22 489 u8 tos, scope;
^1da177e4c3f41 Linus Torvalds 2005-04-16 490 int free = 0;
3ca3c68e76686b Al Viro 2006-09-27 491 __be32 daddr;
c1d18f9fa09489 Al Viro 2006-09-27 492 __be32 saddr;
959d5c11601b2b Eric Dumazet 2023-09-22 493 int uc_index, err;
f6d8bd051c391c Eric Dumazet 2011-04-21 494 struct ip_options_data opt_copy;
c008ba5bdc9fa8 Herbert Xu 2014-11-07 495 struct raw_frag_vec rfv;
8f659a03a0ba92 Mohamed Ghannam 2017-12-10 496 int hdrincl;
^1da177e4c3f41 Linus Torvalds 2005-04-16 497
^1da177e4c3f41 Linus Torvalds 2005-04-16 498 err = -EMSGSIZE;
926d4b8122fb32 Jesper Juhl 2005-06-18 499 if (len > 0xFFFF)
^1da177e4c3f41 Linus Torvalds 2005-04-16 500 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 501
cafbe182a467bf Eric Dumazet 2023-08-16 502 hdrincl = inet_test_bit(HDRINCL, sk);
cafbe182a467bf Eric Dumazet 2023-08-16 503
^1da177e4c3f41 Linus Torvalds 2005-04-16 504 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 505 * Check the flags.
^1da177e4c3f41 Linus Torvalds 2005-04-16 506 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 507
^1da177e4c3f41 Linus Torvalds 2005-04-16 508 err = -EOPNOTSUPP;
^1da177e4c3f41 Linus Torvalds 2005-04-16 509 if (msg->msg_flags & MSG_OOB) /* Mirror BSD error message */
^1da177e4c3f41 Linus Torvalds 2005-04-16 510 goto out; /* compatibility */
^1da177e4c3f41 Linus Torvalds 2005-04-16 511
^1da177e4c3f41 Linus Torvalds 2005-04-16 512 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 513 * Get and verify the address.
^1da177e4c3f41 Linus Torvalds 2005-04-16 514 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 515
^1da177e4c3f41 Linus Torvalds 2005-04-16 516 if (msg->msg_namelen) {
342dfc306fb321 Steffen Hurrle 2014-01-17 517 DECLARE_SOCKADDR(struct sockaddr_in *, usin, msg->msg_name);
^1da177e4c3f41 Linus Torvalds 2005-04-16 518 err = -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 519 if (msg->msg_namelen < sizeof(*usin))
^1da177e4c3f41 Linus Torvalds 2005-04-16 520 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 521 if (usin->sin_family != AF_INET) {
058bd4d2a4ff0a Joe Perches 2012-03-11 522 pr_info_once("%s: %s forgot to set AF_INET. Fix it!\n",
058bd4d2a4ff0a Joe Perches 2012-03-11 523 __func__, current->comm);
^1da177e4c3f41 Linus Torvalds 2005-04-16 524 err = -EAFNOSUPPORT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 525 if (usin->sin_family)
^1da177e4c3f41 Linus Torvalds 2005-04-16 526 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 527 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 528 daddr = usin->sin_addr.s_addr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 529 /* ANK: I did not forget to get protocol from port field.
^1da177e4c3f41 Linus Torvalds 2005-04-16 530 * I just do not know, who uses this weirdness.
^1da177e4c3f41 Linus Torvalds 2005-04-16 531 * IP_HDRINCL is much more convenient.
^1da177e4c3f41 Linus Torvalds 2005-04-16 532 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 533 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 534 err = -EDESTADDRREQ;
^1da177e4c3f41 Linus Torvalds 2005-04-16 535 if (sk->sk_state != TCP_ESTABLISHED)
^1da177e4c3f41 Linus Torvalds 2005-04-16 536 goto out;
c720c7e8383aff Eric Dumazet 2009-10-15 537 daddr = inet->inet_daddr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 538 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 539
351782067b6be8 Willem de Bruijn 2018-07-06 540 ipcm_init_sk(&ipc, inet);
3632679d9e4f87 Nicolas Dichtel 2023-05-22 541 /* Keep backward compat */
3632679d9e4f87 Nicolas Dichtel 2023-05-22 542 if (hdrincl)
3632679d9e4f87 Nicolas Dichtel 2023-05-22 543 ipc.protocol = IPPROTO_RAW;
^1da177e4c3f41 Linus Torvalds 2005-04-16 544
^1da177e4c3f41 Linus Torvalds 2005-04-16 545 if (msg->msg_controllen) {
24025c465f77c3 Soheil Hassas Yeganeh 2016-04-02 546 err = ip_cmsg_send(sk, msg, &ipc, false);
919483096bfe75 Eric Dumazet 2016-02-04 547 if (unlikely(err)) {
919483096bfe75 Eric Dumazet 2016-02-04 548 kfree(ipc.opt);
^1da177e4c3f41 Linus Torvalds 2005-04-16 549 goto out;
919483096bfe75 Eric Dumazet 2016-02-04 550 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 551 if (ipc.opt)
^1da177e4c3f41 Linus Torvalds 2005-04-16 552 free = 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 553 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 554
^1da177e4c3f41 Linus Torvalds 2005-04-16 555 saddr = ipc.addr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 556 ipc.addr = daddr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 557
f6d8bd051c391c Eric Dumazet 2011-04-21 558 if (!ipc.opt) {
f6d8bd051c391c Eric Dumazet 2011-04-21 559 struct ip_options_rcu *inet_opt;
f6d8bd051c391c Eric Dumazet 2011-04-21 560
f6d8bd051c391c Eric Dumazet 2011-04-21 561 rcu_read_lock();
f6d8bd051c391c Eric Dumazet 2011-04-21 562 inet_opt = rcu_dereference(inet->inet_opt);
f6d8bd051c391c Eric Dumazet 2011-04-21 563 if (inet_opt) {
f6d8bd051c391c Eric Dumazet 2011-04-21 564 memcpy(&opt_copy, inet_opt,
f6d8bd051c391c Eric Dumazet 2011-04-21 565 sizeof(*inet_opt) + inet_opt->opt.optlen);
f6d8bd051c391c Eric Dumazet 2011-04-21 566 ipc.opt = &opt_copy.opt;
f6d8bd051c391c Eric Dumazet 2011-04-21 567 }
f6d8bd051c391c Eric Dumazet 2011-04-21 568 rcu_read_unlock();
f6d8bd051c391c Eric Dumazet 2011-04-21 569 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 570
^1da177e4c3f41 Linus Torvalds 2005-04-16 571 if (ipc.opt) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 572 err = -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 573 /* Linux does not mangle headers on raw sockets,
^1da177e4c3f41 Linus Torvalds 2005-04-16 574 * so that IP options + IP_HDRINCL is non-sense.
^1da177e4c3f41 Linus Torvalds 2005-04-16 575 */
8f659a03a0ba92 Mohamed Ghannam 2017-12-10 576 if (hdrincl)
^1da177e4c3f41 Linus Torvalds 2005-04-16 577 goto done;
f6d8bd051c391c Eric Dumazet 2011-04-21 578 if (ipc.opt->opt.srr) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 579 if (!daddr)
^1da177e4c3f41 Linus Torvalds 2005-04-16 580 goto done;
f6d8bd051c391c Eric Dumazet 2011-04-21 581 daddr = ipc.opt->opt.faddr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 582 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 583 }
c85be08fc4fa44 Guillaume Nault 2023-05-22 584 scope = ip_sendmsg_scope(inet, &ipc, msg);
^1da177e4c3f41 Linus Torvalds 2005-04-16 585
959d5c11601b2b Eric Dumazet 2023-09-22 586 uc_index = READ_ONCE(inet->uc_index);
f97c1e0c6ebdb6 Joe Perches 2007-12-16 587 if (ipv4_is_multicast(daddr)) {
854da991733d1b Robert Shearman 2018-10-01 588 if (!ipc.oif || netif_index_is_l3_master(sock_net(sk), ipc.oif))
02715925222c13 Eric Dumazet 2023-09-22 589 ipc.oif = READ_ONCE(inet->mc_index);
^1da177e4c3f41 Linus Torvalds 2005-04-16 590 if (!saddr)
02715925222c13 Eric Dumazet 2023-09-22 591 saddr = READ_ONCE(inet->mc_addr);
9515a2e082f914 David Ahern 2018-01-24 592 } else if (!ipc.oif) {
959d5c11601b2b Eric Dumazet 2023-09-22 593 ipc.oif = uc_index;
959d5c11601b2b Eric Dumazet 2023-09-22 594 } else if (ipv4_is_lbcast(daddr) && uc_index) {
645f08975f4944 Miaohe Lin 2020-08-27 595 /* oif is set, packet is to local broadcast
9515a2e082f914 David Ahern 2018-01-24 596 * and uc_index is set. oif is most likely set
9515a2e082f914 David Ahern 2018-01-24 597 * by sk_bound_dev_if. If uc_index != oif check if the
9515a2e082f914 David Ahern 2018-01-24 598 * oif is an L3 master and uc_index is an L3 slave.
9515a2e082f914 David Ahern 2018-01-24 599 * If so, we want to allow the send using the uc_index.
9515a2e082f914 David Ahern 2018-01-24 600 */
959d5c11601b2b Eric Dumazet 2023-09-22 601 if (ipc.oif != uc_index &&
9515a2e082f914 David Ahern 2018-01-24 602 ipc.oif == l3mdev_master_ifindex_by_index(sock_net(sk),
959d5c11601b2b Eric Dumazet 2023-09-22 603 uc_index)) {
959d5c11601b2b Eric Dumazet 2023-09-22 604 ipc.oif = uc_index;
9515a2e082f914 David Ahern 2018-01-24 605 }
9515a2e082f914 David Ahern 2018-01-24 606 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 607
c85be08fc4fa44 Guillaume Nault 2023-05-22 @608 flowi4_init_output(&fl4, ipc.oif, ipc.sockc.mark, tos, scope,
3632679d9e4f87 Nicolas Dichtel 2023-05-22 609 hdrincl ? ipc.protocol : sk->sk_protocol,
0e0d44ab427554 Steffen Klassert 2013-08-28 610 inet_sk_flowi_flags(sk) |
8f659a03a0ba92 Mohamed Ghannam 2017-12-10 611 (hdrincl ? FLOWI_FLAG_KNOWN_NH : 0),
e2d118a1cb5e60 Lorenzo Colitti 2016-11-04 612 daddr, saddr, 0, 0, sk->sk_uid);
ef164ae3563bf4 David S. Miller 2011-03-31 613
fc1092f5156727 Shigeru Yoshida 2024-04-30 614 fl4.fl4_icmp_type = 0;
fc1092f5156727 Shigeru Yoshida 2024-04-30 615 fl4.fl4_icmp_code = 0;
fc1092f5156727 Shigeru Yoshida 2024-04-30 616
8f659a03a0ba92 Mohamed Ghannam 2017-12-10 617 if (!hdrincl) {
b61e9dcc5e77d5 Al Viro 2014-11-24 618 rfv.msg = msg;
c008ba5bdc9fa8 Herbert Xu 2014-11-07 619 rfv.hlen = 0;
c008ba5bdc9fa8 Herbert Xu 2014-11-07 620
c008ba5bdc9fa8 Herbert Xu 2014-11-07 621 err = raw_probe_proto_opt(&rfv, &fl4);
a27b58fed90cc5 Heiko Carstens 2006-10-30 622 if (err)
a27b58fed90cc5 Heiko Carstens 2006-10-30 623 goto done;
a27b58fed90cc5 Heiko Carstens 2006-10-30 624 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 625
3df98d79215ace Paul Moore 2020-09-27 626 security_sk_classify_flow(sk, flowi4_to_flowi_common(&fl4));
bb191c3e874650 David Ahern 2015-10-05 627 rt = ip_route_output_flow(net, &fl4, sk);
b23dd4fe42b455 David S. Miller 2011-03-02 628 if (IS_ERR(rt)) {
b23dd4fe42b455 David S. Miller 2011-03-02 629 err = PTR_ERR(rt);
4910ac6c526d28 David S. Miller 2011-03-28 630 rt = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 631 goto done;
b23dd4fe42b455 David S. Miller 2011-03-02 632 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 633
^1da177e4c3f41 Linus Torvalds 2005-04-16 634 err = -EACCES;
^1da177e4c3f41 Linus Torvalds 2005-04-16 635 if (rt->rt_flags & RTCF_BROADCAST && !sock_flag(sk, SOCK_BROADCAST))
^1da177e4c3f41 Linus Torvalds 2005-04-16 636 goto done;
^1da177e4c3f41 Linus Torvalds 2005-04-16 637
^1da177e4c3f41 Linus Torvalds 2005-04-16 638 if (msg->msg_flags & MSG_CONFIRM)
^1da177e4c3f41 Linus Torvalds 2005-04-16 639 goto do_confirm;
^1da177e4c3f41 Linus Torvalds 2005-04-16 640 back_from_confirm:
^1da177e4c3f41 Linus Torvalds 2005-04-16 641
8f659a03a0ba92 Mohamed Ghannam 2017-12-10 642 if (hdrincl)
7ae9abfd9d6f32 Al Viro 2014-11-27 643 err = raw_send_hdrinc(sk, &fl4, msg, len,
c14ac9451c3483 Soheil Hassas Yeganeh 2016-04-02 644 &rt, msg->msg_flags, &ipc.sockc);
^1da177e4c3f41 Linus Torvalds 2005-04-16 645
^1da177e4c3f41 Linus Torvalds 2005-04-16 646 else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 647 if (!ipc.addr)
77968b78242ee2 David S. Miller 2011-05-08 648 ipc.addr = fl4.daddr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 649 lock_sock(sk);
c008ba5bdc9fa8 Herbert Xu 2014-11-07 650 err = ip_append_data(sk, &fl4, raw_getfrag,
c008ba5bdc9fa8 Herbert Xu 2014-11-07 651 &rfv, len, 0,
2e77d89b2fa8e3 Eric Dumazet 2008-11-24 652 &ipc, &rt, msg->msg_flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 653 if (err)
^1da177e4c3f41 Linus Torvalds 2005-04-16 654 ip_flush_pending_frames(sk);
6ce9e7b5fe3195 Eric Dumazet 2009-09-02 655 else if (!(msg->msg_flags & MSG_MORE)) {
77968b78242ee2 David S. Miller 2011-05-08 656 err = ip_push_pending_frames(sk, &fl4);
6b5f43ea08150e Eric Dumazet 2023-08-16 657 if (err == -ENOBUFS && !inet_test_bit(RECVERR, sk))
6ce9e7b5fe3195 Eric Dumazet 2009-09-02 658 err = 0;
6ce9e7b5fe3195 Eric Dumazet 2009-09-02 659 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 660 release_sock(sk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 661 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 662 done:
^1da177e4c3f41 Linus Torvalds 2005-04-16 663 if (free)
^1da177e4c3f41 Linus Torvalds 2005-04-16 664 kfree(ipc.opt);
^1da177e4c3f41 Linus Torvalds 2005-04-16 665 ip_rt_put(rt);
^1da177e4c3f41 Linus Torvalds 2005-04-16 666
5418c6926fcb0e Jesper Juhl 2005-06-18 667 out:
5418c6926fcb0e Jesper Juhl 2005-06-18 668 if (err < 0)
5418c6926fcb0e Jesper Juhl 2005-06-18 669 return err;
5418c6926fcb0e Jesper Juhl 2005-06-18 670 return len;
^1da177e4c3f41 Linus Torvalds 2005-04-16 671
^1da177e4c3f41 Linus Torvalds 2005-04-16 672 do_confirm:
0dec879f636f11 Julian Anastasov 2017-02-06 673 if (msg->msg_flags & MSG_PROBE)
0dec879f636f11 Julian Anastasov 2017-02-06 674 dst_confirm_neigh(&rt->dst, &fl4.daddr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 675 if (!(msg->msg_flags & MSG_PROBE) || len)
^1da177e4c3f41 Linus Torvalds 2005-04-16 676 goto back_from_confirm;
^1da177e4c3f41 Linus Torvalds 2005-04-16 677 err = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 678 goto done;
^1da177e4c3f41 Linus Torvalds 2005-04-16 679 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 680
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next 5/7] icmp: reflect tos through ip cookie rather than updating inet_sk
2025-02-06 19:34 ` [PATCH net-next 5/7] icmp: reflect tos through ip cookie rather than updating inet_sk Willem de Bruijn
2025-02-07 1:01 ` Willem de Bruijn
@ 2025-02-08 10:40 ` kernel test robot
1 sibling, 0 replies; 13+ messages in thread
From: kernel test robot @ 2025-02-08 10:40 UTC (permalink / raw)
To: Willem de Bruijn, netdev
Cc: llvm, oe-kbuild-all, davem, kuba, edumazet, pabeni,
Willem de Bruijn
Hi Willem,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Willem-de-Bruijn/tcp-only-initialize-sockcm-tsflags-field/20250207-033912
base: net-next/main
patch link: https://lore.kernel.org/r/20250206193521.2285488-6-willemdebruijn.kernel%40gmail.com
patch subject: [PATCH net-next 5/7] icmp: reflect tos through ip cookie rather than updating inet_sk
config: x86_64-buildonly-randconfig-002-20250207 (https://download.01.org/0day-ci/archive/20250208/202502081845.hsTDUryC-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250208/202502081845.hsTDUryC-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502081845.hsTDUryC-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> net/ipv4/icmp.c:408:20: warning: variable 'inet' set but not used [-Wunused-but-set-variable]
408 | struct inet_sock *inet;
| ^
1 warning generated.
vim +/inet +408 net/ipv4/icmp.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 395
^1da177e4c3f41 Linus Torvalds 2005-04-16 396 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 397 * Driving logic for building and sending ICMP messages.
^1da177e4c3f41 Linus Torvalds 2005-04-16 398 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 399
^1da177e4c3f41 Linus Torvalds 2005-04-16 400 static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
^1da177e4c3f41 Linus Torvalds 2005-04-16 401 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 402 struct ipcm_cookie ipc;
511c3f92ad5b6d Eric Dumazet 2009-06-02 403 struct rtable *rt = skb_rtable(skb);
d8d1f30b95a635 Changli Gao 2010-06-10 404 struct net *net = dev_net(rt->dst.dev);
8c2bd38b95f75f Eric Dumazet 2024-08-29 405 bool apply_ratelimit = false;
77968b78242ee2 David S. Miller 2011-05-08 406 struct flowi4 fl4;
fdc0bde90a689b Denis V. Lunev 2008-08-23 407 struct sock *sk;
fdc0bde90a689b Denis V. Lunev 2008-08-23 @408 struct inet_sock *inet;
35ebf65e851c6d David S. Miller 2012-06-28 409 __be32 daddr, saddr;
e110861f86094c Lorenzo Colitti 2014-05-13 410 u32 mark = IP4_REPLY_MARK(net, skb->mark);
c0303efeab7391 Jesper Dangaard Brouer 2017-01-09 411 int type = icmp_param->data.icmph.type;
c0303efeab7391 Jesper Dangaard Brouer 2017-01-09 412 int code = icmp_param->data.icmph.code;
^1da177e4c3f41 Linus Torvalds 2005-04-16 413
91ed1e666a4ea2 Paolo Abeni 2017-08-03 414 if (ip_options_echo(net, &icmp_param->replyopts.opt.opt, skb))
f00c401b9b5f0a Horms 2006-02-02 415 return;
^1da177e4c3f41 Linus Torvalds 2005-04-16 416
8c2bd38b95f75f Eric Dumazet 2024-08-29 417 /* Needed by both icmpv4_global_allow and icmp_xmit_lock */
7ba91ecb16824f Jesper Dangaard Brouer 2017-01-09 418 local_bh_disable();
^1da177e4c3f41 Linus Torvalds 2005-04-16 419
8c2bd38b95f75f Eric Dumazet 2024-08-29 420 /* is global icmp_msgs_per_sec exhausted ? */
8c2bd38b95f75f Eric Dumazet 2024-08-29 421 if (!icmpv4_global_allow(net, type, code, &apply_ratelimit))
7ba91ecb16824f Jesper Dangaard Brouer 2017-01-09 422 goto out_bh_enable;
7ba91ecb16824f Jesper Dangaard Brouer 2017-01-09 423
7ba91ecb16824f Jesper Dangaard Brouer 2017-01-09 424 sk = icmp_xmit_lock(net);
7ba91ecb16824f Jesper Dangaard Brouer 2017-01-09 425 if (!sk)
7ba91ecb16824f Jesper Dangaard Brouer 2017-01-09 426 goto out_bh_enable;
7ba91ecb16824f Jesper Dangaard Brouer 2017-01-09 427 inet = inet_sk(sk);
c0303efeab7391 Jesper Dangaard Brouer 2017-01-09 428
^1da177e4c3f41 Linus Torvalds 2005-04-16 429 icmp_param->data.icmph.checksum = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 430
351782067b6be8 Willem de Bruijn 2018-07-06 431 ipcm_init(&ipc);
bbd17d3104f5a7 Willem de Bruijn 2025-02-06 432 ipc.tos = ip_hdr(skb)->tos;
0da7536fb47f51 Willem de Bruijn 2020-07-01 433 ipc.sockc.mark = mark;
9f6abb5f175bdb David S. Miller 2011-05-09 434 daddr = ipc.addr = ip_hdr(skb)->saddr;
35ebf65e851c6d David S. Miller 2012-06-28 435 saddr = fib_compute_spec_dst(skb);
aa6615814533c6 Francesco Fusco 2013-09-24 436
f6d8bd051c391c Eric Dumazet 2011-04-21 437 if (icmp_param->replyopts.opt.opt.optlen) {
f6d8bd051c391c Eric Dumazet 2011-04-21 438 ipc.opt = &icmp_param->replyopts.opt;
f6d8bd051c391c Eric Dumazet 2011-04-21 439 if (ipc.opt->opt.srr)
f6d8bd051c391c Eric Dumazet 2011-04-21 440 daddr = icmp_param->replyopts.opt.opt.faddr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 441 }
77968b78242ee2 David S. Miller 2011-05-08 442 memset(&fl4, 0, sizeof(fl4));
77968b78242ee2 David S. Miller 2011-05-08 443 fl4.daddr = daddr;
35ebf65e851c6d David S. Miller 2012-06-28 444 fl4.saddr = saddr;
e110861f86094c Lorenzo Colitti 2014-05-13 445 fl4.flowi4_mark = mark;
e2d118a1cb5e60 Lorenzo Colitti 2016-11-04 446 fl4.flowi4_uid = sock_net_uid(net, NULL);
0ed373390c5c18 Guillaume Nault 2024-10-22 447 fl4.flowi4_tos = inet_dscp_to_dsfield(ip4h_dscp(ip_hdr(skb)));
77968b78242ee2 David S. Miller 2011-05-08 448 fl4.flowi4_proto = IPPROTO_ICMP;
385add906b6155 David Ahern 2015-09-29 449 fl4.flowi4_oif = l3mdev_master_ifindex(skb->dev);
3df98d79215ace Paul Moore 2020-09-27 450 security_skb_classify_flow(skb, flowi4_to_flowi_common(&fl4));
9d6ec938019c6b David S. Miller 2011-03-12 451 rt = ip_route_output_key(net, &fl4);
b23dd4fe42b455 David S. Miller 2011-03-02 452 if (IS_ERR(rt))
^1da177e4c3f41 Linus Torvalds 2005-04-16 453 goto out_unlock;
8c2bd38b95f75f Eric Dumazet 2024-08-29 454 if (icmpv4_xrlim_allow(net, rt, &fl4, type, code, apply_ratelimit))
a15c89c703d434 Eric Dumazet 2022-01-24 455 icmp_push_reply(sk, icmp_param, &fl4, &ipc, &rt);
^1da177e4c3f41 Linus Torvalds 2005-04-16 456 ip_rt_put(rt);
^1da177e4c3f41 Linus Torvalds 2005-04-16 457 out_unlock:
405666db84b984 Denis V. Lunev 2008-02-29 458 icmp_xmit_unlock(sk);
7ba91ecb16824f Jesper Dangaard Brouer 2017-01-09 459 out_bh_enable:
7ba91ecb16824f Jesper Dangaard Brouer 2017-01-09 460 local_bh_enable();
^1da177e4c3f41 Linus Torvalds 2005-04-16 461 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 462
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-02-08 10:41 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-06 19:34 [PATCH net-next 0/7] net: deduplicate cookie logic Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 1/7] tcp: only initialize sockcm tsflags field Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 2/7] net: initialize mark in sockcm_init Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 3/7] ipv4: initialize inet socket cookies with sockcm_init Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 4/7] ipv4: remove get_rttos Willem de Bruijn
2025-02-07 0:59 ` Willem de Bruijn
2025-02-07 17:33 ` Willem de Bruijn
2025-02-08 9:24 ` kernel test robot
2025-02-06 19:34 ` [PATCH net-next 5/7] icmp: reflect tos through ip cookie rather than updating inet_sk Willem de Bruijn
2025-02-07 1:01 ` Willem de Bruijn
2025-02-08 10:40 ` kernel test robot
2025-02-06 19:34 ` [PATCH net-next 6/7] ipv6: replace ipcm6_init calls with ipcm6_init_sk Willem de Bruijn
2025-02-06 19:34 ` [PATCH net-next 7/7] ipv6: initialize inet socket cookies with sockcm_init Willem de Bruijn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).