Jamesits / linux-gre-keepalive

High-performance passive (a.k.a. reply-only) GRE keepalive support for Linux, written in eBPF/XDP.
GNU General Public License v2.0
54 stars 8 forks source link

Failed to simulate the keepalive packet #6

Open Tara8573 opened 11 months ago

Tara8573 commented 11 months ago

Thank you for your code! Actually, i encountered a question about gre proto. I use scapy to simulate the keepalive packet.

###[ IP ]###
  version   = 4
  ihl       = None
  tos       = 0x0
  len       = None
  id        = 1
  flags     =
  frag      = 0
  ttl       = 64
  proto     = gre
  chksum    = None
  src       = 192.168.122.219
  dst       = 192.168.122.105
  \options   \
###[ GRE ]###
     chksum_present= 0
     routing_present= 0
     key_present= 0
     seqnum_present= 0
     strict_route_source= 0
     recursion_control= 0
     flags     = 0
     version   = 0
     proto     = IPv4
###[ IP ]###
        version   = 4
        ihl       = None
        tos       = 0x0
        len       = None
        id        = 1
        flags     =
        frag      = 0
        ttl       = 64
        proto     = gre
        chksum    = None
        src       = 192.168.122.105
        dst       = 192.168.122.219
        \options   \
###[ GRE ]###
           chksum_present= 0
           routing_present= 0
           key_present= 0
           seqnum_present= 0
           strict_route_source= 0
           recursion_control= 0
           flags     = 0
           version   = 0
           proto     = 0x0
###[ Raw ]###
              load      = 'Keepalive Request for gre test'

But when debugging i found it with wrong proto.

          <idle>-0       [002] d.s.1 590924.419672: bpf_trace_printk: New packet

          <idle>-0       [002] dNs.1 590924.419691: bpf_trace_printk: Packet header dump:

          <idle>-0       [002] dNs.1 590924.419692: bpf_trace_printk: #0: 45

          <idle>-0       [002] dNs.1 590924.419692: bpf_trace_printk: #1: 0

          <idle>-0       [002] dNs.1 590924.419692: bpf_trace_printk: #2: 0

          <idle>-0       [002] dNs.1 590924.419693: bpf_trace_printk: #3: 36

          <idle>-0       [002] dNs.1 590924.419693: bpf_trace_printk: #4: 0

          <idle>-0       [002] dNs.1 590924.419693: bpf_trace_printk: #5: 1

          <idle>-0       [002] dNs.1 590924.419693: bpf_trace_printk: #6: 0

          <idle>-0       [002] dNs.1 590924.419694: bpf_trace_printk: #7: 0

          <idle>-0       [002] dNs.1 590924.419694: bpf_trace_printk: #8: 40

          <idle>-0       [002] dNs.1 590924.419694: bpf_trace_printk: #9: 2f

          <idle>-0       [002] dNs.1 590924.419695: bpf_trace_printk: #10: 4

          <idle>-0       [002] dNs.1 590924.419695: bpf_trace_printk: #11: 3

          <idle>-0       [002] dNs.1 590924.419695: bpf_trace_printk: #12: c0

          <idle>-0       [002] dNs.1 590924.419695: bpf_trace_printk: #13: a8

          <idle>-0       [002] dNs.1 590924.419696: bpf_trace_printk: #14: 7a

          <idle>-0       [002] dNs.1 590924.419696: bpf_trace_printk: #15: 69

          <idle>-0       [002] dNs.1 590924.419696: bpf_trace_printk: #16: c0

          <idle>-0       [002] dNs.1 590924.419696: bpf_trace_printk: #17: a8

          <idle>-0       [002] dNs.1 590924.419697: bpf_trace_printk: #18: 7a

          <idle>-0       [002] dNs.1 590924.419697: bpf_trace_printk: #19: db

          <idle>-0       [002] dNs.1 590924.419697: bpf_trace_printk: #20: 0

          <idle>-0       [002] dNs.1 590924.419697: bpf_trace_printk: #21: 0

          <idle>-0       [002] dNs.1 590924.419698: bpf_trace_printk: #22: 0

          <idle>-0       [002] dNs.1 590924.419698: bpf_trace_printk: #23: 0

          <idle>-0       [002] dNs.1 590924.419698: bpf_trace_printk: #24: 4b

          <idle>-0       [002] dNs.1 590924.419698: bpf_trace_printk: #25: 65

          <idle>-0       [002] dNs.1 590924.419699: bpf_trace_printk: #26: 65

          <idle>-0       [002] dNs.1 590924.419699: bpf_trace_printk: #27: 70

          <idle>-0       [002] dNs.1 590924.419699: bpf_trace_printk: #28: 61

          <idle>-0       [002] dNs.1 590924.419699: bpf_trace_printk: #29: 6c

          <idle>-0       [002] dNs.1 590924.419700: bpf_trace_printk: #30: 69

          <idle>-0       [002] dNs.1 590924.419700: bpf_trace_printk: #31: 76

          <idle>-0       [002] dNs.1 590924.419700: bpf_trace_printk: Outer GRE flags=0x0 proto=0

          <idle>-0       [002] dNs.1 590924.419701: bpf_trace_printk: Outer GRE bpf_htons=0x8 proto=0

          <idle>-0       [002] dNs.1 590924.419702: bpf_trace_printk: Inner GRE dataptr=144793918 proto=44 data_end=144793948

Could you help with this problem?