Skip to content

Commit

Permalink
Improve detection of struct bpf_timeval (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
catap authored Dec 19, 2024
1 parent 467b380 commit c9cdbcc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,19 @@ AC_CHECK_TYPES([sa_family_t], [], [],
]]
)

AC_CHECK_HEADERS([net/bpf.h])
AC_CHECK_TYPES([struct bpf_timeval], [], [],
[[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NET_BPF_H
#include <net/bpf.h>
#endif
]]
)

############## drop optimization flags if requested ################

# Should we disable optimization?
Expand Down
2 changes: 1 addition & 1 deletion src/tcpflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ inline const timeval &tvshift(struct timeval &tv,const struct timeval &tv_)
return tv;
}

#if __has_include("net/bpf.h")
#ifdef HAVE_STRUCT_BPF_TIMEVAL
inline const timeval &tvshift(struct timeval &tv,const struct bpf_timeval &tv_)
{
tv.tv_sec = tv_.tv_sec + datalink_tdelta;
Expand Down

0 comments on commit c9cdbcc

Please sign in to comment.