Print this page
XXX Remove nawk(1)


 702         #
 703         /sbin/dladm init-phys
 704         return 0
 705 }
 706 
 707 #
 708 # Check for use of the default "Port VLAN Identifier" (PVID) -- VLAN 1.
 709 # If there is one for a given interface, then warn the user and force the
 710 # PVID to zero (if it's not already set).  We do this by generating a list
 711 # of interfaces with VLAN 1 in use first, and then parsing out the
 712 # corresponding base datalink entries to check for ones without a
 713 # "default_tag" property.
 714 #
 715 update_pvid()
 716 {
 717         datalink=/etc/dladm/datalink.conf
 718 
 719         (
 720                 # Find datalinks using VLAN 1 explicitly
 721                 # configured by dladm
 722                 /usr/bin/nawk '
 723                         /^#/ || NF < 2 { next }
 724                         { linkdata[$1]=$2; }
 725                         /;vid=int,1;/ {
 726                                 sub(/.*;linkover=int,/, "", $2);
 727                                 sub(/;.*/, "", $2);
 728                                 link=linkdata[$2];
 729                                 sub(/name=string,/, "", link);
 730                                 sub(/;.*/, "", link);
 731                                 print link;
 732                         }' $datalink
 733         ) | ( /usr/bin/sort -u; echo END; cat $datalink ) | /usr/bin/nawk '
 734             /^END$/ { state=1; }
 735             state == 0 { usingpvid[++nusingpvid]=$1; next; }
 736             /^#/ || NF < 2 { next; }
 737             {
 738                 # If it is already present and has a tag set,
 739                 # then believe it.
 740                 if (!match($2, /;default_tag=/))
 741                         next;
 742                 sub(/name=string,/, "", $2);
 743                 sub(/;.*/, "", $2);
 744                 for (i = 1; i <= nusingpvid; i++) {
 745                         if (usingpvid[i] == $2)
 746                                 usingpvid[i]="";
 747                 }
 748             }
 749             END {
 750                 for (i = 1; i <= nusingpvid; i++) {
 751                         if (usingpvid[i] != "") {
 752                                 printf("Warning: default VLAN tag set to 0" \
 753                                     " on %s\n", usingpvid[i]);




 702         #
 703         /sbin/dladm init-phys
 704         return 0
 705 }
 706 
 707 #
 708 # Check for use of the default "Port VLAN Identifier" (PVID) -- VLAN 1.
 709 # If there is one for a given interface, then warn the user and force the
 710 # PVID to zero (if it's not already set).  We do this by generating a list
 711 # of interfaces with VLAN 1 in use first, and then parsing out the
 712 # corresponding base datalink entries to check for ones without a
 713 # "default_tag" property.
 714 #
 715 update_pvid()
 716 {
 717         datalink=/etc/dladm/datalink.conf
 718 
 719         (
 720                 # Find datalinks using VLAN 1 explicitly
 721                 # configured by dladm
 722                 /usr/xpg4/bin/awk '
 723                         /^#/ || NF < 2 { next }
 724                         { linkdata[$1]=$2; }
 725                         /;vid=int,1;/ {
 726                                 sub(/.*;linkover=int,/, "", $2);
 727                                 sub(/;.*/, "", $2);
 728                                 link=linkdata[$2];
 729                                 sub(/name=string,/, "", link);
 730                                 sub(/;.*/, "", link);
 731                                 print link;
 732                         }' $datalink
 733         ) | ( /usr/bin/sort -u; echo END; cat $datalink ) | /usr/xpg4/bin/awk '
 734             /^END$/ { state=1; }
 735             state == 0 { usingpvid[++nusingpvid]=$1; next; }
 736             /^#/ || NF < 2 { next; }
 737             {
 738                 # If it is already present and has a tag set,
 739                 # then believe it.
 740                 if (!match($2, /;default_tag=/))
 741                         next;
 742                 sub(/name=string,/, "", $2);
 743                 sub(/;.*/, "", $2);
 744                 for (i = 1; i <= nusingpvid; i++) {
 745                         if (usingpvid[i] == $2)
 746                                 usingpvid[i]="";
 747                 }
 748             }
 749             END {
 750                 for (i = 1; i <= nusingpvid; i++) {
 751                         if (usingpvid[i] != "") {
 752                                 printf("Warning: default VLAN tag set to 0" \
 753                                     " on %s\n", usingpvid[i]);