components/net-snmp/patches/030.7147779.kernel_sunos5.patch
author Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
Mon, 04 Mar 2013 01:04:36 -0800
branchs11u1-sru
changeset 2509 b7784efdcc03
permissions -rw-r--r--
15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2509
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     1
--- net-snmp-5.4.1.orig/agent/mibgroup/kernel_sunos5.c	2013-01-11 11:46:28.795419820 -0800
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     2
+++ net-snmp-5.4.1/agent/mibgroup/kernel_sunos5.c	2013-01-11 11:45:51.611042099 -0800
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     3
@@ -280,7 +280,9 @@
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     4
     kstat_t        *ks;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     5
     kid_t           kid;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     6
     kstat_named_t  *named;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     7
+ 
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     8
     int             ret = -1;        /* fail unless ... */
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     9
+    int             lookup_stat = 0;	
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    10
 
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    11
     if (kstat_fd == 0) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    12
 	kstat_fd = kstat_open();
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    13
@@ -291,27 +293,88 @@
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    14
     if ((ksc = kstat_fd) == NULL) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    15
 	goto Return;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    16
     }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    17
-    ks = kstat_lookup(ksc, classname, -1, statname);
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    18
-    if (ks == NULL) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    19
-	DEBUGMSGTL(("kernel_sunos5", "class %s, stat %s not found\n",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    20
-		classname ? classname : "NULL",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    21
-		statname ? statname : "NULL"));
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    22
-	goto Return;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    23
-    }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    24
-    kid = kstat_read(ksc, ks, NULL);
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    25
-    if (kid == -1) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    26
-	DEBUGMSGTL(("kernel_sunos5", "cannot read class %s stats %s\n",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    27
-		classname ? classname : "NULL", statname ? statname : "NULL"));
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    28
-	goto Return;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    29
-    }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    30
-    named = kstat_data_lookup(ks, varname);
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    31
-    if (named == NULL) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    32
-	DEBUGMSGTL(("kernel_sunos5", "no var %s for class %s stat %s\n",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    33
-		varname, classname ? classname : "NULL",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    34
-		statname ? statname : "NULL"));
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    35
-	goto Return;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    36
+   
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    37
+    if ((ks = kstat_lookup(ksc, statname, 0, "link")) != NULL)
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    38
+    {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    39
+        kid = kstat_read(ksc, ks, NULL);
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    40
+        if (kid == -1) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    41
+            DEBUGMSGTL(("kernel_sunos5", "cannot read class %s stats %s\n",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    42
+                    statname ? statname : "NULL", "link"));
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    43
+        }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    44
+        else
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    45
+        {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    46
+            named = kstat_data_lookup(ks, varname);
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    47
+            if (named == NULL) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    48
+	        DEBUGMSGTL(("kernel_sunos5", "no var %s for class %s stat %s\n",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    49
+                        varname, statname ? statname : "NULL", "link"));
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    50
+            }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    51
+            else {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    52
+                    switch (named->data_type) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    53
+#ifdef KSTAT_DATA_INT32         /* Solaris 2.6 and up */
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    54
+                        case KSTAT_DATA_INT32:
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    55
+                            if(named->value.i32)
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    56
+                                lookup_stat = 1;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    57
+	                    break;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    58
+                        case KSTAT_DATA_UINT32:
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    59
+                            if(named->value.ui32)
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    60
+                                lookup_stat = 1;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    61
+                            break;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    62
+                        case KSTAT_DATA_INT64:
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    63
+                            if(named->value.i64)
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    64
+                                lookup_stat = 1;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    65
+                            break;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    66
+                        case KSTAT_DATA_UINT64:
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    67
+                            if(named->value.ui64)
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    68
+                                lookup_stat = 1;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    69
+                            break;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    70
+#else
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    71
+                        case KSTAT_DATA_LONG:
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    72
+                            if(named->value.l)
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    73
+                                lookup_stat = 1;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    74
+                            break;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    75
+                        case KSTAT_DATA_ULONG:
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    76
+                            if(named->value.ul)
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    77
+                                lookup_stat = 1;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    78
+                            break;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    79
+                        case KSTAT_DATA_LONGLONG:
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    80
+                            if(named->value.ll)
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    81
+                                lookup_stat = 1;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    82
+                            break;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    83
+                        case KSTAT_DATA_ULONGLONG:
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    84
+                            if(named->value.ull)
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    85
+                                lookup_stat = 1;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    86
+                            break;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    87
+#endif
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    88
+                    } 
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    89
+            }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    90
+        }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    91
     }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    92
-
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    93
+     
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    94
+    if(!lookup_stat) 
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    95
+    {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    96
+        ks = kstat_lookup(ksc, classname, -1, statname);
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    97
+        if (ks == NULL) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    98
+        DEBUGMSGTL(("kernel_sunos5", "class %s, stat %s not found\n",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    99
+                   classname ? classname : "NULL",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   100
+                   statname ? statname : "NULL"));
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   101
+        goto Return;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   102
+        }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   103
+        
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   104
+	kid = kstat_read(ksc, ks, NULL);
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   105
+        if (kid == -1) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   106
+            DEBUGMSGTL(("kernel_sunos5", "cannot read class %s stats %s\n",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   107
+                   classname ? classname : "NULL", statname ? statname : "NULL"));
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   108
+            goto Return;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   109
+        }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   110
+        
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   111
+	named = kstat_data_lookup(ks, varname);
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   112
+        if (named == NULL) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   113
+            DEBUGMSGTL(("kernel_sunos5", "no var %s for class %s stat %s\n",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   114
+                    varname, classname ? classname : "NULL",
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   115
+                    statname ? statname : "NULL"));
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   116
+            goto Return;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   117
+        }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   118
+    } 
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   119
     ret = 0;                /* maybe successful */
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   120
     switch (named->data_type) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   121
 #ifdef KSTAT_DATA_INT32         /* Solaris 2.6 and up */
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   122
@@ -428,11 +491,20 @@
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   123
     /*
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   124
      * Get the named statistics 
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   125
      */
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   126
-    if ((ks = kstat_lookup(ksc, module_name, instance, statname)) == NULL) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   127
-	ret = -10;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   128
-	goto Return;        /* kstat errors */
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   129
-    }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   130
 
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   131
+    if ((ks = kstat_lookup(ksc, module_name, instance, statname)) == NULL)
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   132
+    {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   133
+        /*
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   134
+         * Try to lookup the kstat module with
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   135
+         * modulename = linkname and statname = "link".
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   136
+         */
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   137
+
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   138
+        if ((ks = kstat_lookup(ksc, statname, 0, "link")) == NULL) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   139
+            ret = -10;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   140
+            goto Return;    /* kstat errors */
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   141
+        }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   142
+    }
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   143
+   		
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   144
     if (kstat_read(ksc, ks, NULL) <= 0) {
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   145
 	ret = -10;
b7784efdcc03 15774567 SUNBT7147779 net-snmp does not show all ifTable values for vlan interfaces
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   146
 	goto Return;        /* kstat errors */