Skip to content

Commit ce42bb0

Browse files
Jonas Berghefloryd
authored andcommitted
Make sure Linux SNMP loops over all ports with peers
1 parent 91661db commit ce42bb0

File tree

4 files changed

+40
-41
lines changed

4 files changed

+40
-41
lines changed

src/ports/linux/mib/lldpRemManAddrTable.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,21 @@ netsnmp_variable_list * lldpRemManAddrTable_get_next_data_point (
122122
int error;
123123

124124
iterator = (pf_port_iterator_t *)*my_loop_context;
125-
port = pf_snmp_get_next_port (iterator);
126-
if (port == 0)
127-
{
128-
return NULL;
129-
}
130125

131-
error = pf_snmp_get_peer_timestamp (pnet, port, &timestamp);
132-
if (error)
126+
do
133127
{
134-
return NULL;
135-
}
136-
error = pf_snmp_get_peer_management_address (pnet, port, &address);
137-
if (error)
138-
{
139-
return NULL;
140-
}
128+
port = pf_snmp_get_next_port (iterator);
129+
if (port == 0)
130+
{
131+
return NULL;
132+
}
133+
134+
error = pf_snmp_get_peer_timestamp (pnet, port, &timestamp);
135+
if (error == 0)
136+
{
137+
error = pf_snmp_get_peer_management_address (pnet, port, &address);
138+
}
139+
} while (error);
141140

142141
snmp_set_var_typed_integer (idx, ASN_TIMETICKS, timestamp);
143142
idx = idx->next_variable;

src/ports/linux/mib/lldpRemTable.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,17 @@ netsnmp_variable_list * lldpRemTable_get_next_data_point (
118118
int error;
119119

120120
iterator = (pf_port_iterator_t *)*my_loop_context;
121-
port = pf_snmp_get_next_port (iterator);
122-
if (port == 0)
123-
{
124-
return NULL;
125-
}
126121

127-
error = pf_snmp_get_peer_timestamp (pnet, port, &timestamp);
128-
if (error)
122+
do
129123
{
130-
return NULL;
131-
}
124+
port = pf_snmp_get_next_port (iterator);
125+
if (port == 0)
126+
{
127+
return NULL;
128+
}
129+
130+
error = pf_snmp_get_peer_timestamp (pnet, port, &timestamp);
131+
} while (error);
132132

133133
snmp_set_var_typed_integer (idx, ASN_TIMETICKS, timestamp);
134134
idx = idx->next_variable;

src/ports/linux/mib/lldpXPnoRemTable.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,17 @@ netsnmp_variable_list * lldpXPnoRemTable_get_next_data_point (
118118
int error;
119119

120120
iterator = (pf_port_iterator_t *)*my_loop_context;
121-
port = pf_snmp_get_next_port (iterator);
122-
if (port == 0)
123-
{
124-
return NULL;
125-
}
126121

127-
error = pf_snmp_get_peer_timestamp (pnet, port, &timestamp);
128-
if (error)
122+
do
129123
{
130-
return NULL;
131-
}
124+
port = pf_snmp_get_next_port (iterator);
125+
if (port == 0)
126+
{
127+
return NULL;
128+
}
129+
130+
error = pf_snmp_get_peer_timestamp (pnet, port, &timestamp);
131+
} while (error);
132132

133133
snmp_set_var_typed_integer (idx, ASN_TIMETICKS, timestamp);
134134
idx = idx->next_variable;

src/ports/linux/mib/lldpXdot3RemPortTable.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,17 @@ netsnmp_variable_list * lldpXdot3RemPortTable_get_next_data_point (
120120
int error;
121121

122122
iterator = (pf_port_iterator_t *)*my_loop_context;
123-
port = pf_snmp_get_next_port (iterator);
124-
if (port == 0)
125-
{
126-
return NULL;
127-
}
128123

129-
error = pf_snmp_get_peer_timestamp (pnet, port, &timestamp);
130-
if (error)
124+
do
131125
{
132-
return NULL;
133-
}
126+
port = pf_snmp_get_next_port (iterator);
127+
if (port == 0)
128+
{
129+
return NULL;
130+
}
131+
132+
error = pf_snmp_get_peer_timestamp (pnet, port, &timestamp);
133+
} while (error);
134134

135135
snmp_set_var_typed_integer (idx, ASN_TIMETICKS, timestamp);
136136
idx = idx->next_variable;

0 commit comments

Comments
 (0)