Deleted Added
sdiff udiff text old ( 164410 ) new ( 164997 )
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 164410 2006-11-19 15:42:48Z 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>

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

669
670 return (ret);
671}
672
673int
674op_dot1d_stp(struct snmp_context *ctx, struct snmp_value *value,
675 uint sub, uint iidx __unused, enum snmp_op op)
676{
677 struct bridge_if *bif;
678
679 if ((bif = bridge_get_default()) == NULL)
680 return (SNMP_ERR_NOSUCHNAME);
681
682 if (time(NULL) - bif->entry_age > bridge_get_data_maxage() &&
683 bridge_update_bif(bif) <= 0) /* It was just deleted. */
684 return (SNMP_ERR_NOSUCHNAME);

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

738
739 case LEAF_dot1dStpBridgeHelloTime:
740 value->v.integer = bif->bridge_hello_time;
741 break;
742
743 case LEAF_dot1dStpBridgeForwardDelay:
744 value->v.integer = bif->bridge_fwd_delay;
745 break;
746 }
747
748 return (SNMP_ERR_NOERROR);
749
750 case SNMP_OP_GETNEXT:
751 abort();
752
753 case SNMP_OP_SET:
754 switch (value->var.subs[sub - 1]) {
755 case LEAF_dot1dStpPriority:
756 ctx->scratch->int1 = bif->priority;
757 if (bridge_set_priority(bif, value->v.integer) < 0)
758 return (SNMP_ERR_GENERR);
759 break;
760
761 case LEAF_dot1dStpBridgeMaxAge:
762 ctx->scratch->int1 = bif->bridge_max_age;
763 if (bridge_set_maxage(bif, value->v.integer) < 0)
764 return (SNMP_ERR_GENERR);
765 break;
766
767 case LEAF_dot1dStpBridgeHelloTime:
768 ctx->scratch->int1 = bif->bridge_hello_time;
769 if (bridge_set_hello_time(bif, value->v.integer) < 0)
770 return (SNMP_ERR_GENERR);
771 break;
772
773 case LEAF_dot1dStpBridgeForwardDelay:
774 ctx->scratch->int1 = bif->bridge_fwd_delay;
775 if (bridge_set_forward_delay(bif, value->v.integer) < 0)
776 return (SNMP_ERR_GENERR);
777 break;
778
779 case LEAF_dot1dStpProtocolSpecification:
780 case LEAF_dot1dStpTimeSinceTopologyChange:
781 case LEAF_dot1dStpTopChanges:
782 case LEAF_dot1dStpDesignatedRoot:
783 case LEAF_dot1dStpRootCost:
784 case LEAF_dot1dStpRootPort:
785 case LEAF_dot1dStpMaxAge:
786 case LEAF_dot1dStpHelloTime:
787 case LEAF_dot1dStpHoldTime:
788 case LEAF_dot1dStpForwardDelay:
789 return (SNMP_ERR_NOT_WRITEABLE);
790 }
791
792 return (SNMP_ERR_NOERROR);
793
794 case SNMP_OP_ROLLBACK:
795 switch (value->var.subs[sub - 1]) {
796 case LEAF_dot1dStpPriority:
797 (void) bridge_set_priority(bif, ctx->scratch->int1);
798 break;
799 case LEAF_dot1dStpBridgeMaxAge:
800 (void) bridge_set_maxage(bif, ctx->scratch->int1);
801 break;
802 case LEAF_dot1dStpBridgeHelloTime:
803 (void) bridge_set_hello_time(bif, ctx->scratch->int1);
804 break;
805 case LEAF_dot1dStpBridgeForwardDelay:
806 (void) bridge_set_forward_delay(bif,
807 ctx->scratch->int1);
808 break;
809 }
810 return (SNMP_ERR_NOERROR);
811
812 case SNMP_OP_COMMIT:
813 return (SNMP_ERR_NOERROR);
814 }
815
816 return (SNMP_ERR_NOERROR);

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

849 ctx->scratch->int1 = bif->age_time;
850 if (bridge_set_aging_time(bif, value->v.integer) < 0)
851 return (SNMP_ERR_GENERR);
852 }
853 return (SNMP_ERR_NOERROR);
854
855 case SNMP_OP_ROLLBACK:
856 if (value->var.subs[sub - 1] == LEAF_dot1dTpAgingTime)
857 (void) bridge_set_aging_time(bif, ctx->scratch->int1);
858 return (SNMP_ERR_NOERROR);
859
860 case SNMP_OP_COMMIT:
861 return (SNMP_ERR_NOERROR);
862 }
863
864 return (SNMP_ERR_NOERROR);
865}

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

1176 ret = bridge_set_hello_time(bif, val->v.integer);
1177 break;
1178
1179 case LEAF_begemotBridgeStpBridgeForwardDelay:
1180 ctx->scratch->int1 = bif->bridge_fwd_delay;
1181 ret = bridge_set_forward_delay(bif, val->v.integer);
1182 break;
1183
1184 case LEAF_begemotBridgeStpProtocolSpecification:
1185 case LEAF_begemotBridgeStpTimeSinceTopologyChange:
1186 case LEAF_begemotBridgeStpTopChanges:
1187 case LEAF_begemotBridgeStpDesignatedRoot:
1188 case LEAF_begemotBridgeStpRootCost:
1189 case LEAF_begemotBridgeStpRootPort:
1190 case LEAF_begemotBridgeStpMaxAge:
1191 case LEAF_begemotBridgeStpHelloTime:

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

1215
1216 case LEAF_begemotBridgeStpBridgeHelloTime:
1217 bridge_set_hello_time(bif, ctx->scratch->int1);
1218 break;
1219
1220 case LEAF_begemotBridgeStpBridgeForwardDelay:
1221 bridge_set_forward_delay(bif, ctx->scratch->int1);
1222 break;
1223 }
1224 return (SNMP_ERR_NOERROR);
1225
1226 case SNMP_OP_COMMIT:
1227 return (SNMP_ERR_NOERROR);
1228 }
1229
1230 switch (val->var.subs[sub - 1]) {

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

1279
1280 case LEAF_begemotBridgeStpBridgeHelloTime:
1281 val->v.integer = bif->bridge_hello_time;
1282 break;
1283
1284 case LEAF_begemotBridgeStpBridgeForwardDelay:
1285 val->v.integer = bif->bridge_fwd_delay;
1286 break;
1287 }
1288
1289 return (ret);
1290}
1291
1292int
1293op_begemot_tp(struct snmp_context *ctx, struct snmp_value *val,
1294 uint sub, uint iidx __unused, enum snmp_op op)

--- 75 unchanged lines hidden ---