AC_CHECK_DECL([BPF_OBJ_NAME_LEN],
[have_bpf_obj_name_len=yes], [have_bpf_obj_name_len=no],
[#include <linux/bpf.h>])
+AC_CHECK_DECL([BPF_TAG_SIZE],
+ [have_bpf_tag_size=yes], [have_bpf_tag_size=no],
+ [#include <linux/bpf.h>])
AC_CHECK_DECL([TIOCGLCKTRMIOS],
[have_tiocglcktrmios=yes], [have_tiocglcktrmios=no],
UL_REQUIRES_BUILD([lsfd], [libsmartcols])
UL_REQUIRES_HAVE([lsfd], [linux_bpf_h], [linux/bpf.h header file])
UL_REQUIRES_HAVE([lsfd], [bpf_obj_name_len], [BPF_OBJ_NAME_LEN macro in linux/bpf.h])
+UL_REQUIRES_HAVE([lsfd], [bpf_tag_size], [BPF_TAG_SIZE macro in linux/bpf.h])
AM_CONDITIONAL([BUILD_LSFD], [test "x$build_lsfd" = xyes])
AC_ARG_ENABLE([lslogins],
BPF-PROG.ID <``number``>::
Bpf program ID.
+BPF-PROG.TAG <``string``>::
+Bpf program TAG.
+
BPF-PROG.TYPE <``string``>::
Decoded name of bpf program type.
id=_BPF-MAP.ID_ type=_BPF-MAP.TYPE_[ name=_BPF.NAME_]
+
bpf-prog:::
-id=_BPF-PROG.ID_ type=_BPF-PROG.TYPE_[ name=_BPF.NAME_]
+id=_BPF-PROG.ID_ type=_BPF-PROG.TYPE_ tag= _BPF-PROG.TAG_ [ name=_BPF.NAME_]
+
eventpoll:::
tfds=_EVENTPOLL.TFDS_
[COL_BPF_PROG_ID] = { "BPF-PROG.ID",
0, SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER,
N_("bpf program id associated with the fd") },
+ [COL_BPF_PROG_TAG] = { "BPF-PROG.TAG",
+ 0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
+ N_("bpf program tag") },
[COL_BPF_PROG_TYPE] = { "BPF-PROG.TYPE",
0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
N_("bpf program type (decoded)") },
COL_BPF_MAP_TYPE_RAW,
COL_BPF_NAME,
COL_BPF_PROG_ID,
+ COL_BPF_PROG_TAG,
COL_BPF_PROG_TYPE,
COL_BPF_PROG_TYPE_RAW,
COL_CHRDRV,
int type;
int id;
char name[BPF_OBJ_NAME_LEN + 1];
+#define BPF_TAG_SIZE_AS_STRING (BPF_TAG_SIZE * 2)
+ char tag[BPF_TAG_SIZE_AS_STRING + 1];
};
static bool anon_bpf_prog_probe(const char *str)
case COL_BPF_PROG_ID:
xasprintf(str, "%d", data->id);
return true;
+ case COL_BPF_PROG_TAG:
+ *str = xstrdup(data->tag);
+ return true;
case COL_BPF_PROG_TYPE_RAW:
xasprintf(str, "%d", data->type);
return true;
else
xasprintf(&str, "id=%d type=UNKNOWN(%d)", data->id, data->type);
+ if (data->tag[0] != '\0')
+ xstrfappend(&str, " tag=%s", data->tag);
+
if (*data->name)
xstrfappend(&str, " name=%s", data->name);
data->type = -1;
data->id = -1;
data->name[0] = '\0';
+ data->tag[0] = '\0';
unkn->anon_data = data;
}
return 1;
}
+ if (strcmp(key, "prog_tag") == 0) {
+ char *dst = ((struct anon_bpf_prog_data *)unkn->anon_data)->tag;
+ strncpy(dst, value, BPF_TAG_SIZE_AS_STRING);
+ dst[BPF_TAG_SIZE_AS_STRING] = '\0';
+ return 1;
+ }
+
return 0;
}
)
opt = not get_option('build-lsfd').require(lib_rt.found()).disabled() \
- and cc.has_header_symbol('linux/bpf.h', 'BPF_OBJ_NAME_LEN')
+ and cc.has_header_symbol('linux/bpf.h', 'BPF_OBJ_NAME_LEN') \
+ and cc.has_header_symbol('linux/bpf.h', 'BPF_TAG_SIZE')
exe = executable(
'lsfd',
lsfd_sources, errnos_h,