.. | .. |
---|
444 | 444 | score = compute_score(sk, net, saddr, sport, |
---|
445 | 445 | daddr, hnum, dif, sdif); |
---|
446 | 446 | if (score > badness) { |
---|
447 | | - result = lookup_reuseport(net, sk, skb, |
---|
448 | | - saddr, sport, daddr, hnum); |
---|
| 447 | + badness = score; |
---|
| 448 | + result = lookup_reuseport(net, sk, skb, saddr, sport, daddr, hnum); |
---|
| 449 | + if (!result) { |
---|
| 450 | + result = sk; |
---|
| 451 | + continue; |
---|
| 452 | + } |
---|
| 453 | + |
---|
449 | 454 | /* Fall back to scoring if group has connections */ |
---|
450 | | - if (result && !reuseport_has_conns(sk)) |
---|
| 455 | + if (!reuseport_has_conns(sk)) |
---|
451 | 456 | return result; |
---|
452 | 457 | |
---|
453 | | - result = result ? : sk; |
---|
454 | | - badness = score; |
---|
| 458 | + /* Reuseport logic returned an error, keep original score. */ |
---|
| 459 | + if (IS_ERR(result)) |
---|
| 460 | + continue; |
---|
| 461 | + |
---|
| 462 | + badness = compute_score(result, net, saddr, sport, |
---|
| 463 | + daddr, hnum, dif, sdif); |
---|
| 464 | + |
---|
455 | 465 | } |
---|
456 | 466 | } |
---|
457 | 467 | return result; |
---|
.. | .. |
---|
1584 | 1594 | } |
---|
1585 | 1595 | EXPORT_SYMBOL_GPL(__udp_enqueue_schedule_skb); |
---|
1586 | 1596 | |
---|
1587 | | -void udp_destruct_sock(struct sock *sk) |
---|
| 1597 | +void udp_destruct_common(struct sock *sk) |
---|
1588 | 1598 | { |
---|
1589 | 1599 | /* reclaim completely the forward allocated memory */ |
---|
1590 | 1600 | struct udp_sock *up = udp_sk(sk); |
---|
.. | .. |
---|
1597 | 1607 | kfree_skb(skb); |
---|
1598 | 1608 | } |
---|
1599 | 1609 | udp_rmem_release(sk, total, 0, true); |
---|
| 1610 | +} |
---|
| 1611 | +EXPORT_SYMBOL_GPL(udp_destruct_common); |
---|
1600 | 1612 | |
---|
| 1613 | +static void udp_destruct_sock(struct sock *sk) |
---|
| 1614 | +{ |
---|
| 1615 | + udp_destruct_common(sk); |
---|
1601 | 1616 | inet_sock_destruct(sk); |
---|
1602 | 1617 | } |
---|
1603 | | -EXPORT_SYMBOL_GPL(udp_destruct_sock); |
---|
1604 | 1618 | |
---|
1605 | 1619 | int udp_init_sock(struct sock *sk) |
---|
1606 | 1620 | { |
---|
.. | .. |
---|
1608 | 1622 | sk->sk_destruct = udp_destruct_sock; |
---|
1609 | 1623 | return 0; |
---|
1610 | 1624 | } |
---|
1611 | | -EXPORT_SYMBOL_GPL(udp_init_sock); |
---|
1612 | 1625 | |
---|
1613 | 1626 | void skb_consume_udp(struct sock *sk, struct sk_buff *skb, int len) |
---|
1614 | 1627 | { |
---|