mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
inetpeer: remove create argument of inet_getpeer_v[46]()
All callers of inet_getpeer_v4() and inet_getpeer_v6() want to create an inetpeer. Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20241215175629.1248773-2-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
bf8469fc4d
commit
661cd8fc8e
@ -101,25 +101,24 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base,
|
|||||||
|
|
||||||
static inline struct inet_peer *inet_getpeer_v4(struct inet_peer_base *base,
|
static inline struct inet_peer *inet_getpeer_v4(struct inet_peer_base *base,
|
||||||
__be32 v4daddr,
|
__be32 v4daddr,
|
||||||
int vif, int create)
|
int vif)
|
||||||
{
|
{
|
||||||
struct inetpeer_addr daddr;
|
struct inetpeer_addr daddr;
|
||||||
|
|
||||||
daddr.a4.addr = v4daddr;
|
daddr.a4.addr = v4daddr;
|
||||||
daddr.a4.vif = vif;
|
daddr.a4.vif = vif;
|
||||||
daddr.family = AF_INET;
|
daddr.family = AF_INET;
|
||||||
return inet_getpeer(base, &daddr, create);
|
return inet_getpeer(base, &daddr, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base,
|
static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base,
|
||||||
const struct in6_addr *v6daddr,
|
const struct in6_addr *v6daddr)
|
||||||
int create)
|
|
||||||
{
|
{
|
||||||
struct inetpeer_addr daddr;
|
struct inetpeer_addr daddr;
|
||||||
|
|
||||||
daddr.a6 = *v6daddr;
|
daddr.a6 = *v6daddr;
|
||||||
daddr.family = AF_INET6;
|
daddr.family = AF_INET6;
|
||||||
return inet_getpeer(base, &daddr, create);
|
return inet_getpeer(base, &daddr, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int inetpeer_addr_cmp(const struct inetpeer_addr *a,
|
static inline int inetpeer_addr_cmp(const struct inetpeer_addr *a,
|
||||||
|
@ -322,7 +322,7 @@ static bool icmpv4_xrlim_allow(struct net *net, struct rtable *rt,
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
vif = l3mdev_master_ifindex(dst->dev);
|
vif = l3mdev_master_ifindex(dst->dev);
|
||||||
peer = inet_getpeer_v4(net->ipv4.peers, fl4->daddr, vif, 1);
|
peer = inet_getpeer_v4(net->ipv4.peers, fl4->daddr, vif);
|
||||||
rc = inet_peer_xrlim_allow(peer,
|
rc = inet_peer_xrlim_allow(peer,
|
||||||
READ_ONCE(net->ipv4.sysctl_icmp_ratelimit));
|
READ_ONCE(net->ipv4.sysctl_icmp_ratelimit));
|
||||||
if (peer)
|
if (peer)
|
||||||
|
@ -89,7 +89,7 @@ static void ip4_frag_init(struct inet_frag_queue *q, const void *a)
|
|||||||
q->key.v4 = *key;
|
q->key.v4 = *key;
|
||||||
qp->ecn = 0;
|
qp->ecn = 0;
|
||||||
qp->peer = q->fqdir->max_dist ?
|
qp->peer = q->fqdir->max_dist ?
|
||||||
inet_getpeer_v4(net->ipv4.peers, key->saddr, key->vif, 1) :
|
inet_getpeer_v4(net->ipv4.peers, key->saddr, key->vif) :
|
||||||
NULL;
|
NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,7 +873,7 @@ void ip_rt_send_redirect(struct sk_buff *skb)
|
|||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
net = dev_net(rt->dst.dev);
|
net = dev_net(rt->dst.dev);
|
||||||
peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, vif, 1);
|
peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, vif);
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST,
|
icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST,
|
||||||
rt_nexthop(rt, ip_hdr(skb)->daddr));
|
rt_nexthop(rt, ip_hdr(skb)->daddr));
|
||||||
@ -976,7 +976,7 @@ static int ip_error(struct sk_buff *skb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr,
|
peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr,
|
||||||
l3mdev_master_ifindex(skb->dev), 1);
|
l3mdev_master_ifindex(skb->dev));
|
||||||
|
|
||||||
send = true;
|
send = true;
|
||||||
if (peer) {
|
if (peer) {
|
||||||
|
@ -222,7 +222,7 @@ static bool icmpv6_xrlim_allow(struct sock *sk, u8 type,
|
|||||||
if (rt->rt6i_dst.plen < 128)
|
if (rt->rt6i_dst.plen < 128)
|
||||||
tmo >>= ((128 - rt->rt6i_dst.plen)>>5);
|
tmo >>= ((128 - rt->rt6i_dst.plen)>>5);
|
||||||
|
|
||||||
peer = inet_getpeer_v6(net->ipv6.peers, &fl6->daddr, 1);
|
peer = inet_getpeer_v6(net->ipv6.peers, &fl6->daddr);
|
||||||
res = inet_peer_xrlim_allow(peer, tmo);
|
res = inet_peer_xrlim_allow(peer, tmo);
|
||||||
if (peer)
|
if (peer)
|
||||||
inet_putpeer(peer);
|
inet_putpeer(peer);
|
||||||
|
@ -613,7 +613,7 @@ int ip6_forward(struct sk_buff *skb)
|
|||||||
else
|
else
|
||||||
target = &hdr->daddr;
|
target = &hdr->daddr;
|
||||||
|
|
||||||
peer = inet_getpeer_v6(net->ipv6.peers, &hdr->daddr, 1);
|
peer = inet_getpeer_v6(net->ipv6.peers, &hdr->daddr);
|
||||||
|
|
||||||
/* Limit redirects both by destination (here)
|
/* Limit redirects both by destination (here)
|
||||||
and by source (inside ndisc_send_redirect)
|
and by source (inside ndisc_send_redirect)
|
||||||
|
@ -1731,7 +1731,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
|
|||||||
"Redirect: destination is not a neighbour\n");
|
"Redirect: destination is not a neighbour\n");
|
||||||
goto release;
|
goto release;
|
||||||
}
|
}
|
||||||
peer = inet_getpeer_v6(net->ipv6.peers, &ipv6_hdr(skb)->saddr, 1);
|
peer = inet_getpeer_v6(net->ipv6.peers, &ipv6_hdr(skb)->saddr);
|
||||||
ret = inet_peer_xrlim_allow(peer, 1*HZ);
|
ret = inet_peer_xrlim_allow(peer, 1*HZ);
|
||||||
if (peer)
|
if (peer)
|
||||||
inet_putpeer(peer);
|
inet_putpeer(peer);
|
||||||
|
Loading…
Reference in New Issue
Block a user