ofproto: Factor flow duration calculation into new calc_flow_duration().
[openvswitch] / datapath / brcompat.c
index 3e840115427af7a3f29644a550349c2b5218f3f0..2113eae0f7a39fed65128a8bb6fcf56fa1ab749d 100644 (file)
@@ -84,6 +84,9 @@ static int brc_add_del_bridge(char __user *uname, int add)
        struct sk_buff *request;
        char name[IFNAMSIZ];
 
+       if (!capable(CAP_NET_ADMIN))
+               return -EPERM;
+
        if (copy_from_user(name, uname, IFNAMSIZ))
                return -EFAULT;
 
@@ -196,6 +199,9 @@ static int brc_add_del_port(struct net_device *dev, int port_ifindex, int add)
        struct net_device *port;
        int err;
 
+       if (!capable(CAP_NET_ADMIN))
+               return -EPERM;
+
        port = __dev_get_by_index(&init_net, port_ifindex);
        if (!port)
                return -EINVAL;