Skip to content

Commit 9abee7c

Browse files
author
lec-bit
committed
optimize
Signed-off-by: lec-bit <[email protected]>
1 parent 5ba7c6e commit 9abee7c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bpf/kmesh/ads/cgroup_sock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static inline int sock4_traffic_control(struct bpf_sock_addr *ctx)
5050
return 0;
5151
}
5252
#endif
53-
ret = listener_manager(ctx, listener, ctx);
53+
ret = listener_manager(ctx, listener, NULL);
5454
if (ret != 0) {
5555
BPF_LOG(ERR, KMESH, "listener_manager failed, ret %d\n", ret);
5656
}

bpf/kmesh/ads/include/route_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ static inline Route__RouteConfiguration *map_lookup_route_config(const char *rou
2828
return kmesh_map_lookup_elem(&map_of_router_config, route_name);
2929
}
3030

31-
static inline int virtual_host_match_check(
32-
Route__VirtualHost *virt_host, char *addr, ctx_buff_t *ctx, char *host_key, int host_key_len)
31+
static inline int
32+
virtual_host_match_check(Route__VirtualHost *virt_host, char *addr, ctx_buff_t *ctx, char *host_key, int host_key_len)
3333
{
3434
int i;
3535
void *domains = NULL;
@@ -56,7 +56,7 @@ static inline int virtual_host_match_check(
5656
if (((char *)domain)[0] == '*' && ((char *)domain)[1] == '\0')
5757
return 1;
5858

59-
if (bpf_km_header_strnstr(ctx, host_key, host_key_len, domain, BPF_DATA_MAX_LEN) != 0) {
59+
if (bpf_km_header_strnstr(ctx, host_key, host_key_len, domain, BPF_DATA_MAX_LEN)) {
6060
return 1;
6161
} else {
6262
if (bpf__strncmp(addr, BPF_DATA_MAX_LEN, domain) == 0) {
@@ -222,7 +222,7 @@ virtual_host_route_match_check(Route__Route *route, address_t *addr, ctx_buff_t
222222
if (!prefix)
223223
return 0;
224224

225-
if (bpf_km_header_strnstr(ctx, uri, uri_len, prefix, BPF_DATA_MAX_LEN) == 0) {
225+
if (!bpf_km_header_strnstr(ctx, uri, uri_len, prefix, BPF_DATA_MAX_LEN)) {
226226
return 0;
227227
}
228228

0 commit comments

Comments
 (0)