Home
last modified time | relevance | path

Searched refs:skb (Results 1 - 7 of 7) sorted by relevance

/foundation/communication/netmanager_base/services/netmanagernative/bpf/include/netfirewall/
H A Dnetfirewall_utils.h53 * @brief judget given skb is a layler 4 protocol or not
55 * @param skb struct __sk_buff
60 static __always_inline bool is_l4_protocol(struct __sk_buff *skb, __u32 l3_nhoff, __u8 protocol) in is_l4_protocol() argument
62 if (skb->family == AF_INET) { in is_l4_protocol()
64 bpf_skb_load_bytes(skb, l3_nhoff, &iph, sizeof(struct iphdr)); in is_l4_protocol()
68 if (skb->family == AF_INET6) { in is_l4_protocol()
70 bpf_skb_load_bytes(skb, l3_nhoff, &ip6h, sizeof(struct ipv6hdr)); in is_l4_protocol()
82 * @param skb struct __sk_buff
85 static __always_inline __u32 get_l3_nhoff(struct __sk_buff *skb) in get_l3_nhoff() argument
94 * @param skb struc
97 get_l4_nhoff(struct __sk_buff *skb) get_l4_nhoff() argument
110 load_tcp_flags(struct __sk_buff *skb, __u32 l4_nhoff, union tcp_flags *flags) load_tcp_flags() argument
123 load_l4_protocol(const struct __sk_buff *skb, __u32 l3_nhoff, __u8 *protocol) load_l4_protocol() argument
151 load_l3_v4_addrs(const struct __sk_buff *skb, __u32 l3_nhoff, __be32 *saddr, __be32 *daddr) load_l3_v4_addrs() argument
175 load_l3_v6_addrs(const struct __sk_buff *skb, __u32 l3_nhoff, struct in6_addr *saddr, struct in6_addr *daddr) load_l3_v6_addrs() argument
201 load_icmp_info(const struct __sk_buff *skb, __u32 l4_nhoff, __u8 protocol, __u8 *type, __u8 *code) load_icmp_info() argument
238 load_l4_ports(const struct __sk_buff *skb, __u32 l4_nhoff, __u8 protocol, __be16 *sport, __be16 *dport) load_l4_ports() argument
271 load_l4_header_flags(const struct __sk_buff *skb, __u32 l4_nhoff, __u16 *rst) load_l4_header_flags() argument
[all...]
H A Dnetfirewall.h31 * @param tuple match tuple of skb meta data
32 * @param skb struct __sk_buff
36 static __always_inline int send_sock_tcp_reset(struct match_tuple *tuple, struct __sk_buff *skb, enum stream_dir dir) in send_sock_tcp_reset() argument
38 if (!skb || !tuple) { in send_sock_tcp_reset()
43 bpf_sock_tcp_send_reset(skb); in send_sock_tcp_reset()
45 return bpf_sock_destroy(skb); in send_sock_tcp_reset()
101 * @param skb struct __sk_buff
104 static __always_inline enum sk_action netfirewall_policy_ingress(struct __sk_buff *skb) in netfirewall_policy_ingress() argument
107 if (!get_match_tuple(skb, &tuple, INGRESS)) { in netfirewall_policy_ingress()
118 enum ct_status status = ct_lookup_entry(skb, in netfirewall_policy_ingress()
163 netfirewall_policy_egress(struct __sk_buff *skb) netfirewall_policy_egress() argument
[all...]
H A Dnetfirewall_match.h79 * @brief Get the match tuple from skb
81 * @param skb struct __sk_buff of packet
86 static __always_inline bool get_match_tuple(struct __sk_buff *skb, struct match_tuple *tuple, enum stream_dir dir) in get_match_tuple() argument
88 if (!skb || !tuple) { in get_match_tuple()
92 __u32 l3_nhoff = get_l3_nhoff(skb); in get_match_tuple()
93 __u32 l4_nhoff = get_l4_nhoff(skb); in get_match_tuple()
95 if (skb->family == AF_INET) { in get_match_tuple()
96 load_l3_v4_addrs(skb, l3_nhoff, &(tuple->ipv4.saddr), &(tuple->ipv4.daddr)); in get_match_tuple()
98 load_l3_v6_addrs(skb, l3_nhoff, &(tuple->ipv6.saddr), &(tuple->ipv6.daddr)); in get_match_tuple()
100 if (!load_l4_protocol(skb, l3_nhof in get_match_tuple()
[all...]
H A Dnetfirewall_ct.h131 * @param skb struct __sk_buff
135 static __always_inline bool ct_create_entry(struct ct_tuple *tuple, struct __sk_buff *skb, const enum ct_dir dir) in ct_create_entry() argument
152 * @param skb struct __sk_buff
157 static __always_inline enum ct_status ct_lookup_entry(struct __sk_buff *skb, const struct ct_tuple *tuple, in ct_lookup_entry() argument
162 __u32 l3_nhoff = get_l3_nhoff(skb); in ct_lookup_entry()
163 bool is_tcp = is_l4_protocol(skb, l3_nhoff, IPPROTO_TCP); in ct_lookup_entry()
166 __u32 l4_nhoff = get_l4_nhoff(skb); in ct_lookup_entry()
167 if (load_tcp_flags(skb, l4_nhoff, &seen_flags) < 0) { in ct_lookup_entry()
/foundation/communication/netmanager_base/bpf/bpf_progs/
H A Dnetstats.c77 static SEC("cgroup_skb/uid/ingress") int bpf_cgroup_skb_uid_ingress(struct __sk_buff *skb) in bpf_cgroup_skb_uid_ingress() argument
79 uint32_t sock_uid = bpf_get_socket_uid(skb); in bpf_cgroup_skb_uid_ingress()
90 __sync_fetch_and_add(&value->rx_bytes, skb->len); in bpf_cgroup_skb_uid_ingress()
98 static SEC("cgroup_skb/uid/egress") int bpf_cgroup_skb_uid_egress(struct __sk_buff *skb) in bpf_cgroup_skb_uid_egress() argument
100 uint32_t sock_uid = bpf_get_socket_uid(skb); in bpf_cgroup_skb_uid_egress()
111 __sync_fetch_and_add(&value->tx_bytes, skb->len); in bpf_cgroup_skb_uid_egress()
119 static SEC("socket/iface/ingress") void bpf_socket_iface_ingress(struct __sk_buff *skb) in bpf_socket_iface_ingress() argument
121 uint32_t key = skb->ifindex; in bpf_socket_iface_ingress()
132 __sync_fetch_and_add(&value->rx_bytes, skb->len); in bpf_socket_iface_ingress()
139 static SEC("socket/iface/egress") void bpf_socket_iface_egress(struct __sk_buff *skb) in bpf_socket_iface_egress() argument
[all...]
H A D464xlat.c21 static SEC("xlat/egress/ipv4/raw") int bpf_xlat_egress_ipv4_raw(struct __sk_buff *skb) { return 0; } in bpf_xlat_egress_ipv4_raw() argument
23 static SEC("xlat/ingress/ipv6/ether") int bpf_xlat_ingress_ipv6_ether(struct __sk_buff *skb) { return 0; } in bpf_xlat_ingress_ipv6_ether() argument
25 static SEC("xlat/ingress/ipv6/raw") int bpf_xlat_ingress_ipv6_raw(struct __sk_buff *skb) { return 0; } in bpf_xlat_ingress_ipv6_raw() argument
/foundation/communication/netmanager_base/services/netmanagernative/bpf/src/
H A Dnetsys.c87 static inline __u32 get_data_len(struct __sk_buff *skb) in get_data_len() argument
89 __u32 length = skb->len; in get_data_len()
90 if (skb->vlan_present == 1) { in get_data_len()
93 if (skb->family == AF_INET) { in get_data_len()
96 if (skb->family == AF_INET6) { in get_data_len()
103 int socket_iface_stats(struct __sk_buff *skb) in socket_iface_stats() argument
105 if (skb == NULL) { in socket_iface_stats()
109 if (skb->pkt_type == PACKET_LOOPBACK) { in socket_iface_stats()
113 uint64_t ifindex = skb->ifindex; in socket_iface_stats()
121 if (skb in socket_iface_stats()
255 bpf_cgroup_skb_uid_ingress(struct __sk_buff *skb) bpf_cgroup_skb_uid_ingress() argument
345 bpf_cgroup_skb_uid_egress(struct __sk_buff *skb) bpf_cgroup_skb_uid_egress() argument
[all...]

Completed in 4 milliseconds