r3323 iosPickSwitchportCommand(): ignore "native" unless it's in the "allowed"
authorDenis Ovsienko <infrastation@yandex.ru>
Wed, 3 Mar 2010 16:07:48 +0000 (16:07 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Wed, 3 Mar 2010 16:07:48 +0000 (16:07 +0000)
inc/functions.php

index b848fe0..fc7259d 100644 (file)
@@ -2321,11 +2321,18 @@ function iosPickSwitchportCommand (&$work, $line)
                        );
                        break;
                case 'trunk':
+                       // Having configured VLAN as "native" doesn't mean anything
+                       // as long as it's not listed on the "allowed" line.
+                       $effective_native = in_array
+                       (
+                               $work['current']['trunk native vlan'],
+                               $work['current']['trunk allowed vlan']
+                       ) ? $work['current']['trunk native vlan'] : 0;
                        $work[] = array
                        (
                                'port_name' => $work['current']['port_name'],
                                'allowed' => $work['current']['trunk allowed vlan'],
-                               'native' => $work['current']['trunk native vlan'],
+                               'native' => $effective_native,
                        );
                        break;
                default: