* [PATCH net] net/mlx5: fix uaccess beyond "count" in debugfs read handlers
From: Jann Horn @ 2018-07-06 15:20 UTC (permalink / raw)
To: Saeed Mahameed, Leon Romanovsky, David S. Miller, jannh
Cc: netdev, linux-rdma, linux-kernel
In general, accessing userspace memory beyond the length of the supplied
buffer in VFS read/write handlers can lead to both kernel memory corruption
(via kernel_read()/kernel_write(), which can e.g. be triggered via
sys_splice()) and privilege escalation inside userspace.
In this case, the affected files are in debugfs (and should therefore only
be accessible to root) and check that *pos is zero (which prevents the
sys_splice() trick). Therefore, this is not a security fix, but rather a
small cleanup.
Fix it by using simple_read_from_buffer() instead of custom logic.
Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Signed-off-by: Jann Horn <jannh@google.com>
---
drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 23 +++----------------
.../net/ethernet/mellanox/mlx5/core/debugfs.c | 22 ++----------------
2 files changed, 5 insertions(+), 40 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index 384c1fa49081..0a79a4540923 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -1226,21 +1226,12 @@ static ssize_t data_read(struct file *filp, char __user *buf, size_t count,
{
struct mlx5_core_dev *dev = filp->private_data;
struct mlx5_cmd_debug *dbg = &dev->cmd.dbg;
- int copy;
-
- if (*pos)
- return 0;
if (!dbg->out_msg)
return -ENOMEM;
- copy = min_t(int, count, dbg->outlen);
- if (copy_to_user(buf, dbg->out_msg, copy))
- return -EFAULT;
-
- *pos += copy;
-
- return copy;
+ return simple_read_from_buffer(buf, count, pos, dbg->out_msg,
+ dbg->outlen);
}
static const struct file_operations dfops = {
@@ -1258,19 +1249,11 @@ static ssize_t outlen_read(struct file *filp, char __user *buf, size_t count,
char outlen[8];
int err;
- if (*pos)
- return 0;
-
err = snprintf(outlen, sizeof(outlen), "%d", dbg->outlen);
if (err < 0)
return err;
- if (copy_to_user(buf, &outlen, err))
- return -EFAULT;
-
- *pos += err;
-
- return err;
+ return simple_read_from_buffer(buf, count, pos, outlen, err);
}
static ssize_t outlen_write(struct file *filp, const char __user *buf,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
index 413080a312a7..90fabd612b6c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
@@ -150,22 +150,13 @@ static ssize_t average_read(struct file *filp, char __user *buf, size_t count,
int ret;
char tbuf[22];
- if (*pos)
- return 0;
-
stats = filp->private_data;
spin_lock_irq(&stats->lock);
if (stats->n)
field = div64_u64(stats->sum, stats->n);
spin_unlock_irq(&stats->lock);
ret = snprintf(tbuf, sizeof(tbuf), "%llu\n", field);
- if (ret > 0) {
- if (copy_to_user(buf, tbuf, ret))
- return -EFAULT;
- }
-
- *pos += ret;
- return ret;
+ return simple_read_from_buffer(buf, count, pos, tbuf, ret);
}
static ssize_t average_write(struct file *filp, const char __user *buf,
@@ -442,9 +433,6 @@ static ssize_t dbg_read(struct file *filp, char __user *buf, size_t count,
u64 field;
int ret;
- if (*pos)
- return 0;
-
desc = filp->private_data;
d = (void *)(desc - desc->i) - sizeof(*d);
switch (d->type) {
@@ -470,13 +458,7 @@ static ssize_t dbg_read(struct file *filp, char __user *buf, size_t count,
else
ret = snprintf(tbuf, sizeof(tbuf), "0x%llx\n", field);
- if (ret > 0) {
- if (copy_to_user(buf, tbuf, ret))
- return -EFAULT;
- }
-
- *pos += ret;
- return ret;
+ return simple_read_from_buffer(buf, count, pos, tbuf, ret);
}
static const struct file_operations fops = {
--
2.18.0.399.gad0ab374a1-goog
^ permalink raw reply related
* Re: [PATCH v2 net-next 0/3] rds: IPv6 support
From: Sowmini Varadhan @ 2018-07-06 15:14 UTC (permalink / raw)
To: Ka-Cheong Poon; +Cc: netdev, santosh.shilimkar, davem, rds-devel
In-Reply-To: <e8b0e275-bb29-0358-c049-e54b0960c858@oracle.com>
On (07/06/18 22:36), Ka-Cheong Poon wrote:
> This patch series does not change existing behavior. But
> I think this is a strange RDS semantics as it differs from
> other types of socket. But this is not about IPv6 support
> and can be dealt with later.
sure,
> > Since we are choosing to treat this behavior as a feature we
> > need to be consistent in rds_getname(). If we find
> > (!peer and !ipv6_addr_any(rs_conn_addr)) and the socket is not yet bound,
> > the returned address (address size, address family) should be based
> > on the rs_conn_addr. (Otherwise if I connect to abc::1 without doing a
> > bind(), and try to do a getsockname(), I get back a sockaddr_in?!)
>
>
> OK, will change that.
> >- rds_cancel_sent_to() and rds_connect and rds_bind and rds_sendmsg
> > As DaveM has already pointed out, we should be using sa_family to figure
> > out sockaddr_in vs sockaddr_in6 (not the other way around of inspecting
> > len first, and then the family- that way wont work if I pass in
> > sockaddr_storage). E.g., see inet_dgram_connect.
> >
> > if (addr_len < sizeof(uaddr->sa_family))
> > return -EINVAL;
> OK, will change that.
thank you
> >- In net/rds/rds.h;
> >
> > /* The following ports, 16385, 18634, 18635, are registered with IANA as
> > * the ports to be used for RDS over TCP and UDP. 18634 is the historical
> >
> > What is "RDS over TCP and UDP"? There is no such thing as RDS-over-UDP.
> > IN fact RDS has nothing to do with UDP. The comment is confused. See next
> > item below, where the comment disappears.
>
>
> As mentioned in the above comments, they are registered with IANA.
16385 is registered for RDS-TCP.
what does it mean to run rds-tcp and rds_rdma with the CM at the same time?
Is this possible? (if it is, why not poach some other number like 2049
from NFS?!)
18635 is actually not used in the RDS code.
Why can you not use that for RDS_CM_PORT?
In general, please do NOT pull up these definitions into net/rds/rds.h
They may change in the future- and the really belong in the transport
specific header file - you question this further below, see my answer
there.
> There is no RDS/UDP in Linux but the port numbers are registered
> nevertheless. And RDS can work over UDP AFAICT. BTW, it is really
No it cannot. RDS needs a reliable transport. If you start using
UDP (or pigeon-carrier) for the transport you have to build the
reliability yourself.
The Oracle DB libraries either use RDS-TCP or RDS-IB or UDP (in the UDP
case they do their own congestion management in userspace, and
history has shown that it is hard to get that right, thus the desire to
switch to rds-tcp).
Anyway, even though Andy Grover registered 18635 for "RDS-IB UDP",
that is probably the most harmless one to use for this case, because
- it is unused,
- it calls itself rds-Infiniband,
- the likelihood of doing rds-udp is infinitesmally small (it is more likely
that we will need to send packets from abc::1 -> fe80:2 before we need
rds-udp :-) :-) :-))
- and if rds-udp happens, we can use 16385/udp for rds-udp
so please use 18635 for your RDS_CM_PORT and move it to IB specific
header files and lets converge this thread.
Towing RDS_TCP_PORT around has absolutely nothing to do with your
ipv6 patch set.
> strange that RDS/TCP does not use the port number already registered.
> Anyway, the above comments are just a note on this fact in the IANA
16385 was in defacto use for a long time (since 2.6 kernels), thus I
registered it as well when I started fixing this up.
the 18634/18635 are registered for rds-iB, (caps intended) not rds-tcp.
They are available for your use.
> database. The following is a link to the IANA assignment.
yes, I am aware
> IMHO, there should only be RDS_PORT in the first place. And it
> can be used for all transports. For example, if RDS/SCTP is added,
> it can also use the same port number. There is no need to define
if/when we add rds/sctp, we shall keep that in mind.
This is getting to be "arguing for the sake of arguing". I dont have
the time for that.
> a new port number for each transport. What is the rationale that
> each transport needs to have its own number and be defined in its
> own header file?
Some transports may not even need a port number. Some may need
several. Some may use sysctl (suggested by Tom Herbert) to make
this configurable. Until recently, we had rds/iWARP, that may need
its own transport hooks, it does not make sense to peanut-butter
that into the core module.
That is why it has to be in the transport. I hope that answers the
question.
> If the behavior of a software component is modified/enhanced such
> that the existing API of this component has problems dealing with
> this new behavior, should the API be modified or a new API be added
> to handle that? If neither is done, shouldn't this be considered
> a bug?
whatever. The design (parallelization for perf) is fine. Some
parts of the API are work in progress based on priority/need.
I dont want to bicker over this one, except to note that the judgemental
nature of the comment is interesting.
> > Also, while you are there, s/exisiting/existing, please.
>
>
> OK, with change that.
Wonderful.
For the rest, I repeat: Oracle Clusters are using UDP/IPV6 today
(with no RDS). You need feature compat with UDP for that reason.
--Sowmini
^ permalink raw reply
* Re: [PATCH iproute2-next] tc: m_tunnel_key: Add tunnel option support to act_tunnel_key
From: Jakub Kicinski @ 2018-07-06 15:19 UTC (permalink / raw)
To: Roman Mashak
Cc: David Ahern, stephen, oss-drivers, Linux Netdev List,
Simon Horman, Pieter Jansen van Vuuren
In-Reply-To: <85zhz4pjzs.fsf@mojatatu.com>
On Fri, Jul 6, 2018 at 6:32 AM, Roman Mashak <mrv@mojatatu.com> wrote:
> Jakub Kicinski <jakub.kicinski@netronome.com> writes:
>
>> From: Simon Horman <simon.horman@netronome.com>
>>
>> Allow setting tunnel options using the act_tunnel_key action.
>>
>> Options are expressed as class:type:data and multiple options
>> may be listed using a comma delimiter.
>>
>> # ip link add name geneve0 type geneve dstport 0 external
>> # tc qdisc add dev eth0 ingress
>> # tc filter add dev eth0 protocol ip parent ffff: \
>> flower indev eth0 \
>> ip_proto udp \
>> action tunnel_key \
>> set src_ip 10.0.99.192 \
>> dst_ip 10.0.99.193 \
>> dst_port 6081 \
>> id 11 \
>> geneve_opts 0102:80:00800022,0102:80:00800022 \
>> action mirred egress redirect dev geneve0
>
> [...]
>
> Jakub, could you also add relevant tests for the new option in file
> $(kernel)/tools/testing/selftests/tc-testing/tc-tests/actions/tunnel_key.json?
We'll look into it!
^ permalink raw reply
* Re: [PATCH] netfilter: conntrack: add weak IPV6 dependency
From: Arnd Bergmann @ 2018-07-06 15:14 UTC (permalink / raw)
To: Florian Westphal
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, David S. Miller,
Máté Eckl, Fernando Fernandez Mancera,
Pablo M. Bermudo Garay, Felix Fietkau, netfilter-devel, coreteam,
Networking, Linux Kernel Mailing List
In-Reply-To: <20180706150037.knqt736uq6uyh3bs@breakpoint.cc>
On Fri, Jul 6, 2018 at 5:00 PM, Florian Westphal <fw@strlen.de> wrote:
> Arnd Bergmann <arnd@arndb.de> wrote:
>> and that resulted in a new build failure:
>>
>> net/netfilter/nf_conntrack_proto.o:(.rodata+0x788): undefined
>> reference to `nf_conntrack_l4proto_icmpv6'
>> net/ipv6/netfilter/nf_conntrack_reasm.o: In function `nf_ct_frag6_expire':
>> nf_conntrack_reasm.c:(.text+0x2320): undefined reference to
>> `ip6_expire_frag_queue'
>> net/ipv6/netfilter/nf_conntrack_reasm.o: In function `nf_ct_frag6_init':
>> nf_conntrack_reasm.c:(.text+0x2384): undefined reference to `ip6_frag_init'
>> nf_conntrack_reasm.c:(.text+0x2394): undefined reference to `ip6_frag_init'
>> nf_conntrack_reasm.c:(.text+0x2398): undefined reference to `ip6_rhash_params'
>> net/ipv6/netfilter/nf_conntrack_reasm.o: In function `nf_ct_frag6_expire':
>> nf_conntrack_reasm.c:(.text+0x10bc): undefined reference to
>> `ip6_expire_frag_queue'
>>
>> I don't think we can get CONFIG_NF_DEFRAG_IPV6=y to work with IPV6=m.
>
> Yes, not with current implementation, but I still don't think this
> is unavoidable.
>
> In case this is urgent I'm fine with the patch that adds the dependency,
> otherwise I'd like to try and disentangle nf_conntrack_reasm and ipv6.
I don't think any real users depend on it, but I hit the problem quite
frequently in randconfig testing on linux-next.
Arnd
^ permalink raw reply
* Re: [PATCH v2 net-next 1/3] rds: Changing IP address internal representation to struct in6_addr
From: Ka-Cheong Poon @ 2018-07-06 15:08 UTC (permalink / raw)
To: Sowmini Varadhan, Santosh Shilimkar, davem; +Cc: netdev, rds-devel
In-Reply-To: <20180706101505.GA32098@oracle.com>
On 07/06/2018 06:15 PM, Sowmini Varadhan wrote:
> On (07/06/18 17:08), Ka-Cheong Poon wrote:
>>> Hmm. Why do you need to include tcp header in ib transport
>>> code ? If there is any common function just move to core
>>> common file and use it.
>>
>> I think it can be removed as it is left over from earlier
>> changes when the IB IPv6 listener port was RDS_TCP_PORT.
>> Now all the port definitions are in rds.h.
>
> Transport specific information such as port numbers should not
> be smeared into the common rds-module. Please fix that.
>
> If IB is also piggybacking on port 16385 (why?), please use your
> own definitions for it in IB specific header files.
As mentioned in a previous mail, it is unclear why the
port number is transport specific. Most Internet services
use the same port number running over TCP/UDP as shown
in the IANA database. And the IANA RDS registration is
the same. What is the rationale of having a transport
specific number in the RDS implementation?
--
K. Poon
ka-cheong.poon@oracle.com
^ permalink raw reply
* Re: [PATCH net 1/3] net/ipv6: fix addrconf_sysctl_addr_gen_mode
From: Sabrina Dubroca @ 2018-07-06 15:02 UTC (permalink / raw)
To: David Ahern; +Cc: netdev, Jiri Pirko, Felix Jia
In-Reply-To: <3c53aeaf-912f-8921-c9df-40f2caa1747a@gmail.com>
2018-07-06, 08:42:01 -0600, David Ahern wrote:
> On 7/6/18 7:49 AM, Sabrina Dubroca wrote:
> > diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> > index 91580c62bb86..e9ba53d2a147 100644
> > --- a/net/ipv6/addrconf.c
> > +++ b/net/ipv6/addrconf.c
> > @@ -5892,32 +5892,31 @@ static int addrconf_sysctl_addr_gen_mode(struct ctl_table *ctl, int write,
> > loff_t *ppos)
> > {
> > int ret = 0;
> > - int new_val;
> > + u32 new_val;
> > struct inet6_dev *idev = (struct inet6_dev *)ctl->extra1;
> > struct net *net = (struct net *)ctl->extra2;
> > + struct ctl_table tmp = {
> > + .data = &new_val,
> > + .maxlen = sizeof(new_val),
> > + .mode = ctl->mode,
> > + };
> >
> > if (!rtnl_trylock())
> > return restart_syscall();
> >
> > - ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
> > + new_val = *((u32 *)ctl->data);
> >
> > - if (write) {
> > - new_val = *((int *)ctl->data);
> > + ret = proc_douintvec(&tmp, write, buffer, lenp, ppos);
> > + if (ret != 0)
> > + goto out;
> >
> > + if (write) {
> > if (check_addr_gen_mode(new_val) < 0) {
> > ret = -EINVAL;
> > goto out;
> > }
> >
> > - /* request for default */
> > - if (&net->ipv6.devconf_dflt->addr_gen_mode == ctl->data) {
> > - ipv6_devconf_dflt.addr_gen_mode = new_val;
>
> updating the template is wrong, but you still need to update the
> namespace's default value for new devices.
That's already handled by storing new_val into ctl->data at the end of
the 'write' block.
BTW, I'd like to make ipv6_devconf and ipv6_devconf_dflt read-only, so
that people aren't tempted to update the template, but I'm thinking of
doing that in net-next rather than net.
> also, if you are fixing this it would be good to handle the change to
> 'all' as well and update all existing devices.
I thought about it, and wasn't sure if that change of behavior was
acceptable, especially for stable (I think the current patch should go
into stable). OTOH, it's quite clearly what "all" should do.
> > -
> > - /* request for individual net device */
> > - } else {
> > - if (!idev)
> > - goto out;
> > -
> > + if (idev) {
> > if (check_stable_privacy(idev, net, new_val) < 0) {
> > ret = -EINVAL;
> > goto out;
> > @@ -5928,6 +5927,8 @@ static int addrconf_sysctl_addr_gen_mode(struct ctl_table *ctl, int write,
> > addrconf_dev_config(idev->dev);
> > }
> > }
> > +
> > + *((u32 *)ctl->data) = new_val;
> > }
> >
> > out:
> >
>
--
Sabrina
^ permalink raw reply
* Re: [PATCH] netfilter: conntrack: add weak IPV6 dependency
From: Florian Westphal @ 2018-07-06 15:00 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Florian Westphal, Pablo Neira Ayuso, Jozsef Kadlecsik,
David S. Miller, Máté Eckl, Fernando Fernandez Mancera,
Pablo M. Bermudo Garay, Felix Fietkau, netfilter-devel, coreteam,
Networking, Linux Kernel Mailing List
In-Reply-To: <CAK8P3a1o6+dcZuW_iMGzwBBw_dcW41QAQ2Mu4A5Ru9ScnwaYDA@mail.gmail.com>
Arnd Bergmann <arnd@arndb.de> wrote:
> and that resulted in a new build failure:
>
> net/netfilter/nf_conntrack_proto.o:(.rodata+0x788): undefined
> reference to `nf_conntrack_l4proto_icmpv6'
> net/ipv6/netfilter/nf_conntrack_reasm.o: In function `nf_ct_frag6_expire':
> nf_conntrack_reasm.c:(.text+0x2320): undefined reference to
> `ip6_expire_frag_queue'
> net/ipv6/netfilter/nf_conntrack_reasm.o: In function `nf_ct_frag6_init':
> nf_conntrack_reasm.c:(.text+0x2384): undefined reference to `ip6_frag_init'
> nf_conntrack_reasm.c:(.text+0x2394): undefined reference to `ip6_frag_init'
> nf_conntrack_reasm.c:(.text+0x2398): undefined reference to `ip6_rhash_params'
> net/ipv6/netfilter/nf_conntrack_reasm.o: In function `nf_ct_frag6_expire':
> nf_conntrack_reasm.c:(.text+0x10bc): undefined reference to
> `ip6_expire_frag_queue'
>
> I don't think we can get CONFIG_NF_DEFRAG_IPV6=y to work with IPV6=m.
Yes, not with current implementation, but I still don't think this
is unavoidable.
In case this is urgent I'm fine with the patch that adds the dependency,
otherwise I'd like to try and disentangle nf_conntrack_reasm and ipv6.
^ permalink raw reply
* Re: [PATCH iproute2 net-next] bridge: add support for isolated option
From: David Ahern @ 2018-07-06 14:59 UTC (permalink / raw)
To: Nikolay Aleksandrov, netdev; +Cc: roopa, dsahern, idosch, stephen
In-Reply-To: <20180703124244.6864-2-nikolay@cumulusnetworks.com>
On 7/3/18 6:42 AM, Nikolay Aleksandrov wrote:
> This patch adds support for the new isolated port option which, if set,
> would allow the isolated ports to communicate only with non-isolated
> ports and the bridge device. The option can be set via the bridge or ip
> link type bridge_slave commands, e.g.:
> $ ip link set dev eth0 type bridge_slave isolated on
> $ bridge link set dev eth0 isolated on
>
> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
> ---
> bridge/link.c | 11 +++++++++++
> ip/iplink_bridge_slave.c | 9 +++++++++
> man/man8/bridge.8 | 6 ++++++
> man/man8/ip-link.8.in | 6 ++++--
> 4 files changed, 30 insertions(+), 2 deletions(-)
>
applied to iproute2-next. Thanks
^ permalink raw reply
* Re: [PATCH] ipv4: fib: avoid NULL dereference
From: Mark Rutland @ 2018-07-06 14:57 UTC (permalink / raw)
To: Eric Dumazet
Cc: linux-kernel, Alexey Kuznetsov, David S . Miller,
Hideaki YOSHIFUJI, netdev
In-Reply-To: <3ad39534-400a-8d4e-ac50-94eb5655e565@gmail.com>
On Fri, Jul 06, 2018 at 07:47:04AM -0700, Eric Dumazet wrote:
>
>
> On 07/06/2018 07:28 AM, Mark Rutland wrote:
> > In tnode_free() we iterate over a callback_head list with a while loop.
> > At the start of the loop body we generate the next head pointer, and at
> > the end of the loop body we generate the tn pointer for the next
> > iteration of the loop by using container_of() on the head pointer to
> > find the tnode, and deriving the kv pointer from this.
> >
> > In the final iteration of the loop, this means that we derive a pointer
> > from NULL, which is undefined behaviour, which UBSAN detects:
>
> There is no dereference, your patch title is misleading.
>
> UBSAN might be fooled, not the C compiler.
I'm happy to change the title to "avoid undefined behaviour".
Thanks,
Mark.
^ permalink raw reply
* Re: [PATCH] ipv4: fib: avoid NULL dereference
From: Mark Rutland @ 2018-07-06 14:55 UTC (permalink / raw)
To: David Ahern
Cc: linux-kernel, Alexey Kuznetsov, David S . Miller,
Hideaki YOSHIFUJI, netdev
In-Reply-To: <92672813-153a-eccb-dbee-4b59bbf657f1@gmail.com>
On Fri, Jul 06, 2018 at 08:49:14AM -0600, David Ahern wrote:
> On 7/6/18 8:28 AM, Mark Rutland wrote:
> > diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> > index 5bc0c89e81e4..8d98c8162554 100644
> > --- a/net/ipv4/fib_trie.c
> > +++ b/net/ipv4/fib_trie.c
> > @@ -497,11 +497,11 @@ static void tnode_free(struct key_vector *tn)
> > struct callback_head *head = &tn_info(tn)->rcu;
> >
> > while (head) {
> > + tn = container_of(head, struct tnode, rcu)->kv;
> > +
> > head = head->next;
> > tnode_free_size += TNODE_SIZE(1ul << tn->bits);
> > node_free(tn);
>
> you are changing tn before the above 2 calls are made on the tn passed in
As tn_info(tn) is container_of(kv, struct tnode, tn), the end result is
the same tn value, so this is not a problem.
Thanks,
Mark.
^ permalink raw reply
* Re: [PATCH v2 net-next 1/3] rds: Changing IP address internal representation to struct in6_addr
From: santosh.shilimkar @ 2018-07-06 14:55 UTC (permalink / raw)
To: Ka-Cheong Poon, netdev; +Cc: davem, rds-devel
In-Reply-To: <6a7b0951-d950-1555-a5b2-622d6f7b9f8f@oracle.com>
On 7/6/18 2:08 AM, Ka-Cheong Poon wrote:
> On 07/06/2018 01:58 AM, Santosh Shilimkar wrote:
>
>
>>> diff --git a/net/rds/connection.c b/net/rds/connection.c
>>> index abef75d..ca72563 100644
>>> --- a/net/rds/connection.c
>>> +++ b/net/rds/connection.c
>>
>>> @@ -142,9 +151,12 @@ static void __rds_conn_path_init(struct
>>> rds_connection *conn,
>>> * are torn down as the module is removed, if ever.
>>> */
>>> static struct rds_connection *__rds_conn_create(struct net *net,
>>> - __be32 laddr, __be32 faddr,
>>> - struct rds_transport *trans, gfp_t gfp,
>>> - int is_outgoing)
>>> + const struct in6_addr *laddr,
>>> + const struct in6_addr *faddr,
>>> + struct rds_transport *trans,
>>> + gfp_t gfp,
>>> + int is_outgoing,
>>> + int dev_if)
>> Am just wondering if we can handle local link address case differently
>> instead of pushing the interface index everywhere. Did you think about
>> any alternative. This can also avoid bunch of changes again and hence
>> the question. Am trying to see if we can minimize the changes to
>> absolute must have to support IPv6.
>
>
> If link local address is supported, scoped ID must be used.
> Unless we remove the support of link local address, we need
> to keep scope ID.
>
Ok.
>
>>> diff --git a/net/rds/ib.h b/net/rds/ib.h
>>> index a6f4d7d..12f96b3 100644
>>> --- a/net/rds/ib.h
>>> +++ b/net/rds/ib.h
>
>>> +union rds_ib_conn_priv {
>>> + struct rds_ib_connect_private ricp_v4;
>>> + struct rds6_ib_connect_private ricp_v6;
>>> };
>> This change was invetiable. Just add a comment saying the priviate
>> data size for v6 vs v4 is different. Also for IPv6 priviate data,
>> I suggest add some resrve fields for any future extensions so
>> that things can be added without breaking wire protocol. With IPv4,
>> we ended up in bit of mess.
>
>
> Will add some comments. Unfortunately the IB private data
> exchange has only a limited space. I don't think there is
> any more space left for reserved field. I think we should
> think of a different way to handle extensions in future.
>
There is enough space. You can send upto 512 bytes iirc. Please
add some reserve fields and ping me if you run into issues.
>>> diff --git a/net/rds/send.c b/net/rds/send.c
>>> index 94c7f74..6ed2e92 100644
>>> --- a/net/rds/send.c
>>> +++ b/net/rds/send.c
>
>>> @@ -1081,27 +1085,59 @@ int rds_sendmsg(struct socket *sock, struct
>>> msghdr *msg, size_t payload_len)
>>> goto out;
>>> }
>>> - if (msg->msg_namelen) {
>>> - /* XXX fail non-unicast destination IPs? */
>>> - if (msg->msg_namelen < sizeof(*usin) || usin->sin_family !=
>>> AF_INET) {
>>> + namelen = msg->msg_namelen;
>>> + if (namelen != 0) {
>>> + if (namelen < sizeof(*usin)) {
>>> + ret = -EINVAL;
>>> + goto out;
>>> + }
>>> + switch (namelen) {
>>> + case sizeof(*usin):
>>> + if (usin->sin_family != AF_INET ||
>>> + usin->sin_addr.s_addr == htonl(INADDR_ANY) ||
>>> + usin->sin_addr.s_addr == htonl(INADDR_BROADCAST) ||
>>> + IN_MULTICAST(ntohl(usin->sin_addr.s_addr))) {
>>> + ret = -EINVAL;
>> The idea was to fail non-unicast IP someday but can you not add this
>> change as part of v6 series. We can look at it later unless you need
>> this change for v6. Again the question is mainly to add only necessary
>> check and leave the existing behavior as is so please re-check all below
>> checks too.
>
>
> This is to match the same IPv6 check. In IPv6 code, it checks
> if the address is a unicast address. I can remove the IPv4
> checks but if an app does send to a multicast address, the
> connection will be stuck forever.
>
OK. Lets keep it then.
>
>>> diff --git a/net/rds/transport.c b/net/rds/transport.c
>>> index 0b188dd..c9788db 100644
>>> --- a/net/rds/transport.c
>>> +++ b/net/rds/transport.c
>>
>>> + if (ipv6_addr_v4mapped(addr)) {
>>
>> Dave already commented on ipv6_addr_v4mapped(). Apart from
>> some of those comments questions, rest of the patch looks
>> really good and nicely done. Will also look at your
>> subsequent two patches and try to send you comments in next
>> few days.
>
>
> Do you mean using mapped address to create IPv4 connections?
> I already have it in my work space. Will be in v3.
yeah. Thanks !!
^ permalink raw reply
* Re: [PATCH] netfilter: conntrack: add weak IPV6 dependency
From: Arnd Bergmann @ 2018-07-06 14:50 UTC (permalink / raw)
To: Florian Westphal
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, David S. Miller,
Máté Eckl, Fernando Fernandez Mancera,
Pablo M. Bermudo Garay, Felix Fietkau, netfilter-devel, coreteam,
Networking, Linux Kernel Mailing List
In-Reply-To: <20180706135516.viz6pjtkdmcoqq2l@breakpoint.cc>
On Fri, Jul 6, 2018 at 3:55 PM, Florian Westphal <fw@strlen.de> wrote:
> Arnd Bergmann <arnd@arndb.de> wrote:
>> Now that the conntrack module contains code for ipv6, we can no longer
>> have it built-in while IPv6 itself is a loadable module:
>>
>> net/netfilter/nf_conntrack_proto.o: In function `nf_ct_netns_do_get':
>> nf_conntrack_proto.c:(.text+0x88c): undefined reference to `nf_defrag_ipv6_enable'
>
> AFAICS this is caused by
>
> CONFIG_NF_CONNTRACK=y
> CONFIG_IPV6=m
> CONFIG_NF_DEFRAG_IPV6=m
>
> This is exported via nf_defrag_ipv6.ko.
>
> nf_defrag_ipv6 has an ipv6 dependency, but i think it might be avoidable
> so this would work:
>
> CONFIG_NF_CONNTRACK=y
> CONFIG_NF_DEFRAG_IPV6=y
> CONFIG_IPV6=m
I've tried it like this now:
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig
index 07516d5c2f80..18b9f8f37c97 100644
--- a/net/ipv6/netfilter/Kconfig
+++ b/net/ipv6/netfilter/Kconfig
@@ -5,10 +5,6 @@
menu "IPv6: Netfilter Configuration"
depends on INET && IPV6 && NETFILTER
-config NF_DEFRAG_IPV6
- tristate
- default n
-
config NF_SOCKET_IPV6
tristate "IPv6 socket lookup support"
help
@@ -352,3 +348,6 @@ endif # IP6_NF_IPTABLES
endmenu
+config NF_DEFRAG_IPV6
+ tristate
+ default n
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index e42c38c99741..51be519a3802 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -49,9 +49,8 @@ config NETFILTER_NETLINK_LOG
config NF_CONNTRACK
tristate "Netfilter connection tracking support"
default m if NETFILTER_ADVANCED=n
- depends on IPV6 || !IPV6
select NF_DEFRAG_IPV4
- select NF_DEFRAG_IPV6 if IPV6
+ select NF_DEFRAG_IPV6 if IPV6 != n
help
Connection tracking keeps a record of what packets have passed
through your machine, in order to figure out how they are related
and that resulted in a new build failure:
net/netfilter/nf_conntrack_proto.o:(.rodata+0x788): undefined
reference to `nf_conntrack_l4proto_icmpv6'
net/ipv6/netfilter/nf_conntrack_reasm.o: In function `nf_ct_frag6_expire':
nf_conntrack_reasm.c:(.text+0x2320): undefined reference to
`ip6_expire_frag_queue'
net/ipv6/netfilter/nf_conntrack_reasm.o: In function `nf_ct_frag6_init':
nf_conntrack_reasm.c:(.text+0x2384): undefined reference to `ip6_frag_init'
nf_conntrack_reasm.c:(.text+0x2394): undefined reference to `ip6_frag_init'
nf_conntrack_reasm.c:(.text+0x2398): undefined reference to `ip6_rhash_params'
net/ipv6/netfilter/nf_conntrack_reasm.o: In function `nf_ct_frag6_expire':
nf_conntrack_reasm.c:(.text+0x10bc): undefined reference to
`ip6_expire_frag_queue'
I don't think we can get CONFIG_NF_DEFRAG_IPV6=y to work with IPV6=m.
Arnd
^ permalink raw reply related
* Re: [PATCH] ipv4: fib: avoid NULL dereference
From: David Ahern @ 2018-07-06 14:49 UTC (permalink / raw)
To: Mark Rutland, linux-kernel
Cc: Alexey Kuznetsov, David S . Miller, Hideaki YOSHIFUJI, netdev
In-Reply-To: <20180706142836.1822-1-mark.rutland@arm.com>
On 7/6/18 8:28 AM, Mark Rutland wrote:
> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> index 5bc0c89e81e4..8d98c8162554 100644
> --- a/net/ipv4/fib_trie.c
> +++ b/net/ipv4/fib_trie.c
> @@ -497,11 +497,11 @@ static void tnode_free(struct key_vector *tn)
> struct callback_head *head = &tn_info(tn)->rcu;
>
> while (head) {
> + tn = container_of(head, struct tnode, rcu)->kv;
> +
> head = head->next;
> tnode_free_size += TNODE_SIZE(1ul << tn->bits);
> node_free(tn);
you are changing tn before the above 2 calls are made on the tn passed in
> -
> - tn = container_of(head, struct tnode, rcu)->kv;
> }
>
> if (tnode_free_size >= PAGE_SIZE * sync_pages) {
>
^ permalink raw reply
* Re: [PATCH] ipv4: fib: avoid NULL dereference
From: Eric Dumazet @ 2018-07-06 14:47 UTC (permalink / raw)
To: Mark Rutland, linux-kernel
Cc: Alexey Kuznetsov, David S . Miller, Hideaki YOSHIFUJI, netdev
In-Reply-To: <20180706142836.1822-1-mark.rutland@arm.com>
On 07/06/2018 07:28 AM, Mark Rutland wrote:
> In tnode_free() we iterate over a callback_head list with a while loop.
> At the start of the loop body we generate the next head pointer, and at
> the end of the loop body we generate the tn pointer for the next
> iteration of the loop by using container_of() on the head pointer to
> find the tnode, and deriving the kv pointer from this.
>
> In the final iteration of the loop, this means that we derive a pointer
> from NULL, which is undefined behaviour, which UBSAN detects:
There is no dereference, your patch title is misleading.
UBSAN might be fooled, not the C compiler.
^ permalink raw reply
* Re: [PATCH net 3/3] net/ipv6: reserve room for IFLA_INET6_ADDR_GEN_MODE
From: David Ahern @ 2018-07-06 14:45 UTC (permalink / raw)
To: Sabrina Dubroca, netdev; +Cc: Jiri Pirko, Felix Jia
In-Reply-To: <81ed48c7026b1f43f647a59516bfc02acb70d7f4.1530884498.git.sd@queasysnail.net>
On 7/6/18 7:49 AM, Sabrina Dubroca wrote:
> inet6_ifla6_size() is called to check how much space is needed by
> inet6_fill_link_af() and inet6_fill_ifinfo(), both of which include
> the IFLA_INET6_ADDR_GEN_MODE attribute. Reserve some room for it.
>
> Fixes: bc91b0f07ada ("ipv6: addrconf: implement address generation modes")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> ---
> net/ipv6/addrconf.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Reviewed-by: David Ahern <dsahern@gmail.com>
^ permalink raw reply
* Re: [PATCH v2 bpf-next 02/14] bpf: introduce cgroup storage maps
From: kbuild test robot @ 2018-07-06 14:42 UTC (permalink / raw)
To: Roman Gushchin
Cc: kbuild-all, netdev, linux-kernel, kernel-team, tj, Roman Gushchin,
Alexei Starovoitov, Daniel Borkmann
In-Reply-To: <20180705205139.3462-3-guro@fb.com>
[-- Attachment #1: Type: text/plain, Size: 2423 bytes --]
Hi Roman,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on bpf-next/master]
url: https://github.com/0day-ci/linux/commits/Roman-Gushchin/bpf-cgroup-local-storage/20180706-055938
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: s390-performance_defconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=s390
All errors (new ones prefixed by >>):
In file included from kernel//bpf/local_storage.c:2:0:
include/linux/bpf-cgroup.h: In function 'cgroup_bpf_prog_attach':
>> include/linux/bpf-cgroup.h:237:10: error: 'EINVAL' undeclared (first use in this function)
return -EINVAL;
^~~~~~
include/linux/bpf-cgroup.h:237:10: note: each undeclared identifier is reported only once for each function it appears in
include/linux/bpf-cgroup.h: In function 'cgroup_bpf_prog_detach':
include/linux/bpf-cgroup.h:243:10: error: 'EINVAL' undeclared (first use in this function)
return -EINVAL;
^~~~~~
include/linux/bpf-cgroup.h: In function 'cgroup_bpf_prog_query':
include/linux/bpf-cgroup.h:249:10: error: 'EINVAL' undeclared (first use in this function)
return -EINVAL;
^~~~~~
vim +/EINVAL +237 include/linux/bpf-cgroup.h
30070984 Daniel Mack 2016-11-23 232
fdb5c453 Sean Young 2018-06-19 233 static inline int cgroup_bpf_prog_attach(const union bpf_attr *attr,
fdb5c453 Sean Young 2018-06-19 234 enum bpf_prog_type ptype,
fdb5c453 Sean Young 2018-06-19 235 struct bpf_prog *prog)
fdb5c453 Sean Young 2018-06-19 236 {
fdb5c453 Sean Young 2018-06-19 @237 return -EINVAL;
fdb5c453 Sean Young 2018-06-19 238 }
fdb5c453 Sean Young 2018-06-19 239
:::::: The code at line 237 was first introduced by commit
:::::: fdb5c4531c1e0e50e609df83f736b6f3a02896e2 bpf: fix attach type BPF_LIRC_MODE2 dependency wrt CONFIG_CGROUP_BPF
:::::: TO: Sean Young <sean@mess.org>
:::::: CC: Daniel Borkmann <daniel@iogearbox.net>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 19173 bytes --]
^ permalink raw reply
* Re: [PATCH net 2/3] net/ipv6: don't reinitialize ndev->cnf.addr_gen_mode on new inet6_dev
From: David Ahern @ 2018-07-06 14:42 UTC (permalink / raw)
To: Sabrina Dubroca, netdev; +Cc: Jiri Pirko, Felix Jia
In-Reply-To: <abdc3ec20a8bdda95ee840bc09bfde41d3134fd3.1530884498.git.sd@queasysnail.net>
On 7/6/18 7:49 AM, Sabrina Dubroca wrote:
> The value has already been copied from this netns's devconf_dflt, it
> shouldn't be reset to the global kernel default.
>
> Fixes: d35a00b8e33d ("net/ipv6: allow sysctl to change link-local address generation mode")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> ---
> net/ipv6/addrconf.c | 2 --
> 1 file changed, 2 deletions(-)
>
Reviewed-by: David Ahern <dsahern@gmail.com>
^ permalink raw reply
* Re: [PATCH net 1/3] net/ipv6: fix addrconf_sysctl_addr_gen_mode
From: David Ahern @ 2018-07-06 14:42 UTC (permalink / raw)
To: Sabrina Dubroca, netdev; +Cc: Jiri Pirko, Felix Jia
In-Reply-To: <f5e0fd3bdfdb6a11e13879c209b0fe5364f136f2.1530884498.git.sd@queasysnail.net>
On 7/6/18 7:49 AM, Sabrina Dubroca wrote:
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 91580c62bb86..e9ba53d2a147 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -5892,32 +5892,31 @@ static int addrconf_sysctl_addr_gen_mode(struct ctl_table *ctl, int write,
> loff_t *ppos)
> {
> int ret = 0;
> - int new_val;
> + u32 new_val;
> struct inet6_dev *idev = (struct inet6_dev *)ctl->extra1;
> struct net *net = (struct net *)ctl->extra2;
> + struct ctl_table tmp = {
> + .data = &new_val,
> + .maxlen = sizeof(new_val),
> + .mode = ctl->mode,
> + };
>
> if (!rtnl_trylock())
> return restart_syscall();
>
> - ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
> + new_val = *((u32 *)ctl->data);
>
> - if (write) {
> - new_val = *((int *)ctl->data);
> + ret = proc_douintvec(&tmp, write, buffer, lenp, ppos);
> + if (ret != 0)
> + goto out;
>
> + if (write) {
> if (check_addr_gen_mode(new_val) < 0) {
> ret = -EINVAL;
> goto out;
> }
>
> - /* request for default */
> - if (&net->ipv6.devconf_dflt->addr_gen_mode == ctl->data) {
> - ipv6_devconf_dflt.addr_gen_mode = new_val;
updating the template is wrong, but you still need to update the
namespace's default value for new devices.
also, if you are fixing this it would be good to handle the change to
'all' as well and update all existing devices.
> -
> - /* request for individual net device */
> - } else {
> - if (!idev)
> - goto out;
> -
> + if (idev) {
> if (check_stable_privacy(idev, net, new_val) < 0) {
> ret = -EINVAL;
> goto out;
> @@ -5928,6 +5927,8 @@ static int addrconf_sysctl_addr_gen_mode(struct ctl_table *ctl, int write,
> addrconf_dev_config(idev->dev);
> }
> }
> +
> + *((u32 *)ctl->data) = new_val;
> }
>
> out:
>
^ permalink raw reply
* Re: [RFC PATCH] ip: re-introduce fragments cache worker
From: Eric Dumazet @ 2018-07-06 14:37 UTC (permalink / raw)
To: Paolo Abeni, Eric Dumazet, netdev
Cc: David S. Miller, Eric Dumazet, Florian Westphal, NeilBrown
In-Reply-To: <f1c2a8246410d6336454aaa8b26d5a670bc4d993.camel@redhat.com>
On 07/06/2018 06:56 AM, Paolo Abeni wrote:
> With:
>
> schedule_work_on(smp_processor_id(), #... )
>
> We can be sure to run exclusively on the cpu handling the RX queue even with the worker.
>
Make sure to test your patch with 16 RX queues (16 cpus) feeding the defrag unit.
In this (common) mode, then having one cpu trying to purge frags wont be enough.
Really the GC can not cope with DDOS, we tried that in the past (IPv4 route cache)
and failed miserably.
^ permalink raw reply
* Re: [PATCH v2 net-next 0/3] rds: IPv6 support
From: Ka-Cheong Poon @ 2018-07-06 14:36 UTC (permalink / raw)
To: Sowmini Varadhan; +Cc: netdev, santosh.shilimkar, davem, rds-devel
In-Reply-To: <20180705174444.GA24483@oracle.com>
On 07/06/2018 01:44 AM, Sowmini Varadhan wrote:
> - rds_getname(): one of the existing properties of PF_RDS is that a
> connect() does not involve an implicit bind(). Note that you are basing
> the changes in rds_bind() on this behavior, thus I guess we make the
> choice of treating this as a feature, not a bug.
This patch series does not change existing behavior. But
I think this is a strange RDS semantics as it differs from
other types of socket. But this is not about IPv6 support
and can be dealt with later.
> Since we are choosing to treat this behavior as a feature we
> need to be consistent in rds_getname(). If we find
> (!peer and !ipv6_addr_any(rs_conn_addr)) and the socket is not yet bound,
> the returned address (address size, address family) should be based
> on the rs_conn_addr. (Otherwise if I connect to abc::1 without doing a
> bind(), and try to do a getsockname(), I get back a sockaddr_in?!)
OK, will change that.
> - rds_cancel_sent_to() and rds_connect and rds_bind and rds_sendmsg
> As DaveM has already pointed out, we should be using sa_family to figure
> out sockaddr_in vs sockaddr_in6 (not the other way around of inspecting
> len first, and then the family- that way wont work if I pass in
> sockaddr_storage). E.g., see inet_dgram_connect.
>
> if (addr_len < sizeof(uaddr->sa_family))
> return -EINVAL;
OK, will change that.
> - In net/rds/rds.h;
>
> /* The following ports, 16385, 18634, 18635, are registered with IANA as
> * the ports to be used for RDS over TCP and UDP. 18634 is the historical
>
> What is "RDS over TCP and UDP"? There is no such thing as RDS-over-UDP.
> IN fact RDS has nothing to do with UDP. The comment is confused. See next
> item below, where the comment disappears.
As mentioned in the above comments, they are registered with IANA.
There is no RDS/UDP in Linux but the port numbers are registered
nevertheless. And RDS can work over UDP AFAICT. BTW, it is really
strange that RDS/TCP does not use the port number already registered.
Anyway, the above comments are just a note on this fact in the IANA
database. The following is a link to the IANA assignment.
https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
> - Also in net/rds/rds.h
> Please dont define transport specific parameters like RD_CM_PORT in the
> common rds.h header. It is unfortunate that we already have RDS_PORT there,
> and we should try to clean that up as well. NOte that RDS_TCP_PORT
> is now in the correct transport-module-specific header (net/rds/tcp.h)
> and its unclean to drag it from there, into the common header as you are
> doing.
>
> In fact I just tried to move the RDS_PORT definition into
> net/rds/rdma_transport.h and it built just-fine. So to summarize,
> please do the following:
> 1. move RDS_PORT into rdma_transport.h
> 2. add RDS_CM_PORT into rdma_transport.h
> 3. stop dragging RDS_TCP_PORT from its current happy home in net/rds/tcp.h
> to net/rds/rds.h
IMHO, there should only be RDS_PORT in the first place. And it
can be used for all transports. For example, if RDS/SCTP is added,
it can also use the same port number. There is no need to define
a new port number for each transport. What is the rationale that
each transport needs to have its own number and be defined in its
own header file?
> - net/rds/connection.c
> As we have discussed offline before, the fact that we cannot report
> TCP seq# etc info via the existing rds-info API is not "a bug in the
> design of MPRDS" but rather a lacking in the API design. Moreover,
> much of the useful information around the TCP socket is already
> available via procfs, TCP_INFO etc, so the info by rds-info is rarely
> used for rds-tcp- the more useful information is around the RDS socket
> itself. So there is a bug in the comment, would be nice if you removed it.
If the behavior of a software component is modified/enhanced such
that the existing API of this component has problems dealing with
this new behavior, should the API be modified or a new API be added
to handle that? If neither is done, shouldn't this be considered
a bug?
> Also, while you are there, s/exisiting/existing, please.
OK, with change that.
> General comments:
> -----------------
> I remain unconvinced by your global <-> link-local arguments.
>
> For UDP sockets we can do this:
>
> eth0
> host1 -------------------------------------- host2
> abc::1/64 fe80::2
> add abc::/64 as onlink subnet route
>
>
> host1# traceroute6 -i eth0 -s abc::1 fe80::2
>
> You just broke this for RDS and are using polemic to defend your case,
> but the main thrust of your diatribe seems to be "why would you need
> this?" I'll try to address that briefly here.
It is unclear why you need to use words like "polemic"
and "diatribe". What I wrote is in public and folks can
judge whether they are personal in nature. I'd suggest
that discussion should be done in a professional manner.
> - There may be lot of valid reasons why host2 does not want to be
> configured with a global prefix. e.g., I only want host2 to be able
> to talk to onlink hosts.
Right. It can use link local address to do this. And
peers can also use link local address to communicate with
host2.
> - RDS mandatorily requires sockets to be bound. So the normal src addr
> selection (that would have caused host1 to use a link-local to talk
> to host2) is suppressed in this case
This requirement may be something to be fixed in future. For
example, one can do "rds-ping fe80::x%y" without specifying
the source address to use and it works fine. The trick is
that rds-ping uses an UDP socket to find the source address to
use and then bind() the RDS socket to that address. So in this
rds-ping example, it will use the correct link local address
as specified in RFC 6724 to set up the RDS connection. This
trick really should not be needed. But as I mentioned, this
patch series does not change existing behavior.
> This is exactly the same as a UDP socket bound to abc::1
>
> Note well, that one of the use-cases for RDS-TCP is to replace
> existing infra that uses UDP for cluster-IPC. This has come up before
> on netdev:
>
> See https://www.mail-archive.com/search?l=netdev@vger.kernel.org&q=subject:%22Re%5C%3A+%5C%5BPATCH+net%5C-next+0%5C%2F6%5C%5D+kcm%5C%3A+Kernel+Connection+Multiplexor+%5C%28KCM%5C%29%22&o=newest&f=1
>
> so feature parity with udp is just as important as feature-parity
> for rds_rdma.
FWIW, RDS is on top of other transport protocols. It does not
really need to provide all services provided by the underlying
protocols.
> I hope that helps you see why we need to not break this gratuituously
> for rds-tcp.
Please note that I understand what you wrote. My objection
is that it requires special set up and can lead to problems
when people actually try to do that. RDS runs on other
platforms too. This will frustrate users and generate calls.
And RDS apps do not really need that as link local address i
always available. Having said this, I will add the support
to handle it to save further discussion.
--
K. Poon
ka-cheong.poon@oracle.com
^ permalink raw reply
* [PATCH] ipv4: fib: avoid NULL dereference
From: Mark Rutland @ 2018-07-06 14:28 UTC (permalink / raw)
To: linux-kernel
Cc: Mark Rutland, Alexey Kuznetsov, David S . Miller,
Hideaki YOSHIFUJI, netdev
In tnode_free() we iterate over a callback_head list with a while loop.
At the start of the loop body we generate the next head pointer, and at
the end of the loop body we generate the tn pointer for the next
iteration of the loop by using container_of() on the head pointer to
find the tnode, and deriving the kv pointer from this.
In the final iteration of the loop, this means that we derive a pointer
from NULL, which is undefined behaviour, which UBSAN detects:
================================================================================
UBSAN: Undefined behaviour in net/ipv4/fib_trie.c:504:6
member access within null pointer of type 'struct tnode'
CPU: 1 PID: 94 Comm: ip Not tainted 4.18.0-rc3+ #23
Hardware name: linux,dummy-virt (DT)
Call trace:
dump_backtrace+0x0/0x458
show_stack+0x20/0x30
dump_stack+0x18c/0x248
ubsan_epilogue+0x18/0x94
handle_null_ptr_deref+0x1d4/0x228
__ubsan_handle_type_mismatch_v1+0x188/0x1e0
tnode_free+0x16c/0x1d0
replace+0x1e0/0x5d0
resize+0xd98/0x2008
fib_insert_alias+0xb38/0x10c8
fib_table_insert+0x7d0/0x1108
fib_magic+0x530/0x780
fib_add_ifaddr+0x378/0x468
fib_netdev_event+0x2ac/0x3e8
notifier_call_chain+0x190/0x2f8
raw_notifier_call_chain+0x3c/0x68
call_netdevice_notifiers_info+0x3c/0xc0
__dev_notify_flags+0x1f8/0x398
dev_change_flags+0xe8/0x150
do_setlink+0x924/0x4050
rtnl_newlink+0x8c4/0x14b0
rtnetlink_rcv_msg+0x408/0xef8
netlink_rcv_skb+0x144/0x390
rtnetlink_rcv+0x24/0x30
netlink_unicast+0x4e8/0x740
netlink_sendmsg+0x6d8/0xe78
sock_sendmsg+0x90/0x168
___sys_sendmsg+0x680/0x9b0
__sys_sendmsg+0xf0/0x230
sys_sendmsg+0x34/0x48
el0_svc_naked+0x30/0x34
================================================================================
We can avoid the undefined behaviour by generating tn for the current
iteration of the loop before we advance head, so let's do that.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: David S. Miller <davem@davemloft.net>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: netdev@vger.kernel.org
---
net/ipv4/fib_trie.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 5bc0c89e81e4..8d98c8162554 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -497,11 +497,11 @@ static void tnode_free(struct key_vector *tn)
struct callback_head *head = &tn_info(tn)->rcu;
while (head) {
+ tn = container_of(head, struct tnode, rcu)->kv;
+
head = head->next;
tnode_free_size += TNODE_SIZE(1ul << tn->bits);
node_free(tn);
-
- tn = container_of(head, struct tnode, rcu)->kv;
}
if (tnode_free_size >= PAGE_SIZE * sync_pages) {
--
2.11.0
^ permalink raw reply related
* Re: [RFC PATCH] ip: re-introduce fragments cache worker
From: Eric Dumazet @ 2018-07-06 14:20 UTC (permalink / raw)
To: Paolo Abeni, Eric Dumazet, netdev
Cc: David S. Miller, Eric Dumazet, Florian Westphal, NeilBrown
In-Reply-To: <f1c2a8246410d6336454aaa8b26d5a670bc4d993.camel@redhat.com>
On 07/06/2018 06:56 AM, Paolo Abeni wrote:
> On Fri, 2018-07-06 at 05:09 -0700, Eric Dumazet wrote:
>> On 07/06/2018 04:56 AM, Paolo Abeni wrote:
>>> With your setting, you need a bit more concurrent connections (400 ?)
>>> to saturate the ipfrag cache. Above that number, performances will
>>> still sink.
>>
>> Maybe, but IP defrag can not be 'perfect'.
>>
>> For this particular use case I could still bump high_thresh to 6 GB and all would be good :)
>
> Understood.
>
> I'd like to be sure I stated the problem I see clearly. With the
> current code the "goodput" goes to almost 0 as soon as the ipfrag cache
> load goes above it's capacity. Before the worker removal, after
> reaching high_thresh, the "goodput" degratated slowly and even with a
> load more than an order of magnitude higher, the performances were
> still quite good. I think we can't ask customers to add more memory for
> a kernel upgrade; even changing the default sysfs configuration is
> somewhat troubling.
>
>>> This looks nice, I'll try to test it in my use case and I'll report
>>> here.
>
> I tried the patch, but the result are not encouraging:
>
> ./super_netperf.sh 200 -H 192.168.101.2 -t UDP_STREAM -l 60
> 34.94
>
> # on the receiver side:
> echo 2 > /proc/sys/net/ipv4/ipfrag_time
>
> # on the sender side:
> ./super_netperf.sh 200 -H 192.168.101.2 -t UDP_STREAM -l 60
> 85.8
>
> # still on receiver side, while the test is running:
> nstat>/dev/null ;sleep 1; nstat |grep IpReasm
> IpReasmTimeout 2128 0.0
> IpReasmReqds 754770 0.0
> IpReasmOKs 135 0.0
> IpReasmFails 752811 0.0
>
> grep FRAG /proc/net/sockstat
> FRAG: inuse 124 memory 5286144
>
> The patch has some effect, as I basically saw no timeout without it,
> but still does not look aggressive enough. Or possibly it's evicting
> the fragments that are more likely to be used/completed (the most
> recents one).
Hey, that was simply an idea (not even compiled), not the final patch.
I will test/polish it later, I am coming back from vacations and have a backlog.
Here are my results : (Note that I have _not_ changed /proc/sys/net/ipv4/ipfrag_time )
lpaa6:~# grep . /proc/sys/net/ipv4/ipfrag_* ; grep FRAG /proc/net/sockstat
/proc/sys/net/ipv4/ipfrag_high_thresh:104857600
/proc/sys/net/ipv4/ipfrag_low_thresh:78643200
/proc/sys/net/ipv4/ipfrag_max_dist:0
/proc/sys/net/ipv4/ipfrag_secret_interval:0
/proc/sys/net/ipv4/ipfrag_time:30
FRAG: inuse 1379 memory 105006776
lpaa5:/export/hda3/google/edumazet# ./super_netperf 400 -H 10.246.7.134 -t UDP_STREAM -l 60
netperf: send_omni: send_data failed: No route to host
netperf: send_omni: send_data failed: No route to host
9063
I would say that it looks pretty good to me.
^ permalink raw reply
* [PATCH net-next 6/6] ip: unconditionally set cork gso_size
From: Willem de Bruijn @ 2018-07-06 14:12 UTC (permalink / raw)
To: netdev; +Cc: davem, Willem de Bruijn
In-Reply-To: <20180706141259.29295-1-willemdebruijn.kernel@gmail.com>
From: Willem de Bruijn <willemb@google.com>
Now that ipc(6)->gso_size is correctly initialized in all callers of
ip(6)_setup_cork, it is safe to unconditionally pass it to the cork.
Link: http://lkml.kernel.org/r/20180619164752.143249-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
net/ipv4/ip_output.c | 3 +--
net/ipv6/ip6_output.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index e14c774cc092..e2b6bd478afb 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1146,8 +1146,7 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork,
cork->fragsize = ip_sk_use_pmtu(sk) ?
dst_mtu(&rt->dst) : rt->dst.dev->mtu;
- cork->gso_size = sk->sk_type == SOCK_DGRAM &&
- sk->sk_protocol == IPPROTO_UDP ? ipc->gso_size : 0;
+ cork->gso_size = ipc->gso_size;
cork->dst = &rt->dst;
cork->length = 0;
cork->ttl = ipc->ttl;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index ff4b28a600ab..8047fd41ba88 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1219,8 +1219,7 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
if (mtu < IPV6_MIN_MTU)
return -EINVAL;
cork->base.fragsize = mtu;
- cork->base.gso_size = sk->sk_type == SOCK_DGRAM &&
- sk->sk_protocol == IPPROTO_UDP ? ipc6->gso_size : 0;
+ cork->base.gso_size = ipc6->gso_size;
cork->base.tx_flags = 0;
sock_tx_timestamp(sk, ipc6->sockc.tsflags, &cork->base.tx_flags);
--
2.18.0.399.gad0ab374a1-goog
^ permalink raw reply related
* [PATCH net-next 5/6] ip: remove tx_flags from ipcm_cookie and use same logic for v4 and v6
From: Willem de Bruijn @ 2018-07-06 14:12 UTC (permalink / raw)
To: netdev; +Cc: davem, Willem de Bruijn
In-Reply-To: <20180706141259.29295-1-willemdebruijn.kernel@gmail.com>
From: Willem de Bruijn <willemb@google.com>
skb_shinfo(skb)->tx_flags is derived from sk->sk_tsflags, possibly
after modification by __sock_cmsg_send, by calling sock_tx_timestamp.
The IPv4 and IPv6 paths do this conversion differently. In IPv4, the
individual protocols that support tx timestamps call this function
and store the result in ipc.tx_flags. In IPv6, sock_tx_timestamp is
called in __ip6_append_data.
There is no need to store both tx_flags and ts_flags in the cookie
as one is derived from the other. Convert when setting up the cork
and remove the redundant field. This is similar to IPv6, only have
the conversion happen only once per datagram, in ip(6)_setup_cork.
Also change __ip6_append_data to match __ip_append_data. Only update
tskey if timestamping is enabled with OPT_ID. The SOCK_.. test is
redundant: only valid protocols can have non-zero cork->tx_flags.
After this change the IPv4 and IPv6 logic is the same.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
include/net/ip.h | 1 -
net/ipv4/ip_output.c | 3 ++-
net/ipv4/ping.c | 2 --
net/ipv4/raw.c | 2 --
net/ipv4/udp.c | 2 --
net/ipv6/ip6_output.c | 18 ++++++++----------
6 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/include/net/ip.h b/include/net/ip.h
index 6db23bf1e5eb..e44b1a44f67a 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -72,7 +72,6 @@ struct ipcm_cookie {
__be32 addr;
int oif;
struct ip_options_rcu *opt;
- __u8 tx_flags;
__u8 ttl;
__s16 tos;
char priority;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 81d0e4a77ec5..e14c774cc092 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1153,8 +1153,9 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork,
cork->ttl = ipc->ttl;
cork->tos = ipc->tos;
cork->priority = ipc->priority;
- cork->tx_flags = ipc->tx_flags;
cork->transmit_time = ipc->sockc.transmit_time;
+ cork->tx_flags = 0;
+ sock_tx_timestamp(sk, ipc->sockc.tsflags, &cork->tx_flags);
return 0;
}
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 6f17fc8ebbdb..b54c964ad925 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -763,8 +763,6 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
rcu_read_unlock();
}
- sock_tx_timestamp(sk, ipc.sockc.tsflags, &ipc.tx_flags);
-
saddr = ipc.addr;
ipc.addr = faddr = daddr;
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index cf142909389c..33df4d76db2d 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -665,8 +665,6 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
&rt, msg->msg_flags, &ipc.sockc);
else {
- sock_tx_timestamp(sk, ipc.sockc.tsflags, &ipc.tx_flags);
-
if (!ipc.addr)
ipc.addr = fl4.daddr;
lock_sock(sk);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 87f3a0b77864..060e841dde40 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1020,8 +1020,6 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
saddr = ipc.addr;
ipc.addr = faddr = daddr;
- sock_tx_timestamp(sk, ipc.sockc.tsflags, &ipc.tx_flags);
-
if (ipc.opt && ipc.opt->opt.srr) {
if (!daddr) {
err = -EINVAL;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 1a3bf6437cb9..ff4b28a600ab 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1221,6 +1221,8 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
cork->base.fragsize = mtu;
cork->base.gso_size = sk->sk_type == SOCK_DGRAM &&
sk->sk_protocol == IPPROTO_UDP ? ipc6->gso_size : 0;
+ cork->base.tx_flags = 0;
+ sock_tx_timestamp(sk, ipc6->sockc.tsflags, &cork->base.tx_flags);
if (dst_allfrag(xfrm_dst_path(&rt->dst)))
cork->base.flags |= IPCORK_ALLFRAG;
@@ -1250,7 +1252,6 @@ static int __ip6_append_data(struct sock *sk,
int copy;
int err;
int offset = 0;
- __u8 tx_flags = 0;
u32 tskey = 0;
struct rt6_info *rt = (struct rt6_info *)cork->dst;
struct ipv6_txoptions *opt = v6_cork->opt;
@@ -1269,6 +1270,10 @@ static int __ip6_append_data(struct sock *sk,
mtu = cork->gso_size ? IP6_MAX_MTU : cork->fragsize;
orig_mtu = mtu;
+ if (cork->tx_flags & SKBTX_ANY_SW_TSTAMP &&
+ sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)
+ tskey = sk->sk_tskey++;
+
hh_len = LL_RESERVED_SPACE(rt->dst.dev);
fragheaderlen = sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len +
@@ -1318,13 +1323,6 @@ static int __ip6_append_data(struct sock *sk,
rt->dst.dev->features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM))
csummode = CHECKSUM_PARTIAL;
- if (sk->sk_type == SOCK_DGRAM || sk->sk_type == SOCK_RAW) {
- sock_tx_timestamp(sk, ipc6->sockc.tsflags, &tx_flags);
- if (tx_flags & SKBTX_ANY_SW_TSTAMP &&
- sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)
- tskey = sk->sk_tskey++;
- }
-
/*
* Let's try using as much space as possible.
* Use MTU if total length of the message fits into the MTU.
@@ -1443,8 +1441,8 @@ static int __ip6_append_data(struct sock *sk,
dst_exthdrlen);
/* Only the initial fragment is time stamped */
- skb_shinfo(skb)->tx_flags = tx_flags;
- tx_flags = 0;
+ skb_shinfo(skb)->tx_flags = cork->tx_flags;
+ cork->tx_flags = 0;
skb_shinfo(skb)->tskey = tskey;
tskey = 0;
--
2.18.0.399.gad0ab374a1-goog
^ permalink raw reply related
* [PATCH net-next 4/6] ipv6: fold sockcm_cookie into ipcm6_cookie
From: Willem de Bruijn @ 2018-07-06 14:12 UTC (permalink / raw)
To: netdev; +Cc: davem, Willem de Bruijn
In-Reply-To: <20180706141259.29295-1-willemdebruijn.kernel@gmail.com>
From: Willem de Bruijn <willemb@google.com>
ipcm_cookie includes sockcm_cookie. Do the same for ipcm6_cookie.
This reduces the number of arguments that need to be passed around,
applies ipcm6_init to all cookie fields at once and reduces code
differentiation between ipv4 and ipv6.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
include/net/ipv6.h | 7 +++----
include/net/transp_v6.h | 3 +--
net/ipv6/datagram.c | 4 ++--
net/ipv6/icmp.c | 7 ++-----
net/ipv6/ip6_flowlabel.c | 3 +--
net/ipv6/ip6_output.c | 24 ++++++++++--------------
net/ipv6/ipv6_sockglue.c | 3 +--
net/ipv6/ping.c | 3 +--
net/ipv6/raw.c | 10 ++++------
net/ipv6/udp.c | 10 ++++------
net/l2tp/l2tp_ip6.c | 6 ++----
11 files changed, 31 insertions(+), 49 deletions(-)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 6cb247f54d4c..aa6fd11a887c 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -294,6 +294,7 @@ struct ipv6_fl_socklist {
};
struct ipcm6_cookie {
+ struct sockcm_cookie sockc;
__s16 hlimit;
__s16 tclass;
__s8 dontfrag;
@@ -959,8 +960,7 @@ int ip6_append_data(struct sock *sk,
int odd, struct sk_buff *skb),
void *from, int length, int transhdrlen,
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
- struct rt6_info *rt, unsigned int flags,
- const struct sockcm_cookie *sockc);
+ struct rt6_info *rt, unsigned int flags);
int ip6_push_pending_frames(struct sock *sk);
@@ -977,8 +977,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
void *from, int length, int transhdrlen,
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
struct rt6_info *rt, unsigned int flags,
- struct inet_cork_full *cork,
- const struct sockcm_cookie *sockc);
+ struct inet_cork_full *cork);
static inline struct sk_buff *ip6_finish_skb(struct sock *sk)
{
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index f6a3543e5247..a8f6020f1196 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -42,8 +42,7 @@ void ip6_datagram_recv_specific_ctl(struct sock *sk, struct msghdr *msg,
struct sk_buff *skb);
int ip6_datagram_send_ctl(struct net *net, struct sock *sk, struct msghdr *msg,
- struct flowi6 *fl6, struct ipcm6_cookie *ipc6,
- struct sockcm_cookie *sockc);
+ struct flowi6 *fl6, struct ipcm6_cookie *ipc6);
void __ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
__u16 srcp, __u16 destp, int rqueue, int bucket);
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 2ee08b6a86a4..201306b9b5ea 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -736,7 +736,7 @@ EXPORT_SYMBOL_GPL(ip6_datagram_recv_ctl);
int ip6_datagram_send_ctl(struct net *net, struct sock *sk,
struct msghdr *msg, struct flowi6 *fl6,
- struct ipcm6_cookie *ipc6, struct sockcm_cookie *sockc)
+ struct ipcm6_cookie *ipc6)
{
struct in6_pktinfo *src_info;
struct cmsghdr *cmsg;
@@ -755,7 +755,7 @@ int ip6_datagram_send_ctl(struct net *net, struct sock *sk,
}
if (cmsg->cmsg_level == SOL_SOCKET) {
- err = __sock_cmsg_send(sk, msg, cmsg, sockc);
+ err = __sock_cmsg_send(sk, msg, cmsg, &ipc6->sockc);
if (err)
return err;
continue;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index d99fed67cd10..24611c8b0562 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -430,7 +430,6 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
struct icmp6hdr tmp_hdr;
struct flowi6 fl6;
struct icmpv6_msg msg;
- struct sockcm_cookie sockc_unused = {0};
struct ipcm6_cookie ipc6;
int iif = 0;
int addr_type = 0;
@@ -573,7 +572,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
len + sizeof(struct icmp6hdr),
sizeof(struct icmp6hdr),
&ipc6, &fl6, (struct rt6_info *)dst,
- MSG_DONTWAIT, &sockc_unused)) {
+ MSG_DONTWAIT)) {
ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
ip6_flush_pending_frames(sk);
} else {
@@ -677,7 +676,6 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
struct dst_entry *dst;
struct ipcm6_cookie ipc6;
u32 mark = IP6_REPLY_MARK(net, skb->mark);
- struct sockcm_cookie sockc_unused = {0};
saddr = &ipv6_hdr(skb)->daddr;
@@ -731,8 +729,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
if (ip6_append_data(sk, icmpv6_getfrag, &msg,
skb->len + sizeof(struct icmp6hdr),
sizeof(struct icmp6hdr), &ipc6, &fl6,
- (struct rt6_info *)dst, MSG_DONTWAIT,
- &sockc_unused)) {
+ (struct rt6_info *)dst, MSG_DONTWAIT)) {
__ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
ip6_flush_pending_frames(sk);
} else {
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 3eee7637bdfe..cb54a8a3c273 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -373,7 +373,6 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq,
if (olen > 0) {
struct msghdr msg;
struct flowi6 flowi6;
- struct sockcm_cookie sockc_junk;
struct ipcm6_cookie ipc6;
err = -ENOMEM;
@@ -392,7 +391,7 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq,
memset(&flowi6, 0, sizeof(flowi6));
ipc6.opt = fl->opt;
- err = ip6_datagram_send_ctl(net, sk, &msg, &flowi6, &ipc6, &sockc_junk);
+ err = ip6_datagram_send_ctl(net, sk, &msg, &flowi6, &ipc6);
if (err)
goto done;
err = -EINVAL;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index f48af7e62f12..1a3bf6437cb9 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1158,8 +1158,7 @@ static void ip6_append_data_mtu(unsigned int *mtu,
static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
struct inet6_cork *v6_cork, struct ipcm6_cookie *ipc6,
- struct rt6_info *rt, struct flowi6 *fl6,
- const struct sockcm_cookie *sockc)
+ struct rt6_info *rt, struct flowi6 *fl6)
{
struct ipv6_pinfo *np = inet6_sk(sk);
unsigned int mtu;
@@ -1227,7 +1226,7 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
cork->base.flags |= IPCORK_ALLFRAG;
cork->base.length = 0;
- cork->base.transmit_time = sockc->transmit_time;
+ cork->base.transmit_time = ipc6->sockc.transmit_time;
return 0;
}
@@ -1241,8 +1240,7 @@ static int __ip6_append_data(struct sock *sk,
int getfrag(void *from, char *to, int offset,
int len, int odd, struct sk_buff *skb),
void *from, int length, int transhdrlen,
- unsigned int flags, struct ipcm6_cookie *ipc6,
- const struct sockcm_cookie *sockc)
+ unsigned int flags, struct ipcm6_cookie *ipc6)
{
struct sk_buff *skb, *skb_prev = NULL;
unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu, pmtu;
@@ -1321,7 +1319,7 @@ static int __ip6_append_data(struct sock *sk,
csummode = CHECKSUM_PARTIAL;
if (sk->sk_type == SOCK_DGRAM || sk->sk_type == SOCK_RAW) {
- sock_tx_timestamp(sk, sockc->tsflags, &tx_flags);
+ sock_tx_timestamp(sk, ipc6->sockc.tsflags, &tx_flags);
if (tx_flags & SKBTX_ANY_SW_TSTAMP &&
sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)
tskey = sk->sk_tskey++;
@@ -1563,8 +1561,7 @@ int ip6_append_data(struct sock *sk,
int odd, struct sk_buff *skb),
void *from, int length, int transhdrlen,
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
- struct rt6_info *rt, unsigned int flags,
- const struct sockcm_cookie *sockc)
+ struct rt6_info *rt, unsigned int flags)
{
struct inet_sock *inet = inet_sk(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
@@ -1578,7 +1575,7 @@ int ip6_append_data(struct sock *sk,
* setup for corking
*/
err = ip6_setup_cork(sk, &inet->cork, &np->cork,
- ipc6, rt, fl6, sockc);
+ ipc6, rt, fl6);
if (err)
return err;
@@ -1592,7 +1589,7 @@ int ip6_append_data(struct sock *sk,
return __ip6_append_data(sk, fl6, &sk->sk_write_queue, &inet->cork.base,
&np->cork, sk_page_frag(sk), getfrag,
- from, length, transhdrlen, flags, ipc6, sockc);
+ from, length, transhdrlen, flags, ipc6);
}
EXPORT_SYMBOL_GPL(ip6_append_data);
@@ -1752,8 +1749,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
void *from, int length, int transhdrlen,
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
struct rt6_info *rt, unsigned int flags,
- struct inet_cork_full *cork,
- const struct sockcm_cookie *sockc)
+ struct inet_cork_full *cork)
{
struct inet6_cork v6_cork;
struct sk_buff_head queue;
@@ -1770,7 +1766,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
cork->base.opt = NULL;
cork->base.dst = NULL;
v6_cork.opt = NULL;
- err = ip6_setup_cork(sk, cork, &v6_cork, ipc6, rt, fl6, sockc);
+ err = ip6_setup_cork(sk, cork, &v6_cork, ipc6, rt, fl6);
if (err) {
ip6_cork_release(cork, &v6_cork);
return ERR_PTR(err);
@@ -1781,7 +1777,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
err = __ip6_append_data(sk, fl6, &queue, &cork->base, &v6_cork,
¤t->task_frag, getfrag, from,
length + exthdrlen, transhdrlen + exthdrlen,
- flags, ipc6, sockc);
+ flags, ipc6);
if (err) {
__ip6_flush_pending_frames(sk, &queue, cork, &v6_cork);
return ERR_PTR(err);
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 4d780c7f0130..fabe3ba1bddc 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -489,7 +489,6 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
struct ipv6_txoptions *opt = NULL;
struct msghdr msg;
struct flowi6 fl6;
- struct sockcm_cookie sockc_junk;
struct ipcm6_cookie ipc6;
memset(&fl6, 0, sizeof(fl6));
@@ -522,7 +521,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
msg.msg_control = (void *)(opt+1);
ipc6.opt = opt;
- retv = ip6_datagram_send_ctl(net, sk, &msg, &fl6, &ipc6, &sockc_junk);
+ retv = ip6_datagram_send_ctl(net, sk, &msg, &fl6, &ipc6);
if (retv)
goto done;
update:
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index 717e7c1fba29..4c04bccc7417 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -62,7 +62,6 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
struct dst_entry *dst;
struct rt6_info *rt;
struct pingfakehdr pfh;
- struct sockcm_cookie junk = {0};
struct ipcm6_cookie ipc6;
pr_debug("ping_v6_sendmsg(sk=%p,sk->num=%u)\n", inet, inet->inet_num);
@@ -146,7 +145,7 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
lock_sock(sk);
err = ip6_append_data(sk, ping_getfrag, &pfh, len,
0, &ipc6, &fl6, rt,
- MSG_DONTWAIT, &junk);
+ MSG_DONTWAIT);
if (err) {
ICMP6_INC_STATS(sock_net(sk), rt->rt6i_idev,
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 5f40670271ee..413d98bf24f4 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -767,7 +767,6 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
struct dst_entry *dst = NULL;
struct raw6_frag_vec rfv;
struct flowi6 fl6;
- struct sockcm_cookie sockc;
struct ipcm6_cookie ipc6;
int addr_len = msg->msg_namelen;
u16 proto;
@@ -792,6 +791,7 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
fl6.flowi6_uid = sk->sk_uid;
ipcm6_init(&ipc6);
+ ipc6.sockc.tsflags = sk->sk_tsflags;
if (sin6) {
if (addr_len < SIN6_LEN_RFC2133)
@@ -845,15 +845,13 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (fl6.flowi6_oif == 0)
fl6.flowi6_oif = sk->sk_bound_dev_if;
- sockc.tsflags = sk->sk_tsflags;
- sockc.transmit_time = 0;
if (msg->msg_controllen) {
opt = &opt_space;
memset(opt, 0, sizeof(struct ipv6_txoptions));
opt->tot_len = sizeof(struct ipv6_txoptions);
ipc6.opt = opt;
- err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, &ipc6, &sockc);
+ err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, &ipc6);
if (err < 0) {
fl6_sock_release(flowlabel);
return err;
@@ -921,13 +919,13 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
back_from_confirm:
if (inet->hdrincl)
err = rawv6_send_hdrinc(sk, msg, len, &fl6, &dst,
- msg->msg_flags, &sockc);
+ msg->msg_flags, &ipc6.sockc);
else {
ipc6.opt = opt;
lock_sock(sk);
err = ip6_append_data(sk, raw6_getfrag, &rfv,
len, 0, &ipc6, &fl6, (struct rt6_info *)dst,
- msg->msg_flags, &sockc);
+ msg->msg_flags);
if (err)
ip6_flush_pending_frames(sk);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 940115da9843..f6b96956a8ed 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1141,12 +1141,10 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
int err;
int is_udplite = IS_UDPLITE(sk);
int (*getfrag)(void *, char *, int, int, int, struct sk_buff *);
- struct sockcm_cookie sockc;
ipcm6_init(&ipc6);
ipc6.gso_size = up->gso_size;
- sockc.tsflags = sk->sk_tsflags;
- sockc.transmit_time = 0;
+ ipc6.sockc.tsflags = sk->sk_tsflags;
/* destination address check */
if (sin6) {
@@ -1281,7 +1279,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
err = udp_cmsg_send(sk, msg, &ipc6.gso_size);
if (err > 0)
err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6,
- &ipc6, &sockc);
+ &ipc6);
if (err < 0) {
fl6_sock_release(flowlabel);
return err;
@@ -1375,7 +1373,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
skb = ip6_make_skb(sk, getfrag, msg, ulen,
sizeof(struct udphdr), &ipc6,
&fl6, (struct rt6_info *)dst,
- msg->msg_flags, &cork, &sockc);
+ msg->msg_flags, &cork);
err = PTR_ERR(skb);
if (!IS_ERR_OR_NULL(skb))
err = udp_v6_send_skb(skb, &fl6, &cork.base);
@@ -1401,7 +1399,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
up->len += ulen;
err = ip6_append_data(sk, getfrag, msg, ulen, sizeof(struct udphdr),
&ipc6, &fl6, (struct rt6_info *)dst,
- corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags, &sockc);
+ corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags);
if (err)
udp_v6_flush_pending_frames(sk);
else if (!corkreq)
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index 38f80691f4ab..672e5b753738 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -500,7 +500,6 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
struct ip6_flowlabel *flowlabel = NULL;
struct dst_entry *dst = NULL;
struct flowi6 fl6;
- struct sockcm_cookie sockc_unused = {0};
struct ipcm6_cookie ipc6;
int addr_len = msg->msg_namelen;
int transhdrlen = 4; /* zero session-id */
@@ -573,8 +572,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
opt->tot_len = sizeof(struct ipv6_txoptions);
ipc6.opt = opt;
- err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, &ipc6,
- &sockc_unused);
+ err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, &ipc6);
if (err < 0) {
fl6_sock_release(flowlabel);
return err;
@@ -639,7 +637,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
err = ip6_append_data(sk, ip_generic_getfrag, msg,
ulen, transhdrlen, &ipc6,
&fl6, (struct rt6_info *)dst,
- msg->msg_flags, &sockc_unused);
+ msg->msg_flags);
if (err)
ip6_flush_pending_frames(sk);
else if (!(msg->msg_flags & MSG_MORE))
--
2.18.0.399.gad0ab374a1-goog
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox