module: network: monitor ethernet interfaces

State exposed (tag names):

* name: the interface name ("eth0" etc)
* index: the interface index, "ifindex"
* state: operational state (down, up etc)
* mac: the Ethernet hardware address
* ipv4: the *last* IPv4 address added to the interface
* ipv6: the *last* IPv6 address added to the interface

State we monitor (for changes):

* state
* ipv4 addresses
* ipv6 addresses
This commit is contained in:
Daniel Eklöf 2018-12-30 20:40:10 +01:00
parent c795718ad7
commit 4c4f0ce7a0
4 changed files with 413 additions and 0 deletions

View file

@ -22,6 +22,7 @@ pkg_check_modules(XCB_XKB REQUIRED xcb-xkb) # Module/xkb
pkg_check_modules(JSON REQUIRED json-c) # Module/i3
pkg_check_modules(UDEV REQUIRED libudev) # Module/battery
pkg_check_modules(MPD REQUIRED libmpdclient) # Module/mpd
pkg_check_modules(NL REQUIRED libnl-3.0 libnl-route-3.0) # Module/network
add_executable(f00bar
bar.c bar.h
@ -54,6 +55,7 @@ add_executable(f00bar
modules/i3.c modules/i3.h
modules/label.c modules/label.h
modules/mpd.c modules/mpd.h
modules/network.c modules/network.h
modules/xkb.c modules/xkb.h
modules/xwindow.c modules/xwindow.h
)
@ -68,6 +70,7 @@ target_compile_options(f00bar PRIVATE
${JSON_CFLAGS_OTHER}
${UDEV_CFLAGS_OTHER}
${MPD_CFLAGS_OTHER}
${NL_CFLAGS_OTHER}
)
target_include_directories(f00bar PRIVATE
@ -78,6 +81,7 @@ target_include_directories(f00bar PRIVATE
${JSON_INCLUDE_DIRS}
${UDEV_INCLUDE_DIRS}
${MPD_INCLUDE_DIRS}
${NL_INCLUDE_DIRS}
)
target_link_libraries(f00bar
@ -89,4 +93,5 @@ target_link_libraries(f00bar
${JSON_LIBRARIES}
${UDEV_LIBRARIES}
${MPD_LIBRARIES}
${NL_LIBRARIES}
)