This patch add team interface activebackup mode support. As linux team use
genl netlink message, when we get a rtnl link change notify, we have to setup
a new genl socket and request the current active port.
v2: check nlmsg_len before copy rta_data
v3: a) Do not make rtnl_buf global as it may be freed by calling rtnl_close()
while we are using it in rtnl_link_status()
b) Reorder declarations of variables as reversed Christmas tree for
function rtnl_link_status()
c) remove rtnl_len
v4: Remove the first !rtnl_buf check in rtnl_link_status as it's alway true
v5: a) Re-order {nl, rtnl}_open and add function nl_close()
b) revert the v3_{a,c}, v4 changes, use nl_close to close genl fd
c) do not use len in get_team_active_iface() as it may mislead reader
v6: Return index at the end to fix fd leak in get_team_active_iface()
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Change the rtnl_get_ts_label() function to accept the name of the master
interface and the buffer for the slave interface directly instead of the
struct interface from config.h.
Also, rename the function to rtnl_get_ts_device().
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Update function rtnl_link_status to get bond slave info. Pass the slave index
to call back functions. i.e. port_link_status.
Also check the interface index of rtnl message in function rtnl_link_status.
Then we don't need to check it in port_link_status.
Add ifndef IFLA_BOND_MAX in case we build linuxptp on kernel before v3.13-rc1.
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
The previous function use general message and will dump all interfaces'
information. Now update with ifinfomsg so we could get specific interface's
information.
We still could get all interfaces' info if set device to NULL.
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
This patch adds a source module that implements RT netlink sockets
for the purpose of link monitoring. Unfortunately the netlink API
offers no possibility for per-port notification. Instead it
forces us to use a de-multiplexing pattern.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>