Skip to content

Commit

Permalink
Add linux capabilities dependency to cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuele-f committed May 24, 2020
1 parent a014f5a commit 5044fcd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ target_link_libraries(example_edge_embed n2n)
add_executable(example_sn_embed example_sn_embed.c)
target_link_libraries(example_sn_embed n2n)

# Linux Capabilities
find_library(CAP_LIB cap)
if(CAP_LIB)
target_link_libraries(edge cap)
set(CMAKE_REQUIRED_LIBRARIES ${CAP_LIB})
ADD_DEFINITIONS("-DHAVE_LIBCAP")
endif()

install(TARGETS edge supernode
RUNTIME DESTINATION sbin
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion edge_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2063,7 +2063,7 @@ static char* route_cmd_to_str(int cmd, const n2n_route_t *route, char *buf, size

/* Adapted from https://olegkutkov.me/2019/08/29/modifying-linux-network-routes-using-netlink/ */
#define NLMSG_TAIL(nmsg) \
((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
((struct rtattr *) (((char *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))

/* Add new data to rtattr */
static int rtattr_add(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen)
Expand Down

0 comments on commit 5044fcd

Please sign in to comment.