Skip to content

Commit ea83a2f

Browse files
committed
lib: Show tunnel egress interface in ovsdb
This commit parses rtnetlink address notifications from the kernel in order to display the egress interface of tunnels in the database. Bug #4103.
1 parent 21d6e22 commit ea83a2f

14 files changed

Lines changed: 566 additions & 13 deletions

lib/automake.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ lib_libopenvswitch_a_SOURCES += \
191191
lib/rtnetlink.c \
192192
lib/rtnetlink.h \
193193
lib/rtnetlink-link.c \
194-
lib/rtnetlink-link.h
194+
lib/rtnetlink-link.h \
195+
lib/rtnetlink-route.c \
196+
lib/rtnetlink-route.h
195197
endif
196198

197199
if HAVE_OPENSSL

lib/netdev-dummy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ static const struct netdev_class dummy_class = {
320320
NULL, /* get_in6 */
321321
NULL, /* add_router */
322322
NULL, /* get_next_hop */
323+
NULL, /* get_tnl_iface */
323324
NULL, /* arp_lookup */
324325

325326
netdev_dummy_update_flags,

lib/netdev-linux.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,7 @@ netdev_linux_poll_remove(struct netdev_notifier *notifier_)
21762176
netdev_linux_get_in6, \
21772177
netdev_linux_add_router, \
21782178
netdev_linux_get_next_hop, \
2179+
NULL, /* get_tnl_iface */ \
21792180
netdev_linux_arp_lookup, \
21802181
\
21812182
netdev_linux_update_flags, \

lib/netdev-provider.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,17 @@ struct netdev_class {
518518
int (*get_next_hop)(const struct in_addr *host, struct in_addr *next_hop,
519519
char **netdev_name);
520520

521+
/* Looks up the name of the interface out of which traffic will egress if
522+
* 'netdev' is a tunnel. If unsuccessful, or 'netdev' is not a tunnel,
523+
* will return null. This function does not necessarily return the
524+
* physical interface out which traffic will egress. Instead it returns
525+
* the interface which is assigned 'netdev's remote_ip. This may be an
526+
* internal interface such as a bridge port.
527+
*
528+
* This function may be set to null if 'netdev' is not a tunnel or it is
529+
* not supported. */
530+
const char *(*get_tnl_iface)(const struct netdev *netdev);
531+
521532
/* Looks up the ARP table entry for 'ip' on 'netdev' and stores the
522533
* corresponding MAC address in 'mac'. A return value of ENXIO, in
523534
* particular, indicates that there is no ARP table entry for 'ip' on

0 commit comments

Comments
 (0)