mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 11:41:29 -04:00
bridge: Use direct pointer in br_is_nd_neigh_msg()
Both callers of br_is_nd_neigh_msg() already call pskb_may_pull() to ensure sizeof(struct ipv6hdr) + sizeof(struct nd_msg) bytes are in the linear area before invoking this function. The skb_header_pointer() call and its fallback buffer are therefore unnecessary. Replace skb_header_pointer() with a direct cast to ipv6_hdr(skb) + 1 and drop the now-unused 'msg' parameter and its corresponding stack buffer from all callers. Reviewed-by: Petr Machata <petrm@nvidia.com> Acked-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Danielle Ratson <danieller@nvidia.com> Link: https://patch.msgid.link/20260803112505.613873-2-danieller@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
b6e2649fff
commit
2cad8e3d9d
@@ -234,14 +234,9 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
struct nd_msg *br_is_nd_neigh_msg(const struct sk_buff *skb, struct nd_msg *msg)
|
||||
struct nd_msg *br_is_nd_neigh_msg(const struct sk_buff *skb)
|
||||
{
|
||||
struct nd_msg *m;
|
||||
|
||||
m = skb_header_pointer(skb, skb_network_offset(skb) +
|
||||
sizeof(struct ipv6hdr), sizeof(*msg), msg);
|
||||
if (!m)
|
||||
return NULL;
|
||||
struct nd_msg *m = (struct nd_msg *)(ipv6_hdr(skb) + 1);
|
||||
|
||||
if (m->icmph.icmp6_code != 0 ||
|
||||
(m->icmph.icmp6_type != NDISC_NEIGHBOUR_SOLICITATION &&
|
||||
|
||||
@@ -80,9 +80,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
pskb_may_pull(skb, sizeof(struct ipv6hdr) +
|
||||
sizeof(struct nd_msg)) &&
|
||||
ipv6_hdr(skb)->nexthdr == IPPROTO_ICMPV6) {
|
||||
struct nd_msg *msg, _msg;
|
||||
struct nd_msg *msg;
|
||||
|
||||
msg = br_is_nd_neigh_msg(skb, &_msg);
|
||||
msg = br_is_nd_neigh_msg(skb);
|
||||
if (msg)
|
||||
br_do_suppress_nd(skb, br, vid, NULL, msg);
|
||||
}
|
||||
|
||||
@@ -176,9 +176,9 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb
|
||||
pskb_may_pull(skb, sizeof(struct ipv6hdr) +
|
||||
sizeof(struct nd_msg)) &&
|
||||
ipv6_hdr(skb)->nexthdr == IPPROTO_ICMPV6) {
|
||||
struct nd_msg *msg, _msg;
|
||||
struct nd_msg *msg;
|
||||
|
||||
msg = br_is_nd_neigh_msg(skb, &_msg);
|
||||
msg = br_is_nd_neigh_msg(skb);
|
||||
if (msg)
|
||||
br_do_suppress_nd(skb, br, vid, p, msg);
|
||||
}
|
||||
|
||||
@@ -2367,7 +2367,7 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,
|
||||
u16 vid, struct net_bridge_port *p);
|
||||
void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br,
|
||||
u16 vid, struct net_bridge_port *p, struct nd_msg *msg);
|
||||
struct nd_msg *br_is_nd_neigh_msg(const struct sk_buff *skb, struct nd_msg *m);
|
||||
struct nd_msg *br_is_nd_neigh_msg(const struct sk_buff *skb);
|
||||
bool br_is_neigh_suppress_enabled(const struct net_bridge_port *p, u16 vid);
|
||||
bool br_is_neigh_forward_grat_enabled(const struct net_bridge_port *p, u16 vid);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user