xdp-project / xdp-tools

Utilities and example programs for use with XDP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to add bpf_ktime_get_boot_ns() into xdp-filter.c?

kolinfluence opened this issue · comments

@tohojo how to add bpf_ktime_get_boot_ns() into xdp-filter.c?
it works in xdp-filter/xdpfilt_prog.h but not xdp-filter.c

		values[0] += bpf_ktime_get_boot_ns();
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdbool.h>
#include <unistd.h>
#include <fcntl.h>
#include <inttypes.h>

#include <bpf/bpf.h>
#include <bpf/libbpf.h>
#include <xdp/libxdp.h>
#include <arpa/inet.h>

#include <linux/if_ether.h>

#include "params.h"
#include "logging.h"
#include "util.h"
#include "stats.h"
#include "common_kern_user.h"
#include "prog_features.h"
xdp-filter.c: In function ‘map_set_flags’:
xdp-filter.c:179:32: error: implicit declaration of function ‘bpf_ktime_get_boot_ns’ [-Werror=implicit-function-declaration]
  179 |                 values[0] += ((bpf_ktime_get_boot_ns()/86400) << COUNTER_SHIFT);
      |                                ^~~~~~~~~~~~~~~~~~~~~
xdp-filter.c: At top level:
xdp-filter.c:1137:1: fatal error: error writing to /tmp/ccBbARvZ.s: No space left on device
 1137 | }