From 0efaf4b50c99bfdc255a27bb55312744feb34cc6 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 23 Jul 2009 12:18:14 -0700 Subject: [PATCH] netdev: Add 'netdev' parameter to netdev_add_router(). When there is the possibility of multiple classes of netdevs, netdev_add_router() needs to know which of these to use, so it needs a "struct netdev *" parameter. --- lib/dhcp-client.c | 2 +- lib/netdev.c | 5 +++-- lib/netdev.h | 2 +- vswitchd/bridge.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/dhcp-client.c b/lib/dhcp-client.c index a9163c78..c8ae00e0 100644 --- a/lib/dhcp-client.c +++ b/lib/dhcp-client.c @@ -411,7 +411,7 @@ dhclient_configure_netdev(struct dhclient *cli) } if (!error && router.s_addr) { - error = netdev_add_router(router); + error = netdev_add_router(cli->netdev, router); if (error) { VLOG_ERR("failed to add default route to "IP_FMT" on %s: %s", IP_ARGS(&router), netdev_get_name(cli->netdev), diff --git a/lib/netdev.c b/lib/netdev.c index 903d14cf..701bb53e 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -879,9 +879,10 @@ netdev_set_in4(struct netdev *netdev, struct in_addr addr, struct in_addr mask) return error; } -/* Adds 'router' as a default IP gateway. */ +/* Adds 'router' as a default IP gateway for the TCP/IP stack that corresponds + * to 'netdev'. */ int -netdev_add_router(struct in_addr router) +netdev_add_router(struct netdev *netdev UNUSED, struct in_addr router) { struct in_addr any = { INADDR_ANY }; struct rtentry rt; diff --git a/lib/netdev.h b/lib/netdev.h index 01eebebe..fb8c1e53 100644 --- a/lib/netdev.h +++ b/lib/netdev.h @@ -94,7 +94,7 @@ int netdev_get_features(struct netdev *, int netdev_set_advertisements(struct netdev *, uint32_t advertise); int netdev_get_in4(const struct netdev *, struct in_addr *); int netdev_set_in4(struct netdev *, struct in_addr addr, struct in_addr mask); -int netdev_add_router(struct in_addr router); +int netdev_add_router(struct netdev *, struct in_addr router); bool netdev_get_in6(const struct netdev *, struct in6_addr *); int netdev_get_flags(const struct netdev *, enum netdev_flags *); int netdev_set_flags(struct netdev *, enum netdev_flags, bool permanent); diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index cd4fde36..69c50901 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1145,7 +1145,7 @@ bridge_reconfigure_controller(struct bridge *br) } if (gateway.s_addr) { - if (!netdev_add_router(gateway)) { + if (!netdev_add_router(netdev, gateway)) { VLOG_INFO("bridge %s: configured gateway "IP_FMT, br->name, IP_ARGS(&gateway.s_addr)); } -- 2.30.2