mptcp: Do not send the remove-addr twice on the master-socket

When removing the IP from a master-sk and the socket is owned by the
user, we end up in full_mesh_release_sock. There, we iterate over the
sockets and check if the IP is still there. If not, we remove it.

The loc_id of tcp_sk(sk)->mptcp is the local address-id, set to 0 on the
master-sk. As this check mpcb->master_sk == sk returns true, we actually
already did call update_remove_address with 0 as loc_id.

So, we can avoid this double-call.

Fixes: c31d21d039d (Modularize the path-manager)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Fix fullmesh path-manager address removal

There were still some issues.

First, update_remove_addrs with addr_id 0 on a master-sk is wrong.
Because, it will also update announced_v4_addrs - which will then be set
incorrectly.

Then, this "if (!found)" should have been the opposite. If we found a
subflow, there is no need to call again update_remove_addrs.

So, we fix this by splitting update_remove_addrs in two.

First, announce_remove_addr, which based on the loc_id will announce the
remove-addr message.

Second, update_addr_bitfields, which does a simple & with loc4_bits to
update the bitfields.

Fixes:a6f8c5ab66cf (mptcp: Handle address-events differently)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Use inet_rcv_saddr and rcv_saddr for /proc/net/mptcp

This patch alters inet_saddr/saddr to inet_rcv_saddr/rcv_saddr to get
source address for /proc/net/mptcp.

That's the way it is done in get_tcp4_sock and get_tcp6_sock.

Fixes: 5ad9689e4b6f8 (Update /proc/net/mptcp_pm to be like /proc/net/tcp)
Signed-off-by: Kenjiro Nakayama <nakayamakenjiro@gmail.com>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Cleanup

Nothing spectacular.

Depends-on: 2c005d97569 (mptcp: Support 8 local addresses)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Handle removal of remote addresses in the path-manager

Adding a new callback to the path-manager allows to handle the removal
in there.

One step to handle all addresses in the path-manager.

Depends-on: 8ee987ac0ada7 (mptcp: Cleanup)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Handle addition of remote address in the path-manager

Adding addresses is now handled in the path-manager. Mostly trivial
code-moving to the path-manager.

One significant change in mptcp_v4/6_do_rcv(). We do not need to add the
address in the address-list upon a join.
It is not necessary, as we do not support the server sending SYN+JOIN.
For subflow-removal we anyways still store the address-id/subflow-id on
a per-subflow basis. So, we really do not need to track the
remote-address/address-id announcments through implict SYN+JOIN.

One step to handle all addresses in the path-manager.

Depends-on: 8ee987ac0ada7 (mptcp: Cleanup)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Handle adding init addrbit in the path-manager

Mostly moving code around.

One more step to make the remote-address handling fully done by the
path-manager.

Depends-on: 8ee987ac0ada7 (mptcp: Cleanup)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Reduce mptcp_update_metasocket to its minimum

We now do all the remote-address handling in the path-manager.
So, we can move all the code of mptcp_update_metasocket to the
respective path-manager.

Depends-on: 9f978be4275c (mptcp: Handle adding init addrbit in the path-manager)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Don't access remaddr4 in the ndiffports path manager

This will allow us to simplify mptcp_rem4 as we move it slowly to the
path-manager.

Depends-on: 2ac4542f96e6 (mptcp: Reduce mptcp_update_metasocket to its minimum)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
mptcp: Move remaddr4/6 to the fullmesh path-manager

Now, the whole remote-address management is in the path-manager.

Although we increase MPTCP_PM_SIZE, struct mptcp_cb does not increase.
It actually shrinks, because we could reorder some fields.

Before:
        /* size: 1128, cachelines: 18, members: 44 */
        /* sum members: 1097, holes: 7, sum holes: 27 */
        /* bit holes: 1, sum bit holes: 5 bits */
        /* padding: 4 */
        /* last cacheline: 40 bytes */

After:
        /* size: 1120, cachelines: 18, members: 40 */
        /* sum members: 1095, holes: 5, sum holes: 21 */
        /* bit holes: 1, sum bit holes: 5 bits */
        /* padding: 4 */
        /* last cacheline: 32 bytes */

Further, as the remote addresses are now part of the path-manager we
will be able to get rid of retry_bitfield, further shrinking mptcp_cb.

Depends-on: 1cde1cf960 (mptcp: Don't access remaddr4 in the ndiffports path manager)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>