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 164410 2006-11-19 15:42:48Z 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 return (0);
124
125 bif_default = bif;
126 return (1);
127}
128
129int
130bridge_get_data_maxage(void)
131{
--- 60 unchanged lines hidden (view full) ---
192 bridge_get_default_name()) < 0)
193 return (SNMP_ERR_RES_UNAVAIL);
194
195 if (bridge_set_default_name(val->v.octetstring.octets,
196 val->v.octetstring.len) < 0)
197 return (SNMP_ERR_BADVALUE);
198 break;
199 case LEAF_begemotBridgeDataUpdate:
200 ctx->scratch->int1 = bridge_data_maxage;
201 bridge_data_maxage = val->v.integer;
202 break;
203 case LEAF_begemotBridgeDataPoll:
204 ctx->scratch->int1 = val->v.integer;
205 break;
206 }
207 return (SNMP_ERR_NOERROR);
208
209 case SNMP_OP_ROLLBACK:
210 switch (val->var.subs[sub - 1]) {
211 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 164410 2006-11-19 15:42:48Z 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 return (0);
124
125 bif_default = bif;
126 return (1);
127}
128
129int
130bridge_get_data_maxage(void)
131{
--- 60 unchanged lines hidden (view full) ---
192 bridge_get_default_name()) < 0)
193 return (SNMP_ERR_RES_UNAVAIL);
194
195 if (bridge_set_default_name(val->v.octetstring.octets,
196 val->v.octetstring.len) < 0)
197 return (SNMP_ERR_BADVALUE);
198 break;
199 case LEAF_begemotBridgeDataUpdate:
200 ctx->scratch->int1 = bridge_data_maxage;
201 bridge_data_maxage = val->v.integer;
202 break;
203 case LEAF_begemotBridgeDataPoll:
204 ctx->scratch->int1 = val->v.integer;
205 break;
206 }
207 return (SNMP_ERR_NOERROR);
208
209 case SNMP_OP_ROLLBACK:
210 switch (val->var.subs[sub - 1]) {
211 case LEAF_begemotBridgeDefaultBridgeIf:
--- 116 unchanged lines hidden ---