Commit Graph

11 Commits

Author SHA1 Message Date
James Prestwood 236211af60 rtnlutil: fix compiler error
src/rtnlutil.c: In function ‘rtnl_route_add’:
./ell/util.h:248:2: error: ‘rtmmsg’ may be used uninitialized in
	this function [-Werror=maybe-uninitialized]
2019-07-31 12:39:41 -05:00
Denis Kenzior be5219883c rtnlutil: Simplify error handling 2019-07-31 03:53:01 -05:00
Tim Kourt cce59ad7f1 rtnlutil: Add connected and gateway route API
The API allows to add connected and gateway routes to the main
routing table.

rtnl_route_ipv4_add_gateway() is equivalent to the following
example 'ip route' command:
ip route add default via 10.0.0.1 dev wlan0 proto dhcp src 10.0.0.2 metric 339

rtnl_route_ipv4_add_connected()  is equivalent to the following
example 'ip route' command:
sudo ip route add 10.0.0.0/24 dev wlan0 proto dhcp src 10.0.0.2 scope link

The 'ip route' output from the above commands looks as follows:

rtnl_route_ipv4_add_connected():
10.0.0.0/24 dev wlan0 proto dhcp scope link src 10.0.0.2

rtnl_route_ipv4_add_gateway():
default via 10.0.0.1 dev wlan0 proto dhcp src 10.0.0.2 metric 339
2019-07-31 03:49:35 -05:00
Tim Kourt 1c7e803dbb rtnlutil: Add utility to DUMP ipv4 routes 2019-07-21 07:04:32 -05:00
Tim Kourt 83db65e929 rtnlutil: Add utility to extract route attributes 2019-07-20 06:51:46 -05:00
Denis Kenzior ec38545a68 rtnlutil: Add utility to set MAC address 2019-07-02 15:47:05 -05:00
Denis Kenzior f0848cc44a rtnlutil: Don't use explicit_bzero
Use memset instead.  explicit_bzero should only be used when we're
wiping a secret just prior to the encopassing storage being freed.  The
compiler would usually optimize away the memset, leaving the secrets
around.

In rtnlutil we're simply zeroing the structure prior to filling it, so
the use of explicit_bzero is not needed and brings confusion to the
reader since no secrets are being wiped.
2019-06-26 10:43:38 -05:00
Tim Kourt 6aabd80051 rtnlutil: Utils to Add/Remove IPv4 addresses 2019-06-26 10:36:59 -05:00
Tim Kourt 1368851611 netconfig: Obtain all currently assigned IPv4 addresses 2019-06-26 10:27:27 -05:00
Tim Kourt f3f343c04b rtnlutil: Add parser for ifaddrmsg struct
Its purpose is to extract interface label, ip, and
broadcast addresses out of ifaddrmsg rntl message.
2019-06-26 10:26:26 -05:00
Tim Kourt 5104e6752f rtnlutil: Introduce rtnl utility
The rtnl utility will encapsulate a collection of functions for rtnl ops.
2019-05-06 13:21:15 -05:00