mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
dpif-netdev: Do not allow adding loopback devices
Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
committed by
Ben Pfaff
parent
7ba19d412a
commit
2499a8ce82
@@ -407,6 +407,7 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
|
||||
struct dp_netdev_port *port;
|
||||
struct netdev *netdev;
|
||||
struct netdev_rx *rx;
|
||||
enum netdev_flags flags;
|
||||
const char *open_type;
|
||||
int mtu;
|
||||
int error;
|
||||
@@ -419,9 +420,15 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
/* XXX reject loopback devices */
|
||||
/* XXX reject non-Ethernet devices */
|
||||
|
||||
netdev_get_flags(netdev, &flags);
|
||||
if (flags & NETDEV_LOOPBACK) {
|
||||
VLOG_ERR("%s: cannot add a loopback device", devname);
|
||||
netdev_close(netdev);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
error = netdev_rx_open(netdev, &rx);
|
||||
if (error
|
||||
&& !(error == EOPNOTSUPP && dpif_netdev_class_is_dummy(dp->class))) {
|
||||
|
Reference in New Issue
Block a user