patch-2.4.25 linux-2.4.25/net/8021q/vlan_dev.c
Next file: linux-2.4.25/net/atm/br2684.c
Previous file: linux-2.4.25/net/8021q/vlan.h
Back to the patch index
Back to the overall index
- Lines: 67
- Date:
2004-02-18 05:36:32.000000000 -0800
- Orig file:
linux-2.4.24/net/8021q/vlan_dev.c
- Orig date:
2003-11-28 10:26:21.000000000 -0800
diff -urN linux-2.4.24/net/8021q/vlan_dev.c linux-2.4.25/net/8021q/vlan_dev.c
@@ -1,4 +1,4 @@
-/*
+/* -*- linux-c -*-
* INET 802.1Q VLAN
* Ethernet-type device handling.
*
@@ -636,6 +636,60 @@
return -EINVAL;
}
+
+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);
+ dev_put(dev);
+ rv = 0;
+ } else {
+ /*printk(KERN_ERR
+ "%s: %s is not a vlan device, priv_flags: %hX.\n",
+ __FUNCTION__, dev->name, dev->priv_flags);*/
+ dev_put(dev);
+ rv = -EINVAL;
+ }
+ } else {
+ /* printk(KERN_ERR "%s: Could not find device: %s\n",
+ __FUNCTION__, dev_name); */
+ 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;
+ dev_put(dev);
+ rv = 0;
+ } else {
+ /*printk(KERN_ERR
+ "%s: %s is not a vlan device, priv_flags: %hX.\n",
+ __FUNCTION__, dev->name, dev->priv_flags);*/
+ dev_put(dev);
+ rv = -EINVAL;
+ }
+ } else {
+ /* printk(KERN_ERR "%s: Could not find device: %s\n",
+ __FUNCTION__, dev_name);*/
+ rv = -ENODEV;
+ }
+
+ return rv;
+}
+
+
int vlan_dev_set_mac_address(struct net_device *dev, void *addr_struct_p)
{
struct sockaddr *addr = (struct sockaddr *)(addr_struct_p);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)