Skip to content

IPVS Network Name Space aware

[email protected] lvs-devel netdev netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest22 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/22IPVS: netns, add basic init per netns.include/net/ip_vs.h include/net/net_namespace.h include/net/netns/ip_vs.h +10 more+357 -352 replies
2/22IPVS: netns to services part 1include/net/ip_vs.h include/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_conn.c +6 more+207 -1112 replies
3/22IPVS: netns awarness to lblcr shedulerinclude/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_lblcr.c+39 -170 replies
4/22IPVS: netns awarness to lblc shedulerinclude/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_lblc.c+37 -160 replies
5/22IPVS: netns, prepare protocolinclude/net/ip_vs.h include/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_proto.c+88 -10 replies
6/22IPVS: netns preparation for proto_tcpinclude/net/ip_vs.h include/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_ftp.c +2 more+83 -530 replies
7/22IPVS: netns preparation for proto_udpinclude/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_proto.c net/netfilter/ipvs/ip_vs_proto_udp.c+54 -430 replies
8/22IPVS: netns preparation for proto_sctpinclude/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_proto.c net/netfilter/ipvs/ip_vs_proto_sctp.c+70 -640 replies
9/22IPVS: netns preparation for proto_ah_espnet/netfilter/ipvs/ip_vs_proto.c net/netfilter/ipvs/ip_vs_proto_ah_esp.c+10 -160 replies
10/22IPVS: netns, use ip_vs_proto_data as param.include/net/ip_vs.h net/netfilter/ipvs/ip_vs_conn.c net/netfilter/ipvs/ip_vs_core.c +6 more+125 -1040 replies
11/22IPVS: netns, common protocol changes and use of appcnt.include/net/ip_vs.h net/netfilter/ipvs/ip_vs_conn.c net/netfilter/ipvs/ip_vs_proto_sctp.c +3 more+39 -380 replies
12/22IPVS: netns awareness to ip_vs_appinclude/net/ip_vs.h include/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_app.c +4 more+75 -580 replies
13/22IPVS: netns awareness to ip_vs_estinclude/net/ip_vs.h include/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_ctl.c +1 more+65 -500 replies
14/22IPVS: netns awareness to ip_vs_syncinclude/net/ip_vs.h include/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_core.c +2 more+235 -1892 replies
15/22IPVS: netns, ip_vs_stats and its procfsinclude/net/ip_vs.h include/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_core.c +2 more+166 -340 replies
16/22IPVS: netns, connection hash got net as param.include/net/ip_vs.h include/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_conn.c +8 more+153 -830 replies
17/22IPVS: netns, ip_vs_ctl local vars moved to ipvs struct.include/net/ip_vs.h include/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_conn.c +6 more+227 -1800 replies
18/22IPVS: netns, defense work timer.include/net/ip_vs.h include/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_conn.c +2 more+17 -110 replies
19/22IPVS: netns, trash handlinginclude/net/ip_vs.h include/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_ctl.c+15 -150 replies
20/22IPVS: netns, svc counters moved in ip_vs_ctl,cinclude/net/netns/ip_vs.h net/netfilter/ipvs/ip_vs_ctl.c+13 -120 replies
21/22IPVS: netns, misc init_net removal in core.net/netfilter/ipvs/ip_vs_core.c net/netfilter/ipvs/ip_vs_ctl.c+9 -60 replies
22/22IPVS: netns, final patch enabling network name space.net/netfilter/ipvs/ip_vs_app.c net/netfilter/ipvs/ip_vs_conn.c net/netfilter/ipvs/ip_vs_core.c +4 more+1 -320 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [*v3 PATCH 00/22] IPVS Network Name Space aware

From: Hans Schillstrom <[email protected]>

This patch series adds network name space support to the LVS.

REVISION

This is version 3

OVERVIEW

The patch doesn't remove or add any functionality except for netns. For users that don't use network name space (netns) this patch is completely transparent.

Now it's possible to run LVS in a Linux container (see lxc-tools) i.e. a light weight visualization. For example it's possible to run one or several lvs on a real server in their own network name spaces. From the LVS point of view it looks like it runs on it's own machine.

IMPLEMENTATION
Basic requirements for netns awareness
- Global variables has to be moved to dyn. allocated memory.
- No or very little performance loss

Large hash tables connection hash and service hashes still resides in global memory with net ptr added in hash key.
Most global variables now resides in a struct ipvs { } in netns/ip_vs.h. The size of per name space is 2096 bytes (for x86_64) and a little bit less for 32 bit arch's.

Statistics counters is now lock-free i.e. incremented per CPU, The estimator does a sum when using it.

Procfs: ip_vs_stats_percpu is added to reflect the "per cpu" ex.

# cat /proc/net/ip_vs_stats
       Total Incoming Outgoing         Incoming         Outgoing
CPU    Conns  Packets  Packets            Bytes            Bytes
  0        0        3        1               9D               34
  1        0        1        2               49               70
  2        0        1        2               34               76
  3        1        2        2               70               74
  ~        1        7        7              18A              18E

Conns/s Pkts/s Pkts/s Bytes/s Bytes/s
0 0 0 0 0

Algorithm files are untouched except for lblc and lblcr.

STEP BY STEP
First patch creates network name space init for all files that need it. How ever if a new name space is created an error is returned. This will be removed in the last patch.

When net ptr ain't available init_net will be used temporarily.

CHANGES

*v2
The patches is totally reworked so each patch compile ... Depends on the IPv6 and Persistence Backup patch.
Common hash-table per name-space for connections and services Stats per CPU
smaller changes in lblc and lblcr
Triggered by Julians comment:
"tcp_timeout_change should work with the new struct ip_vs_proto_data
so that tcp_state_table will go to pd->state_table and set_tcp_state will get pd instead of pp"

*v3
Changes triggered by comment mostly, see individual patches for details.

procfs ip_vs_stats remains the same, ip_vs_stats_percpu added instead. Unused functions removed.
The pp -> pd conversion should start from functions like ip_vs_out().... Timer per ns instead of a common timer in estimator.
Moved net compare to the end in "fast path"
__ip_vs_mutex remains global

PATCH SET
This patch set is based upon lvs-test-2.6 / v2.6.37-rc1 and depends upon IPVS sync patches

STATUS
untested protos
- sctp
- esp_ah
and SIP for IPv6

SUMMARY

 include/net/ip_vs.h                     |  248 +++++++---
 include/net/net_namespace.h             |    2 +
 include/net/netns/ip_vs.h               |  146 ++++++
 net/netfilter/ipvs/ip_vs_app.c          |  101 +++--
 net/netfilter/ipvs/ip_vs_conn.c         |  159 ++++---
 net/netfilter/ipvs/ip_vs_core.c         |  228 ++++++---
 net/netfilter/ipvs/ip_vs_ctl.c          |  826 ++++++++++++++++++-------------
 net/netfilter/ipvs/ip_vs_est.c          |  131 ++++--
 net/netfilter/ipvs/ip_vs_ftp.c          |   56 ++-
 net/netfilter/ipvs/ip_vs_lblc.c         |   66 +++-
 net/netfilter/ipvs/ip_vs_lblcr.c        |   70 +++-
 net/netfilter/ipvs/ip_vs_nfct.c         |    6 +-
 net/netfilter/ipvs/ip_vs_proto.c        |  121 +++++-
 net/netfilter/ipvs/ip_vs_proto_ah_esp.c |   45 +-
 net/netfilter/ipvs/ip_vs_proto_sctp.c   |  144 +++---
 net/netfilter/ipvs/ip_vs_proto_tcp.c    |  133 +++---
 net/netfilter/ipvs/ip_vs_proto_udp.c    |  102 ++--
 net/netfilter/ipvs/ip_vs_sync.c         |  422 +++++++++-------
 net/netfilter/xt_ipvs.c                 |    2 +-
 19 files changed, 1960 insertions(+), 1048 deletions(-)