1. 31 Oct, 2019 4 commits
    • Matteo Croce's avatar
      bonding: balance ICMP echoes in layer3+4 mode · 58deb77c
      Matteo Croce authored
      The bonding uses the L4 ports to balance flows between slaves. As the ICMP
      protocol has no ports, those packets are sent all to the same device:
      
          # tcpdump -qltnni veth0 ip |sed 's/^/0: /' &
          # tcpdump -qltnni veth1 ip |sed 's/^/1: /' &
          # ping -qc1 192.168.0.2
          1: IP 192.168.0.1 > 192.168.0.2: ICMP echo request, id 315, seq 1, length 64
          1: IP 192.168.0.2 > 192.168.0.1: ICMP echo reply, id 315, seq 1, length 64
          # ping -qc1 192.168.0.2
          1: IP 192.168.0.1 > 192.168.0.2: ICMP echo request, id 316, seq 1, length 64
          1: IP 192.168.0.2 > 192.168.0.1: ICMP echo reply, id 316, seq 1, length 64
          # ping -qc1 192.168.0.2
          1: IP 192.168.0.1 > 192.168.0.2: ICMP echo request, id 317, seq 1, length 64
          1: IP 192.168.0.2 > 192.168.0.1: ICMP echo reply, id 317, seq 1, length 64
      
      But some ICMP packets have an Identifier field which is
      used to match packets within sessions, let's use this value in the hash
      function to balance these packets between bond slaves:
      
          # ping -qc1 192.168.0.2
          0: IP 192.168.0.1 > 192.168.0.2: ICMP echo request, id 303, seq 1, length 64
          0: IP 192.168.0.2 > 192.168.0.1: ICMP echo reply, id 303, seq 1, length 64
          # ping -qc1 192.168.0.2
          1: IP 192.168.0.1 > 192.168.0.2: ICMP echo request, id 304, seq 1, length 64
          1: IP 192.168.0.2 > 192.168.0.1: ICMP echo reply, id 304, seq 1, length 64
      
      Aso, let's use a flow_dissector_key which defines FLOW_DISSECTOR_KEY_ICMP,
      so we can balance pings encapsulated in a tunnel when using mode encap3+4:
      
          # ping -q 192.168.1.2 -c1
          0: IP 192.168.0.1 > 192.168.0.2: GREv0, length 102: IP 192.168.1.1 > 192.168.1.2: ICMP echo request, id 585, seq 1, length 64
          0: IP 192.168.0.2 > 192.168.0.1: GREv0, length 102: IP 192.168.1.2 > 192.168.1.1: ICMP echo reply, id 585, seq 1, length 64
          # ping -q 192.168.1.2 -c1
          1: IP 192.168.0.1 > 192.168.0.2: GREv0, length 102: IP 192.168.1.1 > 192.168.1.2: ICMP echo request, id 586, seq 1, length 64
          1: IP 192.168.0.2 > 192.168.0.1: GREv0, length 102: IP 192.168.1.2 > 192.168.1.1: ICMP echo reply, id 586, seq 1, length 64
      Signed-off-by: default avatarMatteo Croce <mcroce@redhat.com>
      Reviewed-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      58deb77c
    • Matteo Croce's avatar
      flow_dissector: extract more ICMP information · 5dec597e
      Matteo Croce authored
      The ICMP flow dissector currently parses only the Type and Code fields.
      Some ICMP packets (echo, timestamp) have a 16 bit Identifier field which
      is used to correlate packets.
      Add such field in flow_dissector_key_icmp and replace skb_flow_get_be16()
      with a more complex function which populate this field.
      Signed-off-by: default avatarMatteo Croce <mcroce@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5dec597e
    • Matteo Croce's avatar
      flow_dissector: skip the ICMP dissector for non ICMP packets · 3b336d6f
      Matteo Croce authored
      FLOW_DISSECTOR_KEY_ICMP is checked for every packet, not only ICMP ones.
      Even if the test overhead is probably negligible, move the
      ICMP dissector code under the big 'switch(ip_proto)' so it gets called
      only for ICMP packets.
      Signed-off-by: default avatarMatteo Croce <mcroce@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3b336d6f
    • Matteo Croce's avatar
      flow_dissector: add meaningful comments · 98298e6c
      Matteo Croce authored
      Documents two piece of code which can't be understood at a glance.
      Signed-off-by: default avatarMatteo Croce <mcroce@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      98298e6c
  2. 30 Oct, 2019 34 commits
  3. 29 Oct, 2019 2 commits