mibII_ipaddr.c (124861) | mibII_ipaddr.c (128237) |
---|---|
1/* 2 * Copyright (c) 2001-2002 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Author: Harti Brandt <harti@freebsd.org> 7 * 8 * Redistribution of this software and documentation and use in source and --- 16 unchanged lines hidden (view full) --- 25 * FRAUNHOFER FOKUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 28 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 2001-2002 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Author: Harti Brandt <harti@freebsd.org> 7 * 8 * Redistribution of this software and documentation and use in source and --- 16 unchanged lines hidden (view full) --- 25 * FRAUNHOFER FOKUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 28 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * |
33 * $Begemot: bsnmp/snmp_mibII/mibII_ipaddr.c,v 1.7 2003/12/03 10:01:19 hbb Exp $ | 33 * $Begemot: bsnmp/snmp_mibII/mibII_ipaddr.c,v 1.8 2004/04/13 14:58:46 novo Exp $ |
34 * 35 * IP address table. This table is writeable! 36 * 37 * Writing to this table will add a new IP address to the interface. 38 * An address can be deleted with writing the interface index 0. 39 */ 40#include "mibII.h" 41#include "mibII_oid.h" --- 91 unchanged lines hidden (view full) --- 133 return (SNMP_ERR_GENERR); 134 } 135 upd->rb |= RB_MODIFY; 136 } 137 return (SNMP_ERR_NOERROR); 138} 139 140/* | 34 * 35 * IP address table. This table is writeable! 36 * 37 * Writing to this table will add a new IP address to the interface. 38 * An address can be deleted with writing the interface index 0. 39 */ 40#include "mibII.h" 41#include "mibII_oid.h" --- 91 unchanged lines hidden (view full) --- 133 return (SNMP_ERR_GENERR); 134 } 135 upd->rb |= RB_MODIFY; 136 } 137 return (SNMP_ERR_NOERROR); 138} 139 140/* |
141 * Remove an IP address from an interface. This is called when 142 * the SET finishes. 143 */ 144static void 145destroy_func(struct snmp_context *ctx __unused, int fail __unused, void *arg) 146{ 147 struct mibifa *ifa = arg; 148 149 if (ifa->flags & MIBIFA_DESTROYED) { 150 TAILQ_REMOVE(&mibifa_list, ifa, link); 151 free(ifa); 152 } 153} 154 155/* | |
156 * Destroy the given row in the table. We remove the address from the 157 * system, but keep the structure around for the COMMIT. It's deleted | 141 * Destroy the given row in the table. We remove the address from the 142 * system, but keep the structure around for the COMMIT. It's deleted |
158 * only in the finish function. | 143 * only in the FINISH operation. |
159 */ 160static int | 144 */ 145static int |
161destroy(struct snmp_context *ctx, struct update *upd, struct mibifa *ifa) | 146destroy(struct snmp_context *ctx __unused, struct update *upd, 147 struct mibifa *ifa) |
162{ 163 if (mib_destroy_ifa(ifa)) 164 return (SNMP_ERR_GENERR); | 148{ 149 if (mib_destroy_ifa(ifa)) 150 return (SNMP_ERR_GENERR); |
165 if (snmp_set_atfinish(ctx, destroy_func, ifa)) { 166 syslog(LOG_ERR, "atfinish: %m"); 167 mib_undestroy_ifa(ifa); 168 return (SNMP_ERR_GENERR); 169 } | |
170 upd->rb |= RB_DESTROY; 171 return (SNMP_ERR_NOERROR); 172} 173 174/* 175 * This function is called to commit/rollback a SET on an IpAddrEntry 176 */ 177static int --- 36 unchanged lines hidden (view full) --- 214 } 215 if (upd->rb & RB_MODIFY) { 216 ifa->inmask = upd->rb_mask; 217 ifa->inbcast = upd->rb_bcast; 218 mib_unmodify_ifa(ifa); 219 return (SNMP_ERR_NOERROR); 220 } 221 return (SNMP_ERR_NOERROR); | 151 upd->rb |= RB_DESTROY; 152 return (SNMP_ERR_NOERROR); 153} 154 155/* 156 * This function is called to commit/rollback a SET on an IpAddrEntry 157 */ 158static int --- 36 unchanged lines hidden (view full) --- 195 } 196 if (upd->rb & RB_MODIFY) { 197 ifa->inmask = upd->rb_mask; 198 ifa->inbcast = upd->rb_bcast; 199 mib_unmodify_ifa(ifa); 200 return (SNMP_ERR_NOERROR); 201 } 202 return (SNMP_ERR_NOERROR); |
203 204 case SNMP_DEPOP_FINISH: 205 if ((upd->rb & RB_DESTROY) && 206 (ifa = mib_find_ifa(upd->addr)) != NULL && 207 (ifa->flags & MIBIFA_DESTROYED)) { 208 TAILQ_REMOVE(&mibifa_list, ifa, link); 209 free(ifa); 210 } 211 return (SNMP_ERR_NOERROR); |
|
222 } 223 abort(); 224} 225 226/**********************************************************************/ 227/* 228 * ACTION 229 */ --- 122 unchanged lines hidden --- | 212 } 213 abort(); 214} 215 216/**********************************************************************/ 217/* 218 * ACTION 219 */ --- 122 unchanged lines hidden --- |