+
+int vlan_dev_get_realdev_name(const char *dev_name, char* result)
+{
+ struct net_device *dev = dev_get_by_name(dev_name);
+ int rv = 0;
+ if (dev) {
+ if (dev->priv_flags & IFF_802_1Q_VLAN) {
+ strncpy(result, VLAN_DEV_INFO(dev)->real_dev->name, 23);
+ rv = 0;
+ } else {
+ rv = -EINVAL;
+ }
+ dev_put(dev);
+ } else {
+ rv = -ENODEV;
+ }
+ return rv;
+}
+
+int vlan_dev_get_vid(const char *dev_name, unsigned short* result)
+{
+ struct net_device *dev = dev_get_by_name(dev_name);
+ int rv = 0;
+ if (dev) {
+ if (dev->priv_flags & IFF_802_1Q_VLAN) {
+ *result = VLAN_DEV_INFO(dev)->vlan_id;
+ rv = 0;
+ } else {
+ rv = -EINVAL;
+ }
+ dev_put(dev);
+ } else {
+ rv = -ENODEV;
+ }
+ return rv;
+}
+
+