vlan_dev.c (9793241fe92f7d9303fb221e43fc598eb065f267) | vlan_dev.c (5e7565930524410f097f5b04f8aba663089a6ffc) |
---|---|
1/* -*- linux-c -*- 2 * INET 802.1Q VLAN 3 * Ethernet-type device handling. 4 * 5 * Authors: Ben Greear <greearb@candelatech.com> 6 * Please send support related email to: netdev@vger.kernel.org 7 * VLAN Home Page: http://www.candelatech.com/~greear/vlan.html 8 * --- 417 unchanged lines hidden (view full) --- 426} 427 428/* Flags are defined in the vlan_flags enum in include/linux/if_vlan.h file. */ 429int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask) 430{ 431 struct vlan_dev_info *vlan = vlan_dev_info(dev); 432 u32 old_flags = vlan->flags; 433 | 1/* -*- linux-c -*- 2 * INET 802.1Q VLAN 3 * Ethernet-type device handling. 4 * 5 * Authors: Ben Greear <greearb@candelatech.com> 6 * Please send support related email to: netdev@vger.kernel.org 7 * VLAN Home Page: http://www.candelatech.com/~greear/vlan.html 8 * --- 417 unchanged lines hidden (view full) --- 426} 427 428/* Flags are defined in the vlan_flags enum in include/linux/if_vlan.h file. */ 429int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask) 430{ 431 struct vlan_dev_info *vlan = vlan_dev_info(dev); 432 u32 old_flags = vlan->flags; 433 |
434 if (mask & ~(VLAN_FLAG_REORDER_HDR | VLAN_FLAG_GVRP)) | 434 if (mask & ~(VLAN_FLAG_REORDER_HDR | VLAN_FLAG_GVRP | 435 VLAN_FLAG_LOOSE_BINDING)) |
435 return -EINVAL; 436 437 vlan->flags = (old_flags & ~mask) | (flags & mask); 438 439 if (netif_running(dev) && (vlan->flags ^ old_flags) & VLAN_FLAG_GVRP) { 440 if (vlan->flags & VLAN_FLAG_GVRP) 441 vlan_gvrp_request_join(dev); 442 else --- 8 unchanged lines hidden (view full) --- 451} 452 453static int vlan_dev_open(struct net_device *dev) 454{ 455 struct vlan_dev_info *vlan = vlan_dev_info(dev); 456 struct net_device *real_dev = vlan->real_dev; 457 int err; 458 | 436 return -EINVAL; 437 438 vlan->flags = (old_flags & ~mask) | (flags & mask); 439 440 if (netif_running(dev) && (vlan->flags ^ old_flags) & VLAN_FLAG_GVRP) { 441 if (vlan->flags & VLAN_FLAG_GVRP) 442 vlan_gvrp_request_join(dev); 443 else --- 8 unchanged lines hidden (view full) --- 452} 453 454static int vlan_dev_open(struct net_device *dev) 455{ 456 struct vlan_dev_info *vlan = vlan_dev_info(dev); 457 struct net_device *real_dev = vlan->real_dev; 458 int err; 459 |
459 if (!(real_dev->flags & IFF_UP)) | 460 if (!(real_dev->flags & IFF_UP) && 461 !(vlan->flags & VLAN_FLAG_LOOSE_BINDING)) |
460 return -ENETDOWN; 461 462 if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr)) { 463 err = dev_unicast_add(real_dev, dev->dev_addr); 464 if (err < 0) 465 goto out; 466 } 467 --- 413 unchanged lines hidden --- | 462 return -ENETDOWN; 463 464 if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr)) { 465 err = dev_unicast_add(real_dev, dev->dev_addr); 466 if (err < 0) 467 goto out; 468 } 469 --- 413 unchanged lines hidden --- |