Skip to content
Snippets Groups Projects
Select Git revision
  • 16e5726269611b71c930054ffe9b858c1cea88eb
  • add-vdpu381-and-383-to-rkvdec
  • prepare-add-vdpu381-and-383-to-rkvdec
  • add-rkvdec2-driver-vdpu383-hevc
  • add-rkvdec2-driver-vdpu383
  • add-rkvdec2-driver-hevc
  • rkvdec-mov-to-structs
  • av1-fix-postproc-leak
  • add-rkvdec2-driver-iommu-422-10bits
  • patch-queue/jamba/trixie
  • hdmi-fix-1080p-rock4d-6.11
  • upstreaming/rk3576-rock4d-spi-v1
  • upstreaming/rk3576-rock4d-support-v5
  • upstreaming/rk3588-hdmi-audio-6
  • upstreaming/rk3576-rock4d-support-v3
  • upstreaming/rk3576-rock4d-support-v1
  • upstreaming/rk3576-rock4d-support
  • add-rkvdec2-driver-iommu
  • upstream/rk3576-rock-4d
  • rk3588-hdmi-audio-2
  • fix-rk3588-i2s-tdm-clocks
  • v6.3
  • v6.3-rc1
  • v6.2-rc1
  • v6.0-rc1
  • v5.19-rc3
  • v5.19-rc2
  • v5.19-rc1
  • v5.18
  • v5.18-rc7
  • v5.18-rc6
  • v5.18-rc5
  • v5.18-rc4
  • v5.18-rc3
  • v5.18-rc2
  • v5.18-rc1
  • v5.17
  • v5.17-rc8
  • v5.17-rc7
  • v5.17-rc6
  • v5.17-rc5
41 results

af_unix.c

Blame
  • Forked from hardware-enablement / Rockchip upstream enablement efforts / linux
    Source project has a limited visibility.
    parse_simple.c 1.27 KiB
    /* Copyright (c) 2016 Facebook
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of version 2 of the GNU General Public
     * License as published by the Free Software Foundation.
     */
    #define KBUILD_MODNAME "foo"
    #include <linux/ip.h>
    #include <linux/ipv6.h>
    #include <linux/in.h>
    #include <linux/tcp.h>
    #include <linux/udp.h>
    #include <uapi/linux/bpf.h>
    #include <net/ip.h>
    #include "bpf_helpers.h"
    
    #define DEFAULT_PKTGEN_UDP_PORT 9
    
    /* copy of 'struct ethhdr' without __packed */
    struct eth_hdr {
    	unsigned char   h_dest[ETH_ALEN];
    	unsigned char   h_source[ETH_ALEN];
    	unsigned short  h_proto;
    };
    
    SEC("simple")
    int handle_ingress(struct __sk_buff *skb)
    {
    	void *data = (void *)(long)skb->data;
    	struct eth_hdr *eth = data;
    	struct iphdr *iph = data + sizeof(*eth);
    	struct udphdr *udp = data + sizeof(*eth) + sizeof(*iph);
    	void *data_end = (void *)(long)skb->data_end;
    
    	/* single length check */
    	if (data + sizeof(*eth) + sizeof(*iph) + sizeof(*udp) > data_end)
    		return 0;
    
    	if (eth->h_proto != htons(ETH_P_IP))
    		return 0;
    	if (iph->protocol != IPPROTO_UDP || iph->ihl != 5)
    		return 0;
    	if (ip_is_fragment(iph))
    		return 0;
    	if (udp->dest == htons(DEFAULT_PKTGEN_UDP_PORT))
    		return TC_ACT_SHOT;
    	return 0;
    }
    char _license[] SEC("license") = "GPL";