diff --git a/Info/Bridge.pm b/Info/Bridge.pm index 0663ebdb..86eb5232 100644 --- a/Info/Bridge.pm +++ b/Info/Bridge.pm @@ -308,6 +308,8 @@ sub i_vlan { return $i_vlan; } +sub i_untagged { goto &i_vlan } + sub i_vlan_membership { my $bridge = shift; my $partial = shift; @@ -365,6 +367,8 @@ sub set_i_vlan { return; } +sub set_i_untagged { goto &set_i_vlan } + sub set_add_i_vlan_tagged { my $bridge = shift; @@ -597,6 +601,10 @@ to a hash. Returns a mapping between C and the PVID or default VLAN. +=item $vtp->i_untagged() + +An alias for C. + =item $bridge->i_vlan_membership() Returns reference to hash of arrays: key = C, value = array of VLAN @@ -893,6 +901,10 @@ operations. Currently unsupported. Throws an error and returns. +=item $bridge->set_i_untagged(vlan, ifIndex) + +An alias for C. + =item $bridge->set_i_pvid(pvid, ifIndex) Currently unsupported. Throws an error and returns. diff --git a/Info/CiscoVTP.pm b/Info/CiscoVTP.pm index 93525cee..a22bf401 100644 --- a/Info/CiscoVTP.pm +++ b/Info/CiscoVTP.pm @@ -143,9 +143,6 @@ sub v_index { return \%v_index; } -sub i_pvid { goto &i_vlan } -sub i_untagged { goto &i_vlan } - sub i_vlan { my $vtp = shift; my $partial = shift; @@ -194,6 +191,22 @@ sub i_vlan { return \%i_vlans; } +sub i_untagged { + my $vtp = shift; + my ( $ifindex ) = @_; + + # cannot defer to i_vlan - vtp_trunk_dyn_stat is not useful for down ports + # so we use vtp_trunk_dyn as a hint to use i_pvid + + my $trunking = eval { $vtp->vtp_trunk_dyn($ifindex)->{$ifindex} }; + if ($trunking and (($trunking eq 'on') or ($trunking eq 'onNoNegotiate'))) { + return $vtp->i_pvid(@_); + } + else { + return $vtp->i_vlan(@_); + } +} + sub i_vlan_membership { my $vtp = shift; my $partial = shift; @@ -313,6 +326,9 @@ sub set_i_untagged { my $vtp = shift; my ( $vlan_id, $ifindex ) = @_; + # cannot defer to i_vlan - vtp_trunk_dyn_stat is not useful for down ports + # so we use vtp_trunk_dyn as a hint to use i_pvid + my $trunking = eval { $vtp->vtp_trunk_dyn($ifindex)->{$ifindex} }; if ($trunking and (($trunking eq 'on') or ($trunking eq 'onNoNegotiate'))) { return $vtp->set_i_pvid(@_); @@ -556,10 +572,6 @@ Your device will only implement a subset of these methods. Returns a mapping between C and assigned VLAN ID for access ports and the default VLAN ID for trunk ports. -=item $vtp->i_pvid() - -An alias for C. - =item $vtp->i_untagged() An alias for C.