24 Aug, 2018

1 commit

  • [ Upstream commit 38230a3e0e0933bbcf5df6fa469ba0667f667568 ]

    the control action in the common member of struct tcf_tunnel_key must be a
    valid value, as it can contain the chain index when 'goto chain' is used.
    Ensure that the control action can be read as x->tcfa_action, when x is a
    pointer to struct tc_action and x->ops->type is TCA_ACT_TUNNEL_KEY, to
    prevent the following command:

    # tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
    > $tcflags dst_mac $h2mac action tunnel_key unset goto chain 1

    from causing a NULL dereference when a matching packet is received:

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
    PGD 80000001097ac067 P4D 80000001097ac067 PUD 103b0a067 PMD 0
    Oops: 0000 [#1] SMP PTI
    CPU: 0 PID: 3491 Comm: mausezahn Tainted: G E 4.18.0-rc2.auguri+ #421
    Hardware name: Hewlett-Packard HP Z220 CMT Workstation/1790, BIOS K51 v01.58 02/07/2013
    RIP: 0010:tcf_action_exec+0xb8/0x100
    Code: 00 00 00 20 74 1d 83 f8 03 75 09 49 83 c4 08 4d 39 ec 75 bc 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 49 8b 97 a8 00 00 00 8b 12 48 89 55 00 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3
    RSP: 0018:ffff95145ea03c40 EFLAGS: 00010246
    RAX: 0000000020000001 RBX: ffff9514499e5800 RCX: 0000000000000001
    RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000000
    RBP: ffff95145ea03e60 R08: 0000000000000000 R09: ffff95145ea03c9c
    R10: ffff95145ea03c78 R11: 0000000000000008 R12: ffff951456a69800
    R13: ffff951456a69808 R14: 0000000000000001 R15: ffff95144965ee40
    FS: 00007fd67ee11740(0000) GS:ffff95145ea00000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000000 CR3: 00000001038a2006 CR4: 00000000001606f0
    Call Trace:

    fl_classify+0x1ad/0x1c0 [cls_flower]
    ? __update_load_avg_se.isra.47+0x1ca/0x1d0
    ? __update_load_avg_se.isra.47+0x1ca/0x1d0
    ? update_load_avg+0x665/0x690
    ? update_load_avg+0x665/0x690
    ? kmem_cache_alloc+0x38/0x1c0
    tcf_classify+0x89/0x140
    __netif_receive_skb_core+0x5ea/0xb70
    ? enqueue_entity+0xd0/0x270
    ? process_backlog+0x97/0x150
    process_backlog+0x97/0x150
    net_rx_action+0x14b/0x3e0
    __do_softirq+0xde/0x2b4
    do_softirq_own_stack+0x2a/0x40

    do_softirq.part.18+0x49/0x50
    __local_bh_enable_ip+0x49/0x50
    __dev_queue_xmit+0x4ab/0x8a0
    ? wait_woken+0x80/0x80
    ? packet_sendmsg+0x38f/0x810
    ? __dev_queue_xmit+0x8a0/0x8a0
    packet_sendmsg+0x38f/0x810
    sock_sendmsg+0x36/0x40
    __sys_sendto+0x10e/0x140
    ? do_vfs_ioctl+0xa4/0x630
    ? syscall_trace_enter+0x1df/0x2e0
    ? __audit_syscall_exit+0x22a/0x290
    __x64_sys_sendto+0x24/0x30
    do_syscall_64+0x5b/0x180
    entry_SYSCALL_64_after_hwframe+0x44/0xa9
    RIP: 0033:0x7fd67e18dc93
    Code: 48 8b 0d 18 83 20 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 59 c7 20 00 00 75 13 49 89 ca b8 2c 00 00 00 0f 05 3d 01 f0 ff ff 73 34 c3 48 83 ec 08 e8 2b f7 ff ff 48 89 04 24
    RSP: 002b:00007ffe0189b748 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
    RAX: ffffffffffffffda RBX: 00000000020ca010 RCX: 00007fd67e18dc93
    RDX: 0000000000000062 RSI: 00000000020ca322 RDI: 0000000000000003
    RBP: 00007ffe0189b780 R08: 00007ffe0189b760 R09: 0000000000000014
    R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000062
    R13: 00000000020ca322 R14: 00007ffe0189b760 R15: 0000000000000003
    Modules linked in: act_tunnel_key act_gact cls_flower sch_ingress vrf veth act_csum(E) xt_CHECKSUM iptable_mangle ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter intel_rapl snd_hda_codec_hdmi x86_pkg_temp_thermal intel_powerclamp snd_hda_codec_realtek coretemp snd_hda_codec_generic kvm_intel kvm irqbypass snd_hda_intel crct10dif_pclmul crc32_pclmul hp_wmi ghash_clmulni_intel pcbc snd_hda_codec aesni_intel sparse_keymap rfkill snd_hda_core snd_hwdep snd_seq crypto_simd iTCO_wdt gpio_ich iTCO_vendor_support wmi_bmof cryptd mei_wdt glue_helper snd_seq_device snd_pcm pcspkr snd_timer snd i2c_i801 lpc_ich sg soundcore wmi mei_me
    mei ie31200_edac nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c sd_mod sr_mod cdrom i915 video i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ahci crc32c_intel libahci serio_raw sfc libata mtd drm ixgbe mdio i2c_core e1000e dca
    CR2: 0000000000000000
    ---[ end trace 1ab8b5b5d4639dfc ]---
    RIP: 0010:tcf_action_exec+0xb8/0x100
    Code: 00 00 00 20 74 1d 83 f8 03 75 09 49 83 c4 08 4d 39 ec 75 bc 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 49 8b 97 a8 00 00 00 8b 12 48 89 55 00 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3
    RSP: 0018:ffff95145ea03c40 EFLAGS: 00010246
    RAX: 0000000020000001 RBX: ffff9514499e5800 RCX: 0000000000000001
    RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000000
    RBP: ffff95145ea03e60 R08: 0000000000000000 R09: ffff95145ea03c9c
    R10: ffff95145ea03c78 R11: 0000000000000008 R12: ffff951456a69800
    R13: ffff951456a69808 R14: 0000000000000001 R15: ffff95144965ee40
    FS: 00007fd67ee11740(0000) GS:ffff95145ea00000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000000 CR3: 00000001038a2006 CR4: 00000000001606f0
    Kernel panic - not syncing: Fatal exception in interrupt
    Kernel Offset: 0x11400000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
    ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---

    Fixes: d0f6dd8a914f ("net/sched: Introduce act_tunnel_key")
    Signed-off-by: Davide Caratti
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Davide Caratti
     

12 Apr, 2018

1 commit

  • [ Upstream commit abdadd3cfd3e7ea3da61ac774f84777d1f702058 ]

    when the following command

    # tc action add action tunnel_key unset index 100

    is run for the first time, and tunnel_key_init() fails to allocate struct
    tcf_tunnel_key_params, tunnel_key_release() dereferences NULL pointers.
    This causes the following error:

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
    IP: tunnel_key_release+0xd/0x40 [act_tunnel_key]
    PGD 8000000033787067 P4D 8000000033787067 PUD 74646067 PMD 0
    Oops: 0000 [#1] SMP PTI
    Modules linked in: act_tunnel_key(E) act_csum ip6table_filter ip6_tables iptable_filter binfmt_misc ext4 mbcache jbd2 crct10dif_pclmul crc32_pclmul snd_hda_codec_generic ghash_clmulni_intel snd_hda_intel pcbc snd_hda_codec snd_hda_core snd_hwdep snd_seq aesni_intel snd_seq_device crypto_simd glue_helper snd_pcm cryptd joydev snd_timer pcspkr virtio_balloon snd i2c_piix4 soundcore nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c ata_generic pata_acpi qxl drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm virtio_net virtio_blk drm virtio_console crc32c_intel ata_piix serio_raw i2c_core virtio_pci libata virtio_ring virtio floppy dm_mirror dm_region_hash dm_log dm_mod
    CPU: 2 PID: 3101 Comm: tc Tainted: G E 4.16.0-rc4.act_vlan.orig+ #403
    Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
    RIP: 0010:tunnel_key_release+0xd/0x40 [act_tunnel_key]
    RSP: 0018:ffffba46803b7768 EFLAGS: 00010286
    RAX: ffffffffc09010a0 RBX: 0000000000000000 RCX: 0000000000000024
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff99ee336d7480
    RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000044
    R10: 0000000000000220 R11: ffff99ee79d73131 R12: 0000000000000000
    R13: ffff99ee32d67610 R14: ffff99ee7671dc38 R15: 00000000fffffff4
    FS: 00007febcb2cd740(0000) GS:ffff99ee7fd00000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000010 CR3: 000000007c8e4005 CR4: 00000000001606e0
    Call Trace:
    __tcf_idr_release+0x79/0xf0
    tunnel_key_init+0xd9/0x460 [act_tunnel_key]
    tcf_action_init_1+0x2cc/0x430
    tcf_action_init+0xd3/0x1b0
    tc_ctl_action+0x18b/0x240
    rtnetlink_rcv_msg+0x29c/0x310
    ? _cond_resched+0x15/0x30
    ? __kmalloc_node_track_caller+0x1b9/0x270
    ? rtnl_calcit.isra.28+0x100/0x100
    netlink_rcv_skb+0xd2/0x110
    netlink_unicast+0x17c/0x230
    netlink_sendmsg+0x2cd/0x3c0
    sock_sendmsg+0x30/0x40
    ___sys_sendmsg+0x27a/0x290
    __sys_sendmsg+0x51/0x90
    do_syscall_64+0x6e/0x1a0
    entry_SYSCALL_64_after_hwframe+0x3d/0xa2
    RIP: 0033:0x7febca6deba0
    RSP: 002b:00007ffe7b0dd128 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
    RAX: ffffffffffffffda RBX: 00007ffe7b0dd250 RCX: 00007febca6deba0
    RDX: 0000000000000000 RSI: 00007ffe7b0dd1a0 RDI: 0000000000000003
    RBP: 000000005aaa90cb R08: 0000000000000002 R09: 0000000000000000
    R10: 00007ffe7b0dcba0 R11: 0000000000000246 R12: 0000000000000000
    R13: 00007ffe7b0dd264 R14: 0000000000000001 R15: 0000000000669f60
    Code: 44 00 00 8b 0d b5 23 00 00 48 8b 87 48 10 00 00 48 8b 3c c8 e9 a5 e5 d8 c3 0f 1f 44 00 00 0f 1f 44 00 00 53 48 8b 9f b0 00 00 00 7b 10 01 74 0b 48 89 df 31 f6 5b e9 f2 fa 7f c3 48 8b 7b 18
    RIP: tunnel_key_release+0xd/0x40 [act_tunnel_key] RSP: ffffba46803b7768
    CR2: 0000000000000010

    Fix this in tunnel_key_release(), ensuring 'param' is not NULL before
    dereferencing it.

    Fixes: d0f6dd8a914f ("net/sched: Introduce act_tunnel_key")
    Signed-off-by: Davide Caratti
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Davide Caratti
     

01 Apr, 2018

1 commit

  • [ Upstream commit 51d4740f88affd85d49c04e3c9cd129c0e33bcb9 ]

    If set/unset mode of the tunnel_key action is not provided, ->init() still
    returns 0, and the caller proceeds with bogus 'struct tc_action *' object,
    this results in crash:

    % tc actions add action tunnel_key src_ip 1.1.1.1 dst_ip 2.2.2.1 id 7 index 1

    [ 35.805515] general protection fault: 0000 [#1] SMP PTI
    [ 35.806161] Modules linked in: act_tunnel_key kvm_intel kvm irqbypass
    crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc aesni_intel aes_x86_64
    crypto_simd glue_helper cryptd serio_raw
    [ 35.808233] CPU: 1 PID: 428 Comm: tc Not tainted 4.16.0-rc4+ #286
    [ 35.808929] RIP: 0010:tcf_action_init+0x90/0x190
    [ 35.809457] RSP: 0018:ffffb8edc068b9a0 EFLAGS: 00010206
    [ 35.810053] RAX: 1320c000000a0003 RBX: 0000000000000001 RCX: 0000000000000000
    [ 35.810866] RDX: 0000000000000070 RSI: 0000000000007965 RDI: ffffb8edc068b910
    [ 35.811660] RBP: ffffb8edc068b9d0 R08: 0000000000000000 R09: ffffb8edc068b808
    [ 35.812463] R10: ffffffffc02bf040 R11: 0000000000000040 R12: ffffb8edc068bb38
    [ 35.813235] R13: 0000000000000000 R14: 0000000000000000 R15: ffffb8edc068b910
    [ 35.814006] FS: 00007f3d0d8556c0(0000) GS:ffff91d1dbc40000(0000)
    knlGS:0000000000000000
    [ 35.814881] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 35.815540] CR2: 000000000043f720 CR3: 0000000019248001 CR4: 00000000001606a0
    [ 35.816457] Call Trace:
    [ 35.817158] tc_ctl_action+0x11a/0x220
    [ 35.817795] rtnetlink_rcv_msg+0x23d/0x2e0
    [ 35.818457] ? __slab_alloc+0x1c/0x30
    [ 35.819079] ? __kmalloc_node_track_caller+0xb1/0x2b0
    [ 35.819544] ? rtnl_calcit.isra.30+0xe0/0xe0
    [ 35.820231] netlink_rcv_skb+0xce/0x100
    [ 35.820744] netlink_unicast+0x164/0x220
    [ 35.821500] netlink_sendmsg+0x293/0x370
    [ 35.822040] sock_sendmsg+0x30/0x40
    [ 35.822508] ___sys_sendmsg+0x2c5/0x2e0
    [ 35.823149] ? pagecache_get_page+0x27/0x220
    [ 35.823714] ? filemap_fault+0xa2/0x640
    [ 35.824423] ? page_add_file_rmap+0x108/0x200
    [ 35.825065] ? alloc_set_pte+0x2aa/0x530
    [ 35.825585] ? finish_fault+0x4e/0x70
    [ 35.826140] ? __handle_mm_fault+0xbc1/0x10d0
    [ 35.826723] ? __sys_sendmsg+0x41/0x70
    [ 35.827230] __sys_sendmsg+0x41/0x70
    [ 35.827710] do_syscall_64+0x68/0x120
    [ 35.828195] entry_SYSCALL_64_after_hwframe+0x3d/0xa2
    [ 35.828859] RIP: 0033:0x7f3d0ca4da67
    [ 35.829331] RSP: 002b:00007ffc9f284338 EFLAGS: 00000246 ORIG_RAX:
    000000000000002e
    [ 35.830304] RAX: ffffffffffffffda RBX: 00007ffc9f284460 RCX: 00007f3d0ca4da67
    [ 35.831247] RDX: 0000000000000000 RSI: 00007ffc9f2843b0 RDI: 0000000000000003
    [ 35.832167] RBP: 000000005aa6a7a9 R08: 0000000000000001 R09: 0000000000000000
    [ 35.833075] R10: 00000000000005f1 R11: 0000000000000246 R12: 0000000000000000
    [ 35.833997] R13: 00007ffc9f2884c0 R14: 0000000000000001 R15: 0000000000674640
    [ 35.834923] Code: 24 30 bb 01 00 00 00 45 31 f6 eb 5e 8b 50 08 83 c2 07 83 e2
    fc 83 c2 70 49 8b 07 48 8b 40 70 48 85 c0 74 10 48 89 14 24 4c 89 ff d0 48
    8b 14 24 48 01 c2 49 01 d6 45 85 ed 74 05 41 83 47 2c
    [ 35.837442] RIP: tcf_action_init+0x90/0x190 RSP: ffffb8edc068b9a0
    [ 35.838291] ---[ end trace a095c06ee4b97a26 ]---

    Fixes: d0f6dd8a914f ("net/sched: Introduce act_tunnel_key")
    Signed-off-by: Roman Mashak
    Acked-by: Cong Wang
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Roman Mashak
     

09 Nov, 2017

1 commit

  • This reverts commit ceffcc5e254b450e6159f173e4538215cebf1b59.
    If we hold that refcnt, the netns can never be destroyed until
    all actions are destroyed by user, this breaks our netns design
    which we expect all actions are destroyed when we destroy the
    whole netns.

    Cc: Lucas Bates
    Cc: Jamal Hadi Salim
    Cc: Jiri Pirko
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     

03 Nov, 2017

1 commit

  • TC actions have been destroyed asynchronously for a long time,
    previously in a RCU callback and now in a workqueue. If we
    don't hold a refcnt for its netns, we could use the per netns
    data structure, struct tcf_idrinfo, after it has been freed by
    netns workqueue.

    Hold refcnt to ensure netns destroy happens after all actions
    are gone.

    Fixes: ddf97ccdd7cb ("net_sched: add network namespace support for tc actions")
    Reported-by: Lucas Bates
    Tested-by: Lucas Bates
    Cc: Jamal Hadi Salim
    Cc: Jiri Pirko
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     

31 Aug, 2017

1 commit

  • Typically, each TC filter has its own action. All the actions of the
    same type are saved in its hash table. But the hash buckets are too
    small that it degrades to a list. And the performance is greatly
    affected. For example, it takes about 0m11.914s to insert 64K rules.
    If we convert the hash table to IDR, it only takes about 0m1.500s.
    The improvement is huge.

    But please note that the test result is based on previous patch that
    cls_flower uses IDR.

    Signed-off-by: Chris Mi
    Signed-off-by: Jiri Pirko
    Acked-by: Jamal Hadi Salim
    Signed-off-by: David S. Miller

    Chris Mi
     

16 Jun, 2017

2 commits

  • Allow requesting of zero UDP checksum for encapsulated packets. The name and
    meaning of the attribute is "NO_CSUM" in order to have the same meaning of
    the attribute missing and being 0.

    Signed-off-by: Jiri Benc
    Signed-off-by: David S. Miller

    Jiri Benc
     
  • There's currently no way to request (outer) UDP checksum with
    act_tunnel_key. This is problem especially for IPv6. Right now, tunnel_key
    action with IPv6 does not work without going through hassles: both sides
    have to have udp6zerocsumrx configured on the tunnel interface. This is
    obviously not a good solution universally.

    It makes more sense to compute the UDP checksum by default even for IPv4.
    Just set the default to request the checksum when using act_tunnel_key.

    Signed-off-by: Jiri Benc
    Signed-off-by: David S. Miller

    Jiri Benc
     

14 Apr, 2017

1 commit


24 Dec, 2016

1 commit


18 Nov, 2016

1 commit

  • Make struct pernet_operations::id unsigned.

    There are 2 reasons to do so:

    1)
    This field is really an index into an zero based array and
    thus is unsigned entity. Using negative value is out-of-bound
    access by definition.

    2)
    On x86_64 unsigned 32-bit data which are mixed with pointers
    via array indexing or offsets added or subtracted to pointers
    are preffered to signed 32-bit data.

    "int" being used as an array index needs to be sign-extended
    to 64-bit before being used.

    void f(long *p, int i)
    {
    g(p[i]);
    }

    roughly translates to

    movsx rsi, esi
    mov rdi, [rsi+...]
    call g

    MOVSX is 3 byte instruction which isn't necessary if the variable is
    unsigned because x86_64 is zero extending by default.

    Now, there is net_generic() function which, you guessed it right, uses
    "int" as an array index:

    static inline void *net_generic(const struct net *net, int id)
    {
    ...
    ptr = ng->ptr[id - 1];
    ...
    }

    And this function is used a lot, so those sign extensions add up.

    Patch snipes ~1730 bytes on allyesconfig kernel (without all junk
    messing with code generation):

    add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)

    Unfortunately some functions actually grow bigger.
    This is a semmingly random artefact of code generation with register
    allocator being used differently. gcc decides that some variable
    needs to live in new r8+ registers and every access now requires REX
    prefix. Or it is shifted into r12, so [r12+0] addressing mode has to be
    used which is longer than [r8]

    However, overall balance is in negative direction:

    add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)
    function old new delta
    nfsd4_lock 3886 3959 +73
    tipc_link_build_proto_msg 1096 1140 +44
    mac80211_hwsim_new_radio 2776 2808 +32
    tipc_mon_rcv 1032 1058 +26
    svcauth_gss_legacy_init 1413 1429 +16
    tipc_bcbase_select_primary 379 392 +13
    nfsd4_exchange_id 1247 1260 +13
    nfsd4_setclientid_confirm 782 793 +11
    ...
    put_client_renew_locked 494 480 -14
    ip_set_sockfn_get 730 716 -14
    geneve_sock_add 829 813 -16
    nfsd4_sequence_done 721 703 -18
    nlmclnt_lookup_host 708 686 -22
    nfsd4_lockt 1085 1063 -22
    nfs_get_client 1077 1050 -27
    tcf_bpf_init 1106 1076 -30
    nfsd4_encode_fattr 5997 5930 -67
    Total: Before=154856051, After=154854321, chg -0.00%

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: David S. Miller

    Alexey Dobriyan
     

10 Nov, 2016

3 commits


16 Sep, 2016

1 commit

  • Remove rcu_read_lock protection from tunnel_key_dump and use
    rtnl_dereference, dump operation is protected by rtnl lock.

    Also, remove rcu_read_lock from tunnel_key_release and use
    rcu_dereference_protected.

    Both operations are running exclusively and a writer couldn't modify
    t->params while those functions are executed.

    Fixes: 54d94fd89d90 ('net/sched: Introduce act_tunnel_key')
    Signed-off-by: Hadar Hen Zion
    Acked-by: John Fastabend
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Hadar Hen Zion
     

11 Sep, 2016

1 commit

  • This action could be used before redirecting packets to a shared tunnel
    device, or when redirecting packets arriving from a such a device.

    The action will release the metadata created by the tunnel device
    (decap), or set the metadata with the specified values for encap
    operation.

    For example, the following flower filter will forward all ICMP packets
    destined to 11.11.11.2 through the shared vxlan device 'vxlan0'. Before
    redirecting, a metadata for the vxlan tunnel is created using the
    tunnel_key action and it's arguments:

    $ tc filter add dev net0 protocol ip parent ffff: \
    flower \
    ip_proto 1 \
    dst_ip 11.11.11.2 \
    action tunnel_key set \
    src_ip 11.11.0.1 \
    dst_ip 11.11.0.2 \
    id 11 \
    action mirred egress redirect dev vxlan0

    Signed-off-by: Amir Vadai
    Signed-off-by: Hadar Hen Zion
    Reviewed-by: Shmulik Ladkani
    Acked-by: Jamal Hadi Salim
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Amir Vadai