Deleted Added
full compact
bridge_port.c (165253) bridge_port.c (165416)
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 ports.
28 *
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 ports.
28 *
29 * $FreeBSD: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c 165253 2006-12-15 20:01:57Z syrinx $
29 * $FreeBSD: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c 165416 2006-12-20 22:02:45Z syrinx $
30 */
31
32#include <sys/queue.h>
33#include <sys/socket.h>
34#include <sys/types.h>
35
36#include <net/ethernet.h>
37#include <net/if.h>

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

277 /*
278 * Initialize all rstpMib specific values to false/default.
279 * These will be set to their true values later if the bridge
280 * supports RSTP.
281 */
282 bp->proto_migr = TruthValue_false;
283 bp->admin_edge = TruthValue_false;
284 bp->oper_edge = TruthValue_false;
30 */
31
32#include <sys/queue.h>
33#include <sys/socket.h>
34#include <sys/types.h>
35
36#include <net/ethernet.h>
37#include <net/if.h>

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

277 /*
278 * Initialize all rstpMib specific values to false/default.
279 * These will be set to their true values later if the bridge
280 * supports RSTP.
281 */
282 bp->proto_migr = TruthValue_false;
283 bp->admin_edge = TruthValue_false;
284 bp->oper_edge = TruthValue_false;
285 bp->oper_p2p = TruthValue_false;
286 bp->admin_p2p = StpPortAdminPointToPointType_auto;
285 bp->oper_ptp = TruthValue_false;
286 bp->admin_ptp = StpPortAdminPointToPointType_auto;
287
288 bridge_port_memif_insert(&bridge_ports, bp, &(bif->f_bp));
289
290 return (bp);
291}
292
293/*
294 * Update our info from the corresponding mibII interface info.

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

625 return (SNMP_ERR_GENERR);
626 return (SNMP_ERR_NOERROR);
627
628 case LEAF_dot1dStpPortAdminPointToPoint:
629 if (val->v.integer < 0 || val->v.integer >
630 StpPortAdminPointToPointType_auto)
631 return (SNMP_ERR_WRONG_VALUE);
632
287
288 bridge_port_memif_insert(&bridge_ports, bp, &(bif->f_bp));
289
290 return (bp);
291}
292
293/*
294 * Update our info from the corresponding mibII interface info.

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

625 return (SNMP_ERR_GENERR);
626 return (SNMP_ERR_NOERROR);
627
628 case LEAF_dot1dStpPortAdminPointToPoint:
629 if (val->v.integer < 0 || val->v.integer >
630 StpPortAdminPointToPointType_auto)
631 return (SNMP_ERR_WRONG_VALUE);
632
633 ctx->scratch->int1 = bp->admin_p2p;
634 if (bridge_port_set_admin_p2p(bif->bif_name, bp,
633 ctx->scratch->int1 = bp->admin_ptp;
634 if (bridge_port_set_admin_ptp(bif->bif_name, bp,
635 val->v.integer) < 0)
636 return (SNMP_ERR_GENERR);
637 return (SNMP_ERR_NOERROR);
638
639 case LEAF_dot1dStpPortAdminPathCost:
640 if (val->v.integer < SNMP_PORT_MIN_PATHCOST ||
641 val->v.integer > SNMP_PORT_MAX_PATHCOST)
642 return (SNMP_ERR_WRONG_VALUE);

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

660 return (SNMP_ERR_GENERR);
661
662 switch (val->var.subs[sub - 1]) {
663 case LEAF_dot1dStpPortAdminEdgePort:
664 bridge_port_set_admin_edge(bif->bif_name, bp,
665 ctx->scratch->int1);
666 break;
667 case LEAF_dot1dStpPortAdminPointToPoint:
635 val->v.integer) < 0)
636 return (SNMP_ERR_GENERR);
637 return (SNMP_ERR_NOERROR);
638
639 case LEAF_dot1dStpPortAdminPathCost:
640 if (val->v.integer < SNMP_PORT_MIN_PATHCOST ||
641 val->v.integer > SNMP_PORT_MAX_PATHCOST)
642 return (SNMP_ERR_WRONG_VALUE);

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

660 return (SNMP_ERR_GENERR);
661
662 switch (val->var.subs[sub - 1]) {
663 case LEAF_dot1dStpPortAdminEdgePort:
664 bridge_port_set_admin_edge(bif->bif_name, bp,
665 ctx->scratch->int1);
666 break;
667 case LEAF_dot1dStpPortAdminPointToPoint:
668 bridge_port_set_admin_p2p(bif->bif_name, bp,
668 bridge_port_set_admin_ptp(bif->bif_name, bp,
669 ctx->scratch->int1);
670 break;
671 case LEAF_dot1dStpPortAdminPathCost:
672 bridge_port_set_path_cost(bif->bif_name, bp,
673 ctx->scratch->int1);
674 break;
675 }
676 return (SNMP_ERR_NOERROR);

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

690 val->v.integer = bp->admin_edge;
691 return (SNMP_ERR_NOERROR);
692
693 case LEAF_dot1dStpPortOperEdgePort:
694 val->v.integer = bp->oper_edge;
695 return (SNMP_ERR_NOERROR);
696
697 case LEAF_dot1dStpPortAdminPointToPoint:
669 ctx->scratch->int1);
670 break;
671 case LEAF_dot1dStpPortAdminPathCost:
672 bridge_port_set_path_cost(bif->bif_name, bp,
673 ctx->scratch->int1);
674 break;
675 }
676 return (SNMP_ERR_NOERROR);

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

690 val->v.integer = bp->admin_edge;
691 return (SNMP_ERR_NOERROR);
692
693 case LEAF_dot1dStpPortOperEdgePort:
694 val->v.integer = bp->oper_edge;
695 return (SNMP_ERR_NOERROR);
696
697 case LEAF_dot1dStpPortAdminPointToPoint:
698 val->v.integer = bp->admin_p2p;
698 val->v.integer = bp->admin_ptp;
699 return (SNMP_ERR_NOERROR);
700
701 case LEAF_dot1dStpPortOperPointToPoint:
699 return (SNMP_ERR_NOERROR);
700
701 case LEAF_dot1dStpPortOperPointToPoint:
702 val->v.integer = bp->oper_p2p;
702 val->v.integer = bp->oper_ptp;
703 return (SNMP_ERR_NOERROR);
704
705 case LEAF_dot1dStpPortAdminPathCost:
706 val->v.integer = bp->admin_path_cost;
707 return (SNMP_ERR_NOERROR);
708 }
709
710 abort();

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

1348 return (SNMP_ERR_GENERR);
1349 return (SNMP_ERR_NOERROR);
1350
1351 case LEAF_begemotBridgeStpPortAdminPointToPoint:
1352 if (val->v.integer < 0 || val->v.integer >
1353 StpPortAdminPointToPointType_auto)
1354 return (SNMP_ERR_WRONG_VALUE);
1355
703 return (SNMP_ERR_NOERROR);
704
705 case LEAF_dot1dStpPortAdminPathCost:
706 val->v.integer = bp->admin_path_cost;
707 return (SNMP_ERR_NOERROR);
708 }
709
710 abort();

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

1348 return (SNMP_ERR_GENERR);
1349 return (SNMP_ERR_NOERROR);
1350
1351 case LEAF_begemotBridgeStpPortAdminPointToPoint:
1352 if (val->v.integer < 0 || val->v.integer >
1353 StpPortAdminPointToPointType_auto)
1354 return (SNMP_ERR_WRONG_VALUE);
1355
1356 ctx->scratch->int1 = bp->admin_p2p;
1357 if (bridge_port_set_admin_p2p(b_name, bp,
1356 ctx->scratch->int1 = bp->admin_ptp;
1357 if (bridge_port_set_admin_ptp(b_name, bp,
1358 val->v.integer) < 0)
1359 return (SNMP_ERR_GENERR);
1360 return (SNMP_ERR_NOERROR);
1361
1362 case LEAF_begemotBridgeStpPortAdminPathCost:
1363 if (val->v.integer < SNMP_PORT_MIN_PATHCOST ||
1364 val->v.integer > SNMP_PORT_MAX_PATHCOST)
1365 return (SNMP_ERR_WRONG_VALUE);

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

1383 return (SNMP_ERR_GENERR);
1384
1385 switch (val->var.subs[sub - 1]) {
1386 case LEAF_begemotBridgeStpPortAdminEdgePort:
1387 bridge_port_set_admin_edge(b_name, bp,
1388 ctx->scratch->int1);
1389 break;
1390 case LEAF_begemotBridgeStpPortAdminPointToPoint:
1358 val->v.integer) < 0)
1359 return (SNMP_ERR_GENERR);
1360 return (SNMP_ERR_NOERROR);
1361
1362 case LEAF_begemotBridgeStpPortAdminPathCost:
1363 if (val->v.integer < SNMP_PORT_MIN_PATHCOST ||
1364 val->v.integer > SNMP_PORT_MAX_PATHCOST)
1365 return (SNMP_ERR_WRONG_VALUE);

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

1383 return (SNMP_ERR_GENERR);
1384
1385 switch (val->var.subs[sub - 1]) {
1386 case LEAF_begemotBridgeStpPortAdminEdgePort:
1387 bridge_port_set_admin_edge(b_name, bp,
1388 ctx->scratch->int1);
1389 break;
1390 case LEAF_begemotBridgeStpPortAdminPointToPoint:
1391 bridge_port_set_admin_p2p(b_name, bp,
1391 bridge_port_set_admin_ptp(b_name, bp,
1392 ctx->scratch->int1);
1393 break;
1394 case LEAF_begemotBridgeStpPortAdminPathCost:
1395 bridge_port_set_path_cost(b_name, bp,
1396 ctx->scratch->int1);
1397 break;
1398 }
1399 return (SNMP_ERR_NOERROR);

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

1413 val->v.integer = bp->admin_edge;
1414 return (SNMP_ERR_NOERROR);
1415
1416 case LEAF_begemotBridgeStpPortOperEdgePort:
1417 val->v.integer = bp->oper_edge;
1418 return (SNMP_ERR_NOERROR);
1419
1420 case LEAF_begemotBridgeStpPortAdminPointToPoint:
1392 ctx->scratch->int1);
1393 break;
1394 case LEAF_begemotBridgeStpPortAdminPathCost:
1395 bridge_port_set_path_cost(b_name, bp,
1396 ctx->scratch->int1);
1397 break;
1398 }
1399 return (SNMP_ERR_NOERROR);

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

1413 val->v.integer = bp->admin_edge;
1414 return (SNMP_ERR_NOERROR);
1415
1416 case LEAF_begemotBridgeStpPortOperEdgePort:
1417 val->v.integer = bp->oper_edge;
1418 return (SNMP_ERR_NOERROR);
1419
1420 case LEAF_begemotBridgeStpPortAdminPointToPoint:
1421 val->v.integer = bp->admin_p2p;
1421 val->v.integer = bp->admin_ptp;
1422 return (SNMP_ERR_NOERROR);
1423
1424 case LEAF_begemotBridgeStpPortOperPointToPoint:
1422 return (SNMP_ERR_NOERROR);
1423
1424 case LEAF_begemotBridgeStpPortOperPointToPoint:
1425 val->v.integer = bp->oper_p2p;
1425 val->v.integer = bp->oper_ptp;
1426 return (SNMP_ERR_NOERROR);
1427
1428 case LEAF_begemotBridgeStpPortAdminPathCost:
1429 val->v.integer = bp->admin_path_cost;
1430 return (SNMP_ERR_NOERROR);
1431 }
1432
1433 abort();

--- 57 unchanged lines hidden ---
1426 return (SNMP_ERR_NOERROR);
1427
1428 case LEAF_begemotBridgeStpPortAdminPathCost:
1429 val->v.integer = bp->admin_path_cost;
1430 return (SNMP_ERR_NOERROR);
1431 }
1432
1433 abort();

--- 57 unchanged lines hidden ---