]> git.pld-linux.org Git - packages/net-snmp.git/blob - net-snmp-duplicate-ip.patch
- up to 5.4.2.1
[packages/net-snmp.git] / net-snmp-duplicate-ip.patch
1 borrowed from:
2
3         http://net-snmp.svn.sourceforge.net/viewvc/net-snmp?view=rev&revision=16804
4
5 --- branches/V5-4-patches/net-snmp/snmplib/container.c  2008/02/13 23:11:48     16803
6 +++ branches/V5-4-patches/net-snmp/snmplib/container.c  2008/02/13 23:37:48     16804
7 @@ -268,25 +268,35 @@
8   * These functions should EXACTLY match the inline version in
9   * container.h. If you change one, change them both.
10   */
11 -int CONTAINER_INSERT(netsnmp_container *x, const void *k)
12 -{ 
13 -    int rc2, rc = 0;
14 -    
15 -    /** start at first container */
16 -    while(x->prev)
17 -        x = x->prev;
18 -    for(; x; x = x->next) {
19 -        if ((NULL != x->insert_filter) &&
20 -            (x->insert_filter(x,k) == 1))
21 -            continue;
22 -        rc2 = x->insert(x,k);
23 -        if (rc2) {
24 +int CONTAINER_INSERT_HELPER(netsnmp_container* x, const void* k)
25 +{
26 +    while(x && x->insert_filter && x->insert_filter(x,k) == 1)
27 +        x = x->next;
28 +    if(x) {
29 +        int rc = x->insert(x,k);
30 +        if(rc)
31              snmp_log(LOG_ERR,"error on subcontainer '%s' insert (%d)\n",
32 -                     x->container_name ? x->container_name : "", rc2);
33 -            rc = rc2;
34 +                     x->container_name ? x->container_name : "", rc);
35 +        else {
36 +            rc = CONTAINER_INSERT_HELPER(x->next, k);
37 +            if(rc)
38 +                x->remove(x,k);
39          }
40 +        return rc;
41      }
42 -    return rc;
43 +    return 0;
44 +}
45 +
46 +/*------------------------------------------------------------------
47 + * These functions should EXACTLY match the inline version in
48 + * container.h. If you change one, change them both.
49 + */
50 +int CONTAINER_INSERT(netsnmp_container* x, const void* k)
51 +{
52 +    /** start at first container */
53 +    while(x->prev)
54 +        x = x->prev;
55 +    return CONTAINER_INSERT_HELPER(x, k);
56  }
57  
58  /*------------------------------------------------------------------
59 --- branches/V5-4-patches/net-snmp/include/net-snmp/library/container.h 2008/02/13 23:11:48     16803
60 +++ branches/V5-4-patches/net-snmp/include/net-snmp/library/container.h 2008/02/13 23:37:48     16804
61 @@ -351,27 +351,38 @@
62       * container.c. If you change one, change them both.
63       */
64      NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
65 -    int CONTAINER_INSERT(netsnmp_container *x, const void *k)
66 +    int CONTAINER_INSERT_HELPER(netsnmp_container* x, const void* k)
67      {
68 -        int rc2, rc = 0;
69 -        
70 -        /** start at first container */
71 -        while(x->prev)
72 -            x = x->prev;
73 -        for(; x; x = x->next) {
74 -            if ((NULL != x->insert_filter) &&
75 -                (x->insert_filter(x,k) == 1))
76 -                continue;
77 -            rc2 = x->insert(x,k);
78 -            if (rc2) {
79 +        while(x && x->insert_filter && x->insert_filter(x,k) == 1)
80 +            x = x->next;
81 +        if(x) {
82 +            int rc = x->insert(x,k);
83 +            if(rc)
84                  snmp_log(LOG_ERR,"error on subcontainer '%s' insert (%d)\n",
85 -                         x->container_name ? x->container_name : "", rc2);
86 -                rc = rc2;
87 +                         x->container_name ? x->container_name : "", rc);
88 +            else {
89 +                rc = CONTAINER_INSERT_HELPER(x->next, k);
90 +                if(rc)
91 +                    x->remove(x,k);
92              }
93 +            return rc;
94          }
95 -        return rc;
96 +        return 0;
97      }
98 -    
99 +
100 +    /*------------------------------------------------------------------
101 +     * These functions should EXACTLY match the function version in
102 +     * container.c. If you change one, change them both.
103 +     */
104 +    NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
105 +    int CONTAINER_INSERT(netsnmp_container* x, const void* k)
106 +    {
107 +        /** start at first container */
108 +        while(x->prev)
109 +            x = x->prev;
110 +        return CONTAINER_INSERT_HELPER(x, k);
111 +    }
112 +
113      /*------------------------------------------------------------------
114       * These functions should EXACTLY match the function version in
115       * container.c. If you change one, change them both.
This page took 0.040384 seconds and 3 git commands to generate.