Permalink
Browse files

fix invalid return values from snmpTargetAddrExtTable

The is_set_ok/set callbacks from the snmpTargetAddrExtTable handlers can
return invalid column numbers in error responses. They store their data in
snmpTargetAddrTable from column #11 onwards and correctly convert the
column numbers before calling the generic table handler. When that
returns an error, however, the errorneous column number remains at >10
and causes a genErr in the further SNMP processing. Fix that by looking
for error responses from the generic table handler and correcting column
numbers therein.
  • Loading branch information...
1 parent b974565 commit 9e8e5726f294eb058ea7fccd37d216075d9ee523 Stefan Zegenhagen committed with proxyles Aug 31, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/snmp/src/agent/snmp_community_mib.erl
@@ -509,17 +509,17 @@ snmpTargetAddrExtTable(set, RowIndex, Cols0) ->
case (catch verify_snmpTargetAddrExtTable_cols(Cols0, [])) of
{ok, Cols} ->
NCols = conv3(Cols),
- snmp_generic:table_func(set, RowIndex, NCols,
- db(snmpTargetAddrExtTable));
+ conv4(snmp_generic:table_func(set, RowIndex, NCols,
+ db(snmpTargetAddrExtTable)));
Error ->
Error
end;
snmpTargetAddrExtTable(is_set_ok, RowIndex, Cols0) ->
case (catch verify_snmpTargetAddrExtTable_cols(Cols0, [])) of
{ok, Cols} ->
NCols = conv3(Cols),
- snmp_generic:table_func(is_set_ok, RowIndex, NCols,
- db(snmpTargetAddrExtTable));
+ conv4(snmp_generic:table_func(is_set_ok, RowIndex, NCols,
+ db(snmpTargetAddrExtTable)));
Error ->
Error
end.
@@ -583,6 +583,10 @@ conv3([{Idx, Val}|T]) -> [{Idx+10, Val} | conv3(T)];
conv3([]) -> [].
+conv4({ErrAtom, ErrIdx}) -> {ErrAtom, ErrIdx - 10};
+conv4(X) -> X.
+
+
get(Name, RowIndex, Cols) ->
snmp_generic:handle_table_get(db(Name), RowIndex, Cols, foi(Name)).

0 comments on commit 9e8e572

Please sign in to comment.