2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-01 14:55:18 +00:00

netdev: Get rid of netdev_open_tap().

netdev_open() can always be used in place of netdev_open_tap().  The
former is going to be generalized to support pluggable network device
types, so it makes sense to use it everywhere.
This commit is contained in:
Ben Pfaff
2009-07-23 12:21:11 -07:00
parent 6b9bd97900
commit e33e4d356d
3 changed files with 41 additions and 50 deletions

View File

@@ -377,7 +377,9 @@ do_add_port(struct dp_netdev *dp, const char *devname, uint16_t flags,
if (!internal) {
error = netdev_open(devname, NETDEV_ETH_TYPE_ANY, &netdev);
} else {
error = netdev_open_tap(devname, &netdev);
char *tapname = xasprintf("tap:%s", devname);
error = netdev_open(tapname, NETDEV_ETH_TYPE_ANY, &netdev);
free(tapname);
}
if (error) {
return error;

View File

@@ -335,21 +335,9 @@ do_get_features(struct netdev *netdev,
int
netdev_open(const char *name, int ethertype, struct netdev **netdevp)
{
if (!strncmp(name, "tap:", 4)) {
return netdev_open_tap(name + 4, netdevp);
} else {
if (strncmp(name, "tap:", 4)) {
return do_open_netdev(name, ethertype, -1, netdevp);
}
}
/* Opens a TAP virtual network device. If 'name' is a nonnull, non-empty
* string, attempts to assign that name to the TAP device (failing if the name
* is already in use); otherwise, a name is automatically assigned. Returns
* zero if successful, otherwise a positive errno value. On success, sets
* '*netdevp' to the new network device, otherwise to null. */
int
netdev_open_tap(const char *name, struct netdev **netdevp)
{
} else {
static const char tap_dev[] = "/dev/net/tun";
struct ifreq ifr;
int error;
@@ -387,6 +375,8 @@ netdev_open_tap(const char *name, struct netdev **netdevp)
}
return error;
}
}
static int
do_open_netdev(const char *name, int ethertype, int tap_fd,

View File

@@ -75,7 +75,6 @@ struct netdev_stats {
struct netdev;
int netdev_open(const char *name, int ethertype, struct netdev **);
int netdev_open_tap(const char *name, struct netdev **);
void netdev_close(struct netdev *);
int netdev_recv(struct netdev *, struct ofpbuf *);