Lines Matching refs:upd

70 create(struct update *upd)  in create()  argument
75 if (!(upd->set & UPD_MASK)) { in create()
76 if (IN_CLASSA(ntohl(upd->addr.s_addr))) in create()
77 upd->mask.s_addr = htonl(IN_CLASSA_NET); in create()
78 else if (IN_CLASSB(ntohl(upd->addr.s_addr))) in create()
79 upd->mask.s_addr = htonl(IN_CLASSB_NET); in create()
80 else if (IN_CLASSC(ntohl(upd->addr.s_addr))) in create()
81 upd->mask.s_addr = htonl(IN_CLASSC_NET); in create()
83 upd->mask.s_addr = 0xffffffff; in create()
86 bcast.s_addr = upd->addr.s_addr & upd->mask.s_addr; in create()
87 if (!(upd->set & UPD_BCAST) || upd->bcast) { in create()
88 uint32_t tmp = ~ntohl(upd->mask.s_addr); in create()
92 if ((ifa = mib_create_ifa(upd->ifindex, upd->addr, upd->mask, bcast)) in create()
96 upd->rb |= RB_CREATE; in create()
105 modify(struct update *upd, struct mibifa *ifa) in modify() argument
111 if ((upd->set & UPD_IFINDEX) && upd->ifindex != ifa->ifindex) in modify()
114 upd->rb_mask = ifa->inmask; in modify()
115 upd->rb_bcast = ifa->inbcast; in modify()
116 if (((upd->set & UPD_MASK) && upd->mask.s_addr != ifa->inmask.s_addr) || in modify()
117 (upd->set & UPD_BCAST)) { in modify()
118 if (upd->set & UPD_MASK) in modify()
119 ifa->inmask = upd->mask; in modify()
120 if (upd->set & UPD_BCAST) { in modify()
123 if (upd->bcast) in modify()
129 ifa->inmask = upd->rb_mask; in modify()
130 ifa->inbcast = upd->rb_bcast; in modify()
134 upd->rb |= RB_MODIFY; in modify()
145 destroy(struct snmp_context *ctx __unused, struct update *upd, in destroy() argument
150 upd->rb |= RB_DESTROY; in destroy()
161 struct update *upd = (struct update *)dep; in update_func() local
167 if ((ifa = mib_find_ifa(upd->addr)) == NULL) { in update_func()
169 if (!(upd->set & UPD_IFINDEX)) in update_func()
171 return (create(upd)); in update_func()
174 if ((upd->set & UPD_IFINDEX) && upd->ifindex == 0) { in update_func()
176 return (destroy(ctx, upd, ifa)); in update_func()
179 return (modify(upd, ifa)); in update_func()
182 if ((ifa = mib_find_ifa(upd->addr)) == NULL) { in update_func()
187 if (upd->rb & RB_CREATE) { in update_func()
191 if (upd->rb & RB_DESTROY) { in update_func()
195 if (upd->rb & RB_MODIFY) { in update_func()
196 ifa->inmask = upd->rb_mask; in update_func()
197 ifa->inbcast = upd->rb_bcast; in update_func()
204 if ((upd->rb & RB_DESTROY) && in update_func()
205 (ifa = mib_find_ifa(upd->addr)) != NULL && in update_func()
225 struct update *upd; in op_ipaddr() local
256 if ((upd = (struct update *)snmp_dep_lookup(ctx, in op_ipaddr()
257 &oid_ipAddrTable, &idx, sizeof(*upd), update_func)) == NULL) in op_ipaddr()
260 upd->addr.s_addr = htonl((ipaddr[0] << 24) | (ipaddr[1] << 16) | in op_ipaddr()
266 if (upd->set & UPD_IFINDEX) in op_ipaddr()
276 upd->set |= UPD_IFINDEX; in op_ipaddr()
277 upd->ifindex = (u_int)value->v.integer; in op_ipaddr()
281 if (upd->set & UPD_MASK) in op_ipaddr()
283 upd->mask.s_addr = htonl((value->v.ipaddress[0] << 24) in op_ipaddr()
287 upd->set |= UPD_MASK; in op_ipaddr()
291 if (upd->set & UPD_BCAST) in op_ipaddr()
295 upd->bcast = value->v.integer; in op_ipaddr()
296 upd->set |= UPD_BCAST; in op_ipaddr()