1/*-
2 * Copyright (c) 2006 Shteryana Shopova <syrinx@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 11 unchanged lines hidden (view full) ---
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * Bridge MIB implementation for SNMPd.
27 *
28 * $FreeBSD: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.c 164997 2006-12-07 22:36:17Z syrinx $
29 */
30
31#include <sys/param.h>
32#include <sys/queue.h>
33#include <sys/socket.h>
34#include <sys/types.h>
35
36#include <net/ethernet.h>
--- 77 unchanged lines hidden (view full) ---
114 struct bridge_if *bif;
115
116 if (len >= IFNAMSIZ)
117 return (-1);
118
119 bcopy(bif_name, bif_default_name, len);
120 bif_default_name[len] = '\0';
121
122 if ((bif = bridge_if_find_ifname(bif_default_name)) == NULL) {
123 bif_default = NULL;
124 return (0);
125 }
126
127 bif_default = bif;
128 return (1);
129}
130
131int
132bridge_get_data_maxage(void)
133{
--- 60 unchanged lines hidden (view full) ---
194 bridge_get_default_name()) < 0)
195 return (SNMP_ERR_RES_UNAVAIL);
196
197 if (bridge_set_default_name(val->v.octetstring.octets,
198 val->v.octetstring.len) < 0)
199 return (SNMP_ERR_BADVALUE);
200 break;
201 case LEAF_begemotBridgeDataUpdate:
202 if (val->v.integer < SNMP_BRIDGE_DATA_MAXAGE_MIN ||
203 val->v.integer > SNMP_BRIDGE_DATA_MAXAGE_MAX)
204 return (SNMP_ERR_WRONG_VALUE);
205 ctx->scratch->int1 = bridge_data_maxage;
206 bridge_data_maxage = val->v.integer;
207 break;
208 case LEAF_begemotBridgeDataPoll:
209 if (val->v.integer < SNMP_BRIDGE_POLL_INTERVAL_MIN ||
210 val->v.integer > SNMP_BRIDGE_POLL_INTERVAL_MAX)
211 return (SNMP_ERR_WRONG_VALUE);
212 ctx->scratch->int1 = val->v.integer;
213 break;
214 }
215 return (SNMP_ERR_NOERROR);
216
217 case SNMP_OP_ROLLBACK:
218 switch (val->var.subs[sub - 1]) {
219 case LEAF_begemotBridgeDefaultBridgeIf:
--- 116 unchanged lines hidden ---
2 * Copyright (c) 2006 Shteryana Shopova <syrinx@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 11 unchanged lines hidden (view full) ---
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * Bridge MIB implementation for SNMPd.
27 *
28 * $FreeBSD: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.c 164997 2006-12-07 22:36:17Z syrinx $
29 */
30
31#include <sys/param.h>
32#include <sys/queue.h>
33#include <sys/socket.h>
34#include <sys/types.h>
35
36#include <net/ethernet.h>
--- 77 unchanged lines hidden (view full) ---
114 struct bridge_if *bif;
115
116 if (len >= IFNAMSIZ)
117 return (-1);
118
119 bcopy(bif_name, bif_default_name, len);
120 bif_default_name[len] = '\0';
121
122 if ((bif = bridge_if_find_ifname(bif_default_name)) == NULL) {
123 bif_default = NULL;
124 return (0);
125 }
126
127 bif_default = bif;
128 return (1);
129}
130
131int
132bridge_get_data_maxage(void)
133{
--- 60 unchanged lines hidden (view full) ---
194 bridge_get_default_name()) < 0)
195 return (SNMP_ERR_RES_UNAVAIL);
196
197 if (bridge_set_default_name(val->v.octetstring.octets,
198 val->v.octetstring.len) < 0)
199 return (SNMP_ERR_BADVALUE);
200 break;
201 case LEAF_begemotBridgeDataUpdate:
202 if (val->v.integer < SNMP_BRIDGE_DATA_MAXAGE_MIN ||
203 val->v.integer > SNMP_BRIDGE_DATA_MAXAGE_MAX)
204 return (SNMP_ERR_WRONG_VALUE);
205 ctx->scratch->int1 = bridge_data_maxage;
206 bridge_data_maxage = val->v.integer;
207 break;
208 case LEAF_begemotBridgeDataPoll:
209 if (val->v.integer < SNMP_BRIDGE_POLL_INTERVAL_MIN ||
210 val->v.integer > SNMP_BRIDGE_POLL_INTERVAL_MAX)
211 return (SNMP_ERR_WRONG_VALUE);
212 ctx->scratch->int1 = val->v.integer;
213 break;
214 }
215 return (SNMP_ERR_NOERROR);
216
217 case SNMP_OP_ROLLBACK:
218 switch (val->var.subs[sub - 1]) {
219 case LEAF_begemotBridgeDefaultBridgeIf:
--- 116 unchanged lines hidden ---