bridge_port.c (165416) | bridge_port.c (171791) |
---|---|
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 165416 2006-12-20 22:02:45Z syrinx $ | 29 * $FreeBSD: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c 171791 2007-08-08 19:27:50Z 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> --- 1031 unchanged lines hidden (view full) --- 1069 return (SNMP_ERR_NOERROR); 1070} 1071 1072int 1073op_begemot_base_port(struct snmp_context *ctx, struct snmp_value *val, 1074 uint sub, uint iidx __unused, enum snmp_op op) 1075{ 1076 int8_t status, which; | 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> --- 1031 unchanged lines hidden (view full) --- 1069 return (SNMP_ERR_NOERROR); 1070} 1071 1072int 1073op_begemot_base_port(struct snmp_context *ctx, struct snmp_value *val, 1074 uint sub, uint iidx __unused, enum snmp_op op) 1075{ 1076 int8_t status, which; |
1077 const char *bname; |
|
1077 struct bridge_port *bp; 1078 1079 if (time(NULL) - ports_list_age > bridge_get_data_maxage()) 1080 bridge_update_all_ports(); 1081 1082 which = val->var.subs[sub - 1]; 1083 status = 0; 1084 --- 20 unchanged lines hidden (view full) --- 1105 case SNMP_OP_SET: 1106 switch (which) { 1107 case LEAF_begemotBridgeBaseSpanEnabled: 1108 return (bridge_port_set_span_enable(ctx, val, sub)); 1109 1110 case LEAF_begemotBridgeBasePortStatus: 1111 return (bridge_port_set_status(ctx, val, sub)); 1112 | 1078 struct bridge_port *bp; 1079 1080 if (time(NULL) - ports_list_age > bridge_get_data_maxage()) 1081 bridge_update_all_ports(); 1082 1083 which = val->var.subs[sub - 1]; 1084 status = 0; 1085 --- 20 unchanged lines hidden (view full) --- 1106 case SNMP_OP_SET: 1107 switch (which) { 1108 case LEAF_begemotBridgeBaseSpanEnabled: 1109 return (bridge_port_set_span_enable(ctx, val, sub)); 1110 1111 case LEAF_begemotBridgeBasePortStatus: 1112 return (bridge_port_set_status(ctx, val, sub)); 1113 |
1114 case LEAF_begemotBridgeBasePortPrivate: 1115 if ((bp = bridge_port_index_get(&val->var, sub, 1116 status)) == NULL) 1117 return (SNMP_ERR_NOSUCHNAME); 1118 if ((bname = bridge_if_find_name(bp->sysindex)) == NULL) 1119 return (SNMP_ERR_GENERR); 1120 ctx->scratch->int1 = bp->priv_set; 1121 return (bridge_port_set_private(bname, bp, 1122 val->v.integer)); 1123 |
|
1113 case LEAF_begemotBridgeBasePort: 1114 case LEAF_begemotBridgeBasePortIfIndex: 1115 case LEAF_begemotBridgeBasePortDelayExceededDiscards: 1116 case LEAF_begemotBridgeBasePortMtuExceededDiscards: 1117 return (SNMP_ERR_NOT_WRITEABLE); 1118 } 1119 abort(); 1120 1121 case SNMP_OP_ROLLBACK: 1122 switch (which) { 1123 case LEAF_begemotBridgeBaseSpanEnabled: 1124 /* FALLTHROUGH */ 1125 case LEAF_begemotBridgeBasePortStatus: 1126 return (bridge_port_rollback_status(ctx, val, sub)); | 1124 case LEAF_begemotBridgeBasePort: 1125 case LEAF_begemotBridgeBasePortIfIndex: 1126 case LEAF_begemotBridgeBasePortDelayExceededDiscards: 1127 case LEAF_begemotBridgeBasePortMtuExceededDiscards: 1128 return (SNMP_ERR_NOT_WRITEABLE); 1129 } 1130 abort(); 1131 1132 case SNMP_OP_ROLLBACK: 1133 switch (which) { 1134 case LEAF_begemotBridgeBaseSpanEnabled: 1135 /* FALLTHROUGH */ 1136 case LEAF_begemotBridgeBasePortStatus: 1137 return (bridge_port_rollback_status(ctx, val, sub)); |
1138 case LEAF_begemotBridgeBasePortPrivate: 1139 if ((bp = bridge_port_index_get(&val->var, sub, 1140 status)) == NULL) 1141 return (SNMP_ERR_GENERR); 1142 if ((bname = bridge_if_find_name(bp->sysindex)) == NULL) 1143 return (SNMP_ERR_GENERR); 1144 return (bridge_port_set_private(bname, bp, 1145 ctx->scratch->int1)); |
|
1127 } 1128 return (SNMP_ERR_NOERROR); 1129 1130 case SNMP_OP_COMMIT: 1131 if (which == LEAF_begemotBridgeBasePortStatus) 1132 return (bridge_port_commit_status(val, sub)); 1133 1134 return (SNMP_ERR_NOERROR); --- 20 unchanged lines hidden (view full) --- 1155 1156 case LEAF_begemotBridgeBasePortMtuExceededDiscards: 1157 val->v.uint32 = bp->dly_mtu_drops; 1158 return (SNMP_ERR_NOERROR); 1159 1160 case LEAF_begemotBridgeBasePortStatus: 1161 val->v.integer = bp->status; 1162 return (SNMP_ERR_NOERROR); | 1146 } 1147 return (SNMP_ERR_NOERROR); 1148 1149 case SNMP_OP_COMMIT: 1150 if (which == LEAF_begemotBridgeBasePortStatus) 1151 return (bridge_port_commit_status(val, sub)); 1152 1153 return (SNMP_ERR_NOERROR); --- 20 unchanged lines hidden (view full) --- 1174 1175 case LEAF_begemotBridgeBasePortMtuExceededDiscards: 1176 val->v.uint32 = bp->dly_mtu_drops; 1177 return (SNMP_ERR_NOERROR); 1178 1179 case LEAF_begemotBridgeBasePortStatus: 1180 val->v.integer = bp->status; 1181 return (SNMP_ERR_NOERROR); |
1182 1183 case LEAF_begemotBridgeBasePortPrivate: 1184 val->v.integer = bp->priv_set; 1185 return (SNMP_ERR_NOERROR); |
|
1163 } 1164 1165 abort(); 1166} 1167 1168int 1169op_begemot_stp_port(struct snmp_context *ctx, struct snmp_value *val, 1170 uint sub, uint iidx __unused, enum snmp_op op) --- 320 unchanged lines hidden --- | 1186 } 1187 1188 abort(); 1189} 1190 1191int 1192op_begemot_stp_port(struct snmp_context *ctx, struct snmp_value *val, 1193 uint sub, uint iidx __unused, enum snmp_op op) --- 320 unchanged lines hidden --- |