mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 07:31:41 +00:00
ipv6: make fragment identifications less predictable
IPv6 fragment identification generation is way beyond what we use for IPv4 : It uses a single generator. Its not scalable and allows DOS attacks. Now inetpeer is IPv6 aware, we can use it to provide a more secure and scalable frag ident generator (per destination, instead of system wide) This patch : 1) defines a new secure_ipv6_id() helper 2) extends inet_getid() to provide 32bit results 3) extends ipv6_select_ident() with a new dest parameter Reported-by: Fernando Gont <fernando@gont.com.ar> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
21efcfa0ff
commit
87c48fa3b4
7 changed files with 64 additions and 22 deletions
|
@ -391,7 +391,7 @@ static int inet_peer_gc(struct inet_peer_base *base,
|
|||
return cnt;
|
||||
}
|
||||
|
||||
struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
|
||||
struct inet_peer *inet_getpeer(const struct inetpeer_addr *daddr, int create)
|
||||
{
|
||||
struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr;
|
||||
struct inet_peer_base *base = family_to_base(daddr->family);
|
||||
|
@ -436,7 +436,10 @@ relookup:
|
|||
p->daddr = *daddr;
|
||||
atomic_set(&p->refcnt, 1);
|
||||
atomic_set(&p->rid, 0);
|
||||
atomic_set(&p->ip_id_count, secure_ip_id(daddr->addr.a4));
|
||||
atomic_set(&p->ip_id_count,
|
||||
(daddr->family == AF_INET) ?
|
||||
secure_ip_id(daddr->addr.a4) :
|
||||
secure_ipv6_id(daddr->addr.a6));
|
||||
p->tcp_ts_stamp = 0;
|
||||
p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW;
|
||||
p->rate_tokens = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue