Deleted Added
sdiff udiff text old ( 164997 ) new ( 165046 )
full compact
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

--- 12 unchanged lines hidden (view full) ---

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 * Bridge interface objects.
28 *
29 * $FreeBSD: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c 164997 2006-12-07 22:36:17Z syrinx $
30 */
31
32#include <sys/queue.h>
33#include <sys/socket.h>
34#include <sys/time.h>
35#include <sys/types.h>
36
37#include <net/ethernet.h>

--- 1053 unchanged lines hidden (view full) ---

1091 return (SNMP_ERR_NOERROR);
1092}
1093
1094int
1095op_begemot_base_bridge(struct snmp_context *ctx, struct snmp_value *val,
1096 uint sub, uint iidx __unused, enum snmp_op op)
1097{
1098 int ret;
1099 struct bridge_if *bif = NULL;
1100
1101 if (time(NULL) - bridge_list_age > bridge_get_data_maxage())
1102 bridge_update_all_ifs();
1103
1104 switch (op) {
1105 case SNMP_OP_GET:
1106 if ((bif = bridge_if_index_get(&val->var, sub)) == NULL)
1107 return (SNMP_ERR_NOSUCHNAME);

--- 14 unchanged lines hidden (view full) ---

1122 case LEAF_begemotBridgeBaseNumPorts:
1123 case LEAF_begemotBridgeBaseType:
1124 return (SNMP_ERR_NOT_WRITEABLE);
1125 }
1126 abort();
1127
1128 case SNMP_OP_ROLLBACK:
1129 return (bridge_rollback_if_status(ctx, val, sub));
1130 case SNMP_OP_COMMIT:
1131 return (bridge_commit_if_status(val, sub));
1132 }
1133
1134 ret = SNMP_ERR_NOERROR;
1135 switch (val->var.subs[sub - 1]) {
1136 case LEAF_begemotBridgeBaseName:
1137 ret = string_get(val, bif->bif_name, -1);
1138 break;
1139

--- 16 unchanged lines hidden (view full) ---

1156
1157 return (ret);
1158}
1159
1160int
1161op_begemot_stp(struct snmp_context *ctx, struct snmp_value *val,
1162 uint sub, uint iidx __unused, enum snmp_op op)
1163{
1164 int ret = SNMP_ERR_NOERROR; /* Make the compiler happy. */
1165 struct bridge_if *bif = NULL;
1166
1167 if (time(NULL) - bridge_list_age > bridge_get_data_maxage())
1168 bridge_update_all_ifs();
1169
1170 switch (op) {
1171 case SNMP_OP_GET:
1172 if ((bif = bridge_if_index_get(&val->var, sub)) == NULL)
1173 return (SNMP_ERR_NOSUCHNAME);

--- 46 unchanged lines hidden (view full) ---

1220 case LEAF_begemotBridgeStpDesignatedRoot:
1221 case LEAF_begemotBridgeStpRootCost:
1222 case LEAF_begemotBridgeStpRootPort:
1223 case LEAF_begemotBridgeStpMaxAge:
1224 case LEAF_begemotBridgeStpHelloTime:
1225 case LEAF_begemotBridgeStpHoldTime:
1226 case LEAF_begemotBridgeStpForwardDelay:
1227 return (SNMP_ERR_NOT_WRITEABLE);
1228 }
1229
1230 if (ret == 0)
1231 return (SNMP_ERR_NOERROR);
1232 else if (ret == -2)
1233 return (SNMP_ERR_WRONG_VALUE);
1234 return (SNMP_ERR_GENERR);
1235

--- 25 unchanged lines hidden (view full) ---

1261 case LEAF_begemotBridgeStpTxHoldCount:
1262 bridge_set_tx_hold_count(bif, ctx->scratch->int1);
1263 break;
1264 }
1265 return (SNMP_ERR_NOERROR);
1266
1267 case SNMP_OP_COMMIT:
1268 return (SNMP_ERR_NOERROR);
1269 }
1270
1271 switch (val->var.subs[sub - 1]) {
1272 case LEAF_begemotBridgeStpProtocolSpecification:
1273 val->v.integer = bif->prot_spec;
1274 break;
1275
1276 case LEAF_begemotBridgeStpPriority:
1277 val->v.integer = bif->priority;
1278 break;

--- 58 unchanged lines hidden (view full) ---

1337
1338 return (ret);
1339}
1340
1341int
1342op_begemot_tp(struct snmp_context *ctx, struct snmp_value *val,
1343 uint sub, uint iidx __unused, enum snmp_op op)
1344{
1345 struct bridge_if *bif = NULL;
1346
1347 if (time(NULL) - bridge_list_age > bridge_get_data_maxage())
1348 bridge_update_all_ifs();
1349
1350 switch (op) {
1351 case SNMP_OP_GET:
1352 if ((bif = bridge_if_index_get(&val->var, sub)) == NULL)
1353 return (SNMP_ERR_NOSUCHNAME);

--- 39 unchanged lines hidden (view full) ---

1393 case LEAF_begemotBridgeTpMaxAddresses:
1394 bridge_set_max_cache(bif, ctx->scratch->int1);
1395 break;
1396 }
1397 return (SNMP_ERR_NOERROR);
1398
1399 case SNMP_OP_COMMIT:
1400 return (SNMP_ERR_NOERROR);
1401 }
1402
1403 switch (val->var.subs[sub - 1]) {
1404 case LEAF_begemotBridgeTpLearnedEntryDiscards:
1405 val->v.uint32 = bif->lrnt_drops;
1406 break;
1407
1408 case LEAF_begemotBridgeTpAgingTime:
1409 val->v.integer = bif->age_time;
1410 break;
1411
1412 case LEAF_begemotBridgeTpMaxAddresses:
1413 val->v.integer = bif->max_addrs;
1414 break;
1415 }
1416
1417 return (SNMP_ERR_NOERROR);
1418}