Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
Pull networking updates from David Miller: 1) Support IPV6 RA Captive Portal Identifier, from Maciej Żenczykowski. 2) Use bio_vec in the networking instead of custom skb_frag_t, from Matthew Wilcox. 3) Make use of xmit_more in r8169 driver, from Heiner Kallweit. 4) Add devmap_hash to xdp, from Toke Høiland-Jørgensen. 5) Support all variants of 5750X bnxt_en chips, from Michael Chan. 6) More RTNL avoidance work in the core and mlx5 driver, from Vlad Buslov. 7) Add TCP syn cookies bpf helper, from Petar Penkov. 8) Add 'nettest' to selftests and use it, from David Ahern. 9) Add extack support to drop_monitor, add packet alert mode and support for HW drops, from Ido Schimmel. 10) Add VLAN offload to stmmac, from Jose Abreu. 11) Lots of devm_platform_ioremap_resource() conversions, from YueHaibing. 12) Add IONIC driver, from Shannon Nelson. 13) Several kTLS cleanups, from Jakub Kicinski. * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (1930 commits) mlxsw: spectrum_buffers: Add the ability to query the CPU port's shared buffer mlxsw: spectrum: Register CPU port with devlink mlxsw: spectrum_buffers: Prevent changing CPU port's configuration net: ena: fix incorrect update of intr_delay_resolution net: ena: fix retrieval of nonadaptive interrupt moderation intervals net: ena: fix update of interrupt moderation register net: ena: remove all old adaptive rx interrupt moderation code from ena_com net: ena: remove ena_restore_ethtool_params() and relevant fields net: ena: remove old adaptive interrupt moderation code from ena_netdev net: ena: remove code duplication in ena_com_update_nonadaptive_moderation_interval _*() net: ena: enable the interrupt_moderation in driver_supported_features net: ena: reimplement set/get_coalesce() net: ena: switch to dim algorithm for rx adaptive interrupt moderation net: ena: add intr_moder_rx_interval to struct ena_com_dev and use it net: phy: adin: implement Energy Detect Powerdown mode via phy-tunable ethtool: implement Energy Detect Powerdown support via phy-tunable xen-netfront: do not assume sk_buff_head list is empty in error handling s390/ctcm: Delete unnecessary checks before the macro call “dev_kfree_skb” net: ena: don't wake up tx queue when down drop_monitor: Better sanitize notified packets ...
This commit is contained in:
@@ -1845,13 +1845,8 @@ static __net_init int inet_init_net(struct net *net)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __net_exit void inet_exit_net(struct net *net)
|
||||
{
|
||||
}
|
||||
|
||||
static __net_initdata struct pernet_operations af_inet_ops = {
|
||||
.init = inet_init_net,
|
||||
.exit = inet_exit_net,
|
||||
};
|
||||
|
||||
static int __init init_inet_pernet_ops(void)
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <net/sock.h>
|
||||
#include <net/route.h>
|
||||
#include <net/tcp_states.h>
|
||||
#include <net/sock_reuseport.h>
|
||||
|
||||
int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
|
||||
{
|
||||
@@ -69,6 +70,7 @@ int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len
|
||||
}
|
||||
inet->inet_daddr = fl4->daddr;
|
||||
inet->inet_dport = usin->sin_port;
|
||||
reuseport_has_conns(sk, true);
|
||||
sk->sk_state = TCP_ESTABLISHED;
|
||||
sk_set_txhash(sk);
|
||||
inet->inet_id = jiffies;
|
||||
|
@@ -1266,6 +1266,7 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork,
|
||||
cork->length = 0;
|
||||
cork->ttl = ipc->ttl;
|
||||
cork->tos = ipc->tos;
|
||||
cork->mark = ipc->sockc.mark;
|
||||
cork->priority = ipc->priority;
|
||||
cork->transmit_time = ipc->sockc.transmit_time;
|
||||
cork->tx_flags = 0;
|
||||
@@ -1529,7 +1530,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
|
||||
}
|
||||
|
||||
skb->priority = (cork->tos != -1) ? cork->priority: sk->sk_priority;
|
||||
skb->mark = sk->sk_mark;
|
||||
skb->mark = cork->mark;
|
||||
skb->tstamp = cork->transmit_time;
|
||||
/*
|
||||
* Steal rt from cork.dst to avoid a pair of atomic_inc/atomic_dec
|
||||
|
@@ -1134,8 +1134,8 @@ static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi,
|
||||
|
||||
if (!found) {
|
||||
/* Create a new entry if allowable */
|
||||
if (atomic_read(&mrt->cache_resolve_queue_len) >= 10 ||
|
||||
(c = ipmr_cache_alloc_unres()) == NULL) {
|
||||
c = ipmr_cache_alloc_unres();
|
||||
if (!c) {
|
||||
spin_unlock_bh(&mfc_unres_lock);
|
||||
|
||||
kfree_skb(skb);
|
||||
|
@@ -272,7 +272,7 @@ config IP_NF_TARGET_CLUSTERIP
|
||||
The CLUSTERIP target allows you to build load-balancing clusters of
|
||||
network servers without having a dedicated load-balancing
|
||||
router/server/switch.
|
||||
|
||||
|
||||
To compile it as a module, choose M here. If unsure, say N.
|
||||
|
||||
config IP_NF_TARGET_ECN
|
||||
@@ -281,7 +281,7 @@ config IP_NF_TARGET_ECN
|
||||
depends on NETFILTER_ADVANCED
|
||||
---help---
|
||||
This option adds a `ECN' target, which can be used in the iptables mangle
|
||||
table.
|
||||
table.
|
||||
|
||||
You can use this target to remove the ECN bits from the IPv4 header of
|
||||
an IP packet. This is particularly useful, if you need to work around
|
||||
@@ -306,7 +306,7 @@ config IP_NF_RAW
|
||||
This option adds a `raw' table to iptables. This table is the very
|
||||
first in the netfilter framework and hooks in at the PREROUTING
|
||||
and OUTPUT chains.
|
||||
|
||||
|
||||
If you want to compile it as a module, say M here and read
|
||||
<file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
|
||||
|
||||
@@ -318,7 +318,7 @@ config IP_NF_SECURITY
|
||||
help
|
||||
This option adds a `security' table to iptables, for use
|
||||
with Mandatory Access Control (MAC) policy.
|
||||
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
endif # IP_NF_IPTABLES
|
||||
|
@@ -31,7 +31,7 @@ obj-$(CONFIG_NFT_DUP_IPV4) += nft_dup_ipv4.o
|
||||
# flow table support
|
||||
obj-$(CONFIG_NF_FLOW_TABLE_IPV4) += nf_flow_table_ipv4.o
|
||||
|
||||
# generic IP tables
|
||||
# generic IP tables
|
||||
obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o
|
||||
|
||||
# the three instances of ip_tables
|
||||
|
@@ -36,8 +36,8 @@ synproxy_tg4(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
opts.options |= XT_SYNPROXY_OPT_ECN;
|
||||
|
||||
opts.options &= info->options;
|
||||
opts.mss_encode = opts.mss;
|
||||
opts.mss = info->mss;
|
||||
opts.mss_encode = opts.mss_option;
|
||||
opts.mss_option = info->mss;
|
||||
if (opts.options & XT_SYNPROXY_OPT_TIMESTAMP)
|
||||
synproxy_init_timestamp_cookie(info, &opts);
|
||||
else
|
||||
|
@@ -1151,7 +1151,7 @@ static int nh_create_ipv4(struct net *net, struct nexthop *nh,
|
||||
.fc_encap_type = cfg->nh_encap_type,
|
||||
};
|
||||
u32 tb_id = l3mdev_fib_table(cfg->dev);
|
||||
int err = -EINVAL;
|
||||
int err;
|
||||
|
||||
err = fib_nh_init(net, fib_nh, &fib_cfg, 1, extack);
|
||||
if (err) {
|
||||
|
@@ -781,7 +781,7 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
||||
} else if (!ipc.oif)
|
||||
ipc.oif = inet->uc_index;
|
||||
|
||||
flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos,
|
||||
flowi4_init_output(&fl4, ipc.oif, ipc.sockc.mark, tos,
|
||||
RT_SCOPE_UNIVERSE, sk->sk_protocol,
|
||||
inet_sk_flowi_flags(sk), faddr, saddr, 0, 0,
|
||||
sk->sk_uid);
|
||||
|
@@ -375,7 +375,7 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
|
||||
skb_reserve(skb, hlen);
|
||||
|
||||
skb->priority = sk->sk_priority;
|
||||
skb->mark = sk->sk_mark;
|
||||
skb->mark = sockc->mark;
|
||||
skb->tstamp = sockc->transmit_time;
|
||||
skb_dst_set(skb, &rt->dst);
|
||||
*rtp = NULL;
|
||||
@@ -623,7 +623,7 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
||||
}
|
||||
}
|
||||
|
||||
flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos,
|
||||
flowi4_init_output(&fl4, ipc.oif, ipc.sockc.mark, tos,
|
||||
RT_SCOPE_UNIVERSE,
|
||||
hdrincl ? IPPROTO_RAW : sk->sk_protocol,
|
||||
inet_sk_flowi_flags(sk) |
|
||||
|
@@ -819,6 +819,15 @@ static struct ctl_table ipv4_net_table[] = {
|
||||
.extra1 = &tcp_min_snd_mss_min,
|
||||
.extra2 = &tcp_min_snd_mss_max,
|
||||
},
|
||||
{
|
||||
.procname = "tcp_mtu_probe_floor",
|
||||
.data = &init_net.ipv4.sysctl_tcp_mtu_probe_floor,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &tcp_min_snd_mss_min,
|
||||
.extra2 = &tcp_min_snd_mss_max,
|
||||
},
|
||||
{
|
||||
.procname = "tcp_probe_threshold",
|
||||
.data = &init_net.ipv4.sysctl_tcp_probe_threshold,
|
||||
|
@@ -1182,7 +1182,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
|
||||
struct sockcm_cookie sockc;
|
||||
int flags, err, copied = 0;
|
||||
int mss_now = 0, size_goal, copied_syn = 0;
|
||||
bool process_backlog = false;
|
||||
int process_backlog = 0;
|
||||
bool zc = false;
|
||||
long timeo;
|
||||
|
||||
@@ -1274,9 +1274,10 @@ new_segment:
|
||||
if (!sk_stream_memory_free(sk))
|
||||
goto wait_for_sndbuf;
|
||||
|
||||
if (process_backlog && sk_flush_backlog(sk)) {
|
||||
process_backlog = false;
|
||||
goto restart;
|
||||
if (unlikely(process_backlog >= 16)) {
|
||||
process_backlog = 0;
|
||||
if (sk_flush_backlog(sk))
|
||||
goto restart;
|
||||
}
|
||||
first_skb = tcp_rtx_and_write_queues_empty(sk);
|
||||
skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation,
|
||||
@@ -1284,7 +1285,7 @@ new_segment:
|
||||
if (!skb)
|
||||
goto wait_for_memory;
|
||||
|
||||
process_backlog = true;
|
||||
process_backlog++;
|
||||
skb->ip_summed = CHECKSUM_PARTIAL;
|
||||
|
||||
skb_entail(sk, skb);
|
||||
@@ -1789,19 +1790,21 @@ static int tcp_zerocopy_receive(struct sock *sk,
|
||||
break;
|
||||
frags = skb_shinfo(skb)->frags;
|
||||
while (offset) {
|
||||
if (frags->size > offset)
|
||||
if (skb_frag_size(frags) > offset)
|
||||
goto out;
|
||||
offset -= frags->size;
|
||||
offset -= skb_frag_size(frags);
|
||||
frags++;
|
||||
}
|
||||
}
|
||||
if (frags->size != PAGE_SIZE || frags->page_offset) {
|
||||
if (skb_frag_size(frags) != PAGE_SIZE || skb_frag_off(frags)) {
|
||||
int remaining = zc->recv_skip_hint;
|
||||
int size = skb_frag_size(frags);
|
||||
|
||||
while (remaining && (frags->size != PAGE_SIZE ||
|
||||
frags->page_offset)) {
|
||||
remaining -= frags->size;
|
||||
while (remaining && (size != PAGE_SIZE ||
|
||||
skb_frag_off(frags))) {
|
||||
remaining -= size;
|
||||
frags++;
|
||||
size = skb_frag_size(frags);
|
||||
}
|
||||
zc->recv_skip_hint -= remaining;
|
||||
break;
|
||||
@@ -2650,6 +2653,7 @@ int tcp_disconnect(struct sock *sk, int flags)
|
||||
tp->rx_opt.saw_tstamp = 0;
|
||||
tp->rx_opt.dsack = 0;
|
||||
tp->rx_opt.num_sacks = 0;
|
||||
tp->rcv_ooopack = 0;
|
||||
|
||||
|
||||
/* Clean up fastopen related fields */
|
||||
@@ -3292,6 +3296,8 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info)
|
||||
info->tcpi_bytes_retrans = tp->bytes_retrans;
|
||||
info->tcpi_dsack_dups = tp->dsack_dups;
|
||||
info->tcpi_reord_seen = tp->reord_seen;
|
||||
info->tcpi_rcv_ooopack = tp->rcv_ooopack;
|
||||
info->tcpi_snd_wnd = tp->snd_wnd;
|
||||
unlock_sock_fast(sk, slow);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tcp_get_info);
|
||||
@@ -3794,8 +3800,8 @@ int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp,
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < shi->nr_frags; ++i) {
|
||||
const struct skb_frag_struct *f = &shi->frags[i];
|
||||
unsigned int offset = f->page_offset;
|
||||
const skb_frag_t *f = &shi->frags[i];
|
||||
unsigned int offset = skb_frag_off(f);
|
||||
struct page *page = skb_frag_page(f) + (offset >> PAGE_SHIFT);
|
||||
|
||||
sg_set_page(&sg, page, skb_frag_size(f),
|
||||
|
@@ -346,7 +346,7 @@ static void bbr_cwnd_event(struct sock *sk, enum tcp_ca_event event)
|
||||
|
||||
/* Calculate bdp based on min RTT and the estimated bottleneck bandwidth:
|
||||
*
|
||||
* bdp = bw * min_rtt * gain
|
||||
* bdp = ceil(bw * min_rtt * gain)
|
||||
*
|
||||
* The key factor, gain, controls the amount of queue. While a small gain
|
||||
* builds a smaller queue, it becomes more vulnerable to noise in RTT
|
||||
@@ -370,7 +370,9 @@ static u32 bbr_bdp(struct sock *sk, u32 bw, int gain)
|
||||
|
||||
w = (u64)bw * bbr->min_rtt_us;
|
||||
|
||||
/* Apply a gain to the given value, then remove the BW_SCALE shift. */
|
||||
/* Apply a gain to the given value, remove the BW_SCALE shift, and
|
||||
* round the value up to avoid a negative feedback loop.
|
||||
*/
|
||||
bdp = (((w * gain) >> BBR_SCALE) + BW_UNIT - 1) / BW_UNIT;
|
||||
|
||||
return bdp;
|
||||
|
@@ -81,13 +81,42 @@ static int tcp_diag_put_md5sig(struct sk_buff *skb,
|
||||
}
|
||||
#endif
|
||||
|
||||
static int tcp_diag_put_ulp(struct sk_buff *skb, struct sock *sk,
|
||||
const struct tcp_ulp_ops *ulp_ops)
|
||||
{
|
||||
struct nlattr *nest;
|
||||
int err;
|
||||
|
||||
nest = nla_nest_start_noflag(skb, INET_DIAG_ULP_INFO);
|
||||
if (!nest)
|
||||
return -EMSGSIZE;
|
||||
|
||||
err = nla_put_string(skb, INET_ULP_INFO_NAME, ulp_ops->name);
|
||||
if (err)
|
||||
goto nla_failure;
|
||||
|
||||
if (ulp_ops->get_info)
|
||||
err = ulp_ops->get_info(sk, skb);
|
||||
if (err)
|
||||
goto nla_failure;
|
||||
|
||||
nla_nest_end(skb, nest);
|
||||
return 0;
|
||||
|
||||
nla_failure:
|
||||
nla_nest_cancel(skb, nest);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int tcp_diag_get_aux(struct sock *sk, bool net_admin,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct inet_connection_sock *icsk = inet_csk(sk);
|
||||
int err = 0;
|
||||
|
||||
#ifdef CONFIG_TCP_MD5SIG
|
||||
if (net_admin) {
|
||||
struct tcp_md5sig_info *md5sig;
|
||||
int err = 0;
|
||||
|
||||
rcu_read_lock();
|
||||
md5sig = rcu_dereference(tcp_sk(sk)->md5sig_info);
|
||||
@@ -99,11 +128,21 @@ static int tcp_diag_get_aux(struct sock *sk, bool net_admin,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (net_admin) {
|
||||
const struct tcp_ulp_ops *ulp_ops;
|
||||
|
||||
ulp_ops = icsk->icsk_ulp_ops;
|
||||
if (ulp_ops)
|
||||
err = tcp_diag_put_ulp(skb, sk, ulp_ops);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t tcp_diag_get_aux_size(struct sock *sk, bool net_admin)
|
||||
{
|
||||
struct inet_connection_sock *icsk = inet_csk(sk);
|
||||
size_t size = 0;
|
||||
|
||||
#ifdef CONFIG_TCP_MD5SIG
|
||||
@@ -124,6 +163,17 @@ static size_t tcp_diag_get_aux_size(struct sock *sk, bool net_admin)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (net_admin && sk_fullsock(sk)) {
|
||||
const struct tcp_ulp_ops *ulp_ops;
|
||||
|
||||
ulp_ops = icsk->icsk_ulp_ops;
|
||||
if (ulp_ops) {
|
||||
size += nla_total_size(0) +
|
||||
nla_total_size(TCP_ULP_NAME_MAX);
|
||||
if (ulp_ops->get_info_size)
|
||||
size += ulp_ops->get_info_size(sk);
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@@ -3782,6 +3782,49 @@ static void smc_parse_options(const struct tcphdr *th,
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Try to parse the MSS option from the TCP header. Return 0 on failure, clamped
|
||||
* value on success.
|
||||
*/
|
||||
static u16 tcp_parse_mss_option(const struct tcphdr *th, u16 user_mss)
|
||||
{
|
||||
const unsigned char *ptr = (const unsigned char *)(th + 1);
|
||||
int length = (th->doff * 4) - sizeof(struct tcphdr);
|
||||
u16 mss = 0;
|
||||
|
||||
while (length > 0) {
|
||||
int opcode = *ptr++;
|
||||
int opsize;
|
||||
|
||||
switch (opcode) {
|
||||
case TCPOPT_EOL:
|
||||
return mss;
|
||||
case TCPOPT_NOP: /* Ref: RFC 793 section 3.1 */
|
||||
length--;
|
||||
continue;
|
||||
default:
|
||||
if (length < 2)
|
||||
return mss;
|
||||
opsize = *ptr++;
|
||||
if (opsize < 2) /* "silly options" */
|
||||
return mss;
|
||||
if (opsize > length)
|
||||
return mss; /* fail on partial options */
|
||||
if (opcode == TCPOPT_MSS && opsize == TCPOLEN_MSS) {
|
||||
u16 in_mss = get_unaligned_be16(ptr);
|
||||
|
||||
if (in_mss) {
|
||||
if (user_mss && user_mss < in_mss)
|
||||
in_mss = user_mss;
|
||||
mss = in_mss;
|
||||
}
|
||||
}
|
||||
ptr += opsize - 2;
|
||||
length -= opsize;
|
||||
}
|
||||
}
|
||||
return mss;
|
||||
}
|
||||
|
||||
/* Look for tcp options. Normally only called on SYN and SYNACK packets.
|
||||
* But, this can also be called on packets in the established flow when
|
||||
* the fast version below fails.
|
||||
@@ -4512,6 +4555,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
|
||||
tp->pred_flags = 0;
|
||||
inet_csk_schedule_ack(sk);
|
||||
|
||||
tp->rcv_ooopack += max_t(u16, 1, skb_shinfo(skb)->gso_segs);
|
||||
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOQUEUE);
|
||||
seq = TCP_SKB_CB(skb)->seq;
|
||||
end_seq = TCP_SKB_CB(skb)->end_seq;
|
||||
@@ -6422,9 +6466,7 @@ EXPORT_SYMBOL(inet_reqsk_alloc);
|
||||
/*
|
||||
* Return true if a syncookie should be sent
|
||||
*/
|
||||
static bool tcp_syn_flood_action(const struct sock *sk,
|
||||
const struct sk_buff *skb,
|
||||
const char *proto)
|
||||
static bool tcp_syn_flood_action(const struct sock *sk, const char *proto)
|
||||
{
|
||||
struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue;
|
||||
const char *msg = "Dropping request";
|
||||
@@ -6444,7 +6486,7 @@ static bool tcp_syn_flood_action(const struct sock *sk,
|
||||
net->ipv4.sysctl_tcp_syncookies != 2 &&
|
||||
xchg(&queue->synflood_warned, 1) == 0)
|
||||
net_info_ratelimited("%s: Possible SYN flooding on port %d. %s. Check SNMP counters.\n",
|
||||
proto, ntohs(tcp_hdr(skb)->dest), msg);
|
||||
proto, sk->sk_num, msg);
|
||||
|
||||
return want_cookie;
|
||||
}
|
||||
@@ -6466,6 +6508,36 @@ static void tcp_reqsk_record_syn(const struct sock *sk,
|
||||
}
|
||||
}
|
||||
|
||||
/* If a SYN cookie is required and supported, returns a clamped MSS value to be
|
||||
* used for SYN cookie generation.
|
||||
*/
|
||||
u16 tcp_get_syncookie_mss(struct request_sock_ops *rsk_ops,
|
||||
const struct tcp_request_sock_ops *af_ops,
|
||||
struct sock *sk, struct tcphdr *th)
|
||||
{
|
||||
struct tcp_sock *tp = tcp_sk(sk);
|
||||
u16 mss;
|
||||
|
||||
if (sock_net(sk)->ipv4.sysctl_tcp_syncookies != 2 &&
|
||||
!inet_csk_reqsk_queue_is_full(sk))
|
||||
return 0;
|
||||
|
||||
if (!tcp_syn_flood_action(sk, rsk_ops->slab_name))
|
||||
return 0;
|
||||
|
||||
if (sk_acceptq_is_full(sk)) {
|
||||
NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mss = tcp_parse_mss_option(th, tp->rx_opt.user_mss);
|
||||
if (!mss)
|
||||
mss = af_ops->mss_clamp;
|
||||
|
||||
return mss;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tcp_get_syncookie_mss);
|
||||
|
||||
int tcp_conn_request(struct request_sock_ops *rsk_ops,
|
||||
const struct tcp_request_sock_ops *af_ops,
|
||||
struct sock *sk, struct sk_buff *skb)
|
||||
@@ -6487,7 +6559,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
|
||||
*/
|
||||
if ((net->ipv4.sysctl_tcp_syncookies == 2 ||
|
||||
inet_csk_reqsk_queue_is_full(sk)) && !isn) {
|
||||
want_cookie = tcp_syn_flood_action(sk, skb, rsk_ops->slab_name);
|
||||
want_cookie = tcp_syn_flood_action(sk, rsk_ops->slab_name);
|
||||
if (!want_cookie)
|
||||
goto drop;
|
||||
}
|
||||
|
@@ -1515,6 +1515,21 @@ static struct sock *tcp_v4_cookie_check(struct sock *sk, struct sk_buff *skb)
|
||||
return sk;
|
||||
}
|
||||
|
||||
u16 tcp_v4_get_syncookie(struct sock *sk, struct iphdr *iph,
|
||||
struct tcphdr *th, u32 *cookie)
|
||||
{
|
||||
u16 mss = 0;
|
||||
#ifdef CONFIG_SYN_COOKIES
|
||||
mss = tcp_get_syncookie_mss(&tcp_request_sock_ops,
|
||||
&tcp_request_sock_ipv4_ops, sk, th);
|
||||
if (mss) {
|
||||
*cookie = __cookie_v4_init_sequence(iph, th, &mss);
|
||||
tcp_synq_overflow(sk);
|
||||
}
|
||||
#endif
|
||||
return mss;
|
||||
}
|
||||
|
||||
/* The socket must have it's spinlock held when we get
|
||||
* here, unless it is a TCP_LISTEN socket.
|
||||
*
|
||||
@@ -2637,6 +2652,7 @@ static int __net_init tcp_sk_init(struct net *net)
|
||||
net->ipv4.sysctl_tcp_min_snd_mss = TCP_MIN_SND_MSS;
|
||||
net->ipv4.sysctl_tcp_probe_threshold = TCP_PROBE_THRESHOLD;
|
||||
net->ipv4.sysctl_tcp_probe_interval = TCP_PROBE_INTERVAL;
|
||||
net->ipv4.sysctl_tcp_mtu_probe_floor = TCP_MIN_SND_MSS;
|
||||
|
||||
net->ipv4.sysctl_tcp_keepalive_time = TCP_KEEPALIVE_TIME;
|
||||
net->ipv4.sysctl_tcp_keepalive_probes = TCP_KEEPALIVE_PROBES;
|
||||
|
@@ -1050,11 +1050,22 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,
|
||||
tcb = TCP_SKB_CB(skb);
|
||||
memset(&opts, 0, sizeof(opts));
|
||||
|
||||
if (unlikely(tcb->tcp_flags & TCPHDR_SYN))
|
||||
if (unlikely(tcb->tcp_flags & TCPHDR_SYN)) {
|
||||
tcp_options_size = tcp_syn_options(sk, skb, &opts, &md5);
|
||||
else
|
||||
} else {
|
||||
tcp_options_size = tcp_established_options(sk, skb, &opts,
|
||||
&md5);
|
||||
/* Force a PSH flag on all (GSO) packets to expedite GRO flush
|
||||
* at receiver : This slightly improve GRO performance.
|
||||
* Note that we do not force the PSH flag for non GSO packets,
|
||||
* because they might be sent under high congestion events,
|
||||
* and in this case it is better to delay the delivery of 1-MSS
|
||||
* packets and thus the corresponding ACK packet that would
|
||||
* release the following packet.
|
||||
*/
|
||||
if (tcp_skb_pcount(skb) > 1)
|
||||
tcb->tcp_flags |= TCPHDR_PSH;
|
||||
}
|
||||
tcp_header_size = tcp_options_size + sizeof(struct tcphdr);
|
||||
|
||||
/* if no packet is in qdisc/device queue, then allow XPS to select
|
||||
@@ -1403,7 +1414,7 @@ static int __pskb_trim_head(struct sk_buff *skb, int len)
|
||||
} else {
|
||||
shinfo->frags[k] = shinfo->frags[i];
|
||||
if (eat) {
|
||||
shinfo->frags[k].page_offset += eat;
|
||||
skb_frag_off_add(&shinfo->frags[k], eat);
|
||||
skb_frag_size_sub(&shinfo->frags[k], eat);
|
||||
eat = 0;
|
||||
}
|
||||
|
@@ -154,7 +154,7 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk)
|
||||
} else {
|
||||
mss = tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_low) >> 1;
|
||||
mss = min(net->ipv4.sysctl_tcp_base_mss, mss);
|
||||
mss = max(mss, 68 - tcp_sk(sk)->tcp_header_len);
|
||||
mss = max(mss, net->ipv4.sysctl_tcp_mtu_probe_floor);
|
||||
mss = max(mss, net->ipv4.sysctl_tcp_min_snd_mss);
|
||||
icsk->icsk_mtup.search_low = tcp_mss_to_mtu(sk, mss);
|
||||
}
|
||||
|
@@ -423,12 +423,13 @@ static struct sock *udp4_lib_lookup2(struct net *net,
|
||||
score = compute_score(sk, net, saddr, sport,
|
||||
daddr, hnum, dif, sdif);
|
||||
if (score > badness) {
|
||||
if (sk->sk_reuseport) {
|
||||
if (sk->sk_reuseport &&
|
||||
sk->sk_state != TCP_ESTABLISHED) {
|
||||
hash = udp_ehashfn(net, daddr, hnum,
|
||||
saddr, sport);
|
||||
result = reuseport_select_sock(sk, hash, skb,
|
||||
sizeof(struct udphdr));
|
||||
if (result)
|
||||
if (result && !reuseport_has_conns(sk, false))
|
||||
return result;
|
||||
}
|
||||
badness = score;
|
||||
@@ -1130,7 +1131,7 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
||||
|
||||
fl4 = &fl4_stack;
|
||||
|
||||
flowi4_init_output(fl4, ipc.oif, sk->sk_mark, tos,
|
||||
flowi4_init_output(fl4, ipc.oif, ipc.sockc.mark, tos,
|
||||
RT_SCOPE_UNIVERSE, sk->sk_protocol,
|
||||
flow_flags,
|
||||
faddr, saddr, dport, inet->inet_sport,
|
||||
|
Reference in New Issue
Block a user