[BACK]Return to smi.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / snmp

Diff for /src/usr.bin/snmp/smi.c between version 1.7 and 1.8

version 1.7, 2020/01/17 09:52:44 version 1.8, 2020/05/19 13:41:01
Line 537 
Line 537 
         bzero(buf, len);          bzero(buf, len);
         bzero(&key, sizeof(key));          bzero(&key, sizeof(key));
         bcopy(o, &key.o_id, sizeof(struct ber_oid));          bcopy(o, &key.o_id, sizeof(struct ber_oid));
         key.o_flags |= OID_KEY;         /* do not match wildcards */  
   
         for (i = 0; i < o->bo_n; i++) {          for (i = 0; i < o->bo_n; i++) {
                 key.o_oidlen = i + 1;                  key.o_oidlen = i + 1;
Line 573 
Line 572 
                         continue;                          continue;
                 }                  }
                 decl = RB_FIND(oidtree, &smi_oidtree, oid);                  decl = RB_FIND(oidtree, &smi_oidtree, oid);
                 decl->o_flags = oid->o_flags;  
                 decl->o_get = oid->o_get;  
                 decl->o_set = oid->o_set;  
                 decl->o_table = oid->o_table;  
                 decl->o_val = oid->o_val;  
                 decl->o_data = oid->o_data;  
         }          }
 }  }
   
Line 593 
Line 586 
 }  }
   
 struct oid *  struct oid *
 smi_foreach(struct oid *oid, u_int flags)  smi_foreach(struct oid *oid)
 {  {
         /*          /*
          * Traverse the tree of MIBs with the option to check           * Traverse the tree of MIBs with the option to check
          * for specific OID flags.           * for specific OID flags.
          */           */
         if (oid == NULL) {          if (oid == NULL)
                 oid = RB_MIN(oidtree, &smi_oidtree);                  return RB_MIN(oidtree, &smi_oidtree);
                 if (oid == NULL)          return RB_NEXT(oidtree, &smi_oidtree, oid);
                         return (NULL);  
                 if (flags == 0 || (oid->o_flags & flags))  
                         return (oid);  
         }  
         for (;;) {  
                 oid = RB_NEXT(oidtree, &smi_oidtree, oid);  
                 if (oid == NULL)  
                         break;  
                 if (flags == 0 || (oid->o_flags & flags))  
                         return (oid);  
         }  
   
         return (oid);  
 }  }
   
 int  int
Line 626 
Line 606 
                 if (a->o_oid[i] != b->o_oid[i])                  if (a->o_oid[i] != b->o_oid[i])
                         return (a->o_oid[i] - b->o_oid[i]);                          return (a->o_oid[i] - b->o_oid[i]);
         }          }
   
         /*  
          * Return success if the matched object is a table  
          * or a MIB registered by a subagent  
          * (it will match any sub-elements)  
          */  
         if ((b->o_flags & OID_TABLE ||  
             b->o_flags & OID_REGISTERED) &&  
             (a->o_flags & OID_KEY) == 0 &&  
             (a->o_oidlen > b->o_oidlen))  
                 return (0);  
   
         return (a->o_oidlen - b->o_oidlen);          return (a->o_oidlen - b->o_oidlen);
 }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8