Skip to content

Commit

Permalink
Compile pcap by attributes not lib versions Add libnl3 include dir
Browse files Browse the repository at this point in the history
  • Loading branch information
dragorn committed Mar 6, 2013
1 parent 6988dca commit fbb613b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions configure.in
Expand Up @@ -445,6 +445,7 @@ linux)
AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x]) AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE]) AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api]) AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
V_INCLS="$V_INCLS -I/usr/include/libnl3"
have_any_nl="yes" have_any_nl="yes"
]) ])


Expand Down
8 changes: 4 additions & 4 deletions pcap-linux.c
Expand Up @@ -478,7 +478,7 @@ get_mac80211_phydev(pcap_t *handle, const char *device, char *phydev_path,
return 1; return 1;
} }


#ifdef HAVE_LIBNL_2_x #ifdef HAVE_LIBNL_SOCKETS
#define get_nl_errmsg nl_geterror #define get_nl_errmsg nl_geterror
#else #else
/* libnl 2.x compatibility code */ /* libnl 2.x compatibility code */
Expand Down Expand Up @@ -509,7 +509,7 @@ __genl_ctrl_alloc_cache(struct nl_handle *h, struct nl_cache **cache)
return 0; return 0;
} }
#define genl_ctrl_alloc_cache __genl_ctrl_alloc_cache #define genl_ctrl_alloc_cache __genl_ctrl_alloc_cache
#endif /* !HAVE_LIBNL_2_x */ #endif /* !HAVE_LIBNL_SOCKETS */


struct nl80211_state { struct nl80211_state {
struct nl_sock *nl_sock; struct nl_sock *nl_sock;
Expand Down Expand Up @@ -594,7 +594,7 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,


err = nl_send_auto_complete(state->nl_sock, msg); err = nl_send_auto_complete(state->nl_sock, msg);
if (err < 0) { if (err < 0) {
#ifdef HAVE_LIBNL_2_x #if defined HAVE_LIBNL_NLE
if (err == -NLE_FAILURE) { if (err == -NLE_FAILURE) {
#else #else
if (err == -ENFILE) { if (err == -ENFILE) {
Expand Down Expand Up @@ -622,7 +622,7 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
} }
err = nl_wait_for_ack(state->nl_sock); err = nl_wait_for_ack(state->nl_sock);
if (err < 0) { if (err < 0) {
#ifdef HAVE_LIBNL_2_x #if defined HAVE_LIBNL_NLE
if (err == -NLE_FAILURE) { if (err == -NLE_FAILURE) {
#else #else
if (err == -ENFILE) { if (err == -ENFILE) {
Expand Down

0 comments on commit fbb613b

Please sign in to comment.