linux/tools/testing/selftests/bpf/progs/test_xdp_redirect.c
<<
>>
Prefs
   1/* Copyright (c) 2017 VMware
   2 *
   3 * This program is free software; you can redistribute it and/or
   4 * modify it under the terms of version 2 of the GNU General Public
   5 * License as published by the Free Software Foundation.
   6 *
   7 * This program is distributed in the hope that it will be useful, but
   8 * WITHOUT ANY WARRANTY; without even the implied warranty of
   9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10 * General Public License for more details.
  11 */
  12#include <linux/bpf.h>
  13#include <bpf/bpf_helpers.h>
  14
  15SEC("redirect_to_111")
  16int xdp_redirect_to_111(struct xdp_md *xdp)
  17{
  18        return bpf_redirect(111, 0);
  19}
  20SEC("redirect_to_222")
  21int xdp_redirect_to_222(struct xdp_md *xdp)
  22{
  23        return bpf_redirect(222, 0);
  24}
  25
  26char _license[] SEC("license") = "GPL";
  27