Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AgentX error seen if Transceiver_info table contains bad string #239

Open
SuvarnaMeenakshi opened this issue Dec 29, 2021 · 1 comment
Open

Comments

@SuvarnaMeenakshi
Copy link
Contributor

SuvarnaMeenakshi commented Dec 29, 2021

Description

ERROR: Uncaught AgentX proto error is seen if TRANSCEIVER_INFO table has bad string in one of the fields.

Steps to reproduce the issue:

  1. Bring up any DUT with master image or 2021x branch.
  2. Inject bad string in any of the fields in TRANSCEIVER_DB. (redis-cli -n 6 ; HSET "TRANSCEIVER_INFO|Ethernet48" "hardware_rev" "\xff\xff")
  3. Perform snmpwalk on transceiver MIB, snmpwalk -v2c -c public 127.0.0.1 iso.3.6.1.2.1.47.1.1.1.1.

Describe the results you received:
snmpagent will restart with the below error:

ERR snmp#snmp-subagent [ax_interface] ERROR: Uncaught AgentX proto error! [b'\x01\x06\x10\x00\x00\x00\x00\x06\x00\x00/\xd4\x00\x00/\xd5\x00\x00\x00D\x08\x02\x00\x00\x00\x00\x00\x01\x00\x00\x00/\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x08;\x9a\xdb\xc6\x07\x02\x00\x00\x00\x00\x00\x01\x00\x00\x00/\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\t']#012Traceback (most recent call last):#012  File "/usr/local/lib/python3.7/dist-packages/ax_interface/protocol.py", line 138, in data_received#012    response_pdu = pdu.make_response(self.mib_table)#012  File "/usr/local/lib/python3.7/dist-packages/ax_interface/pdu_implementations.py", line 289, in make_response#012    vr = lut.get_next(sr)#012  File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 359, in get_next#012    vr = self._get_nextvalue(parent_mib_entry, start_key)#012  File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 317, in _get_nextvalue#012    vr = ValueRepresentation.from_typecast(mib_entry.value_type, oid1, val1)#012  File "/usr/local/lib/python3.7/dist-packages/ax_interface/encodings.py", line 247, in from_typecast#012    _data = OctetString.from_string(data)#012  File "/usr/local/lib/python3.7/dist-packages/ax_interface/encodings.py", line 153, in from_string#012    _string = bytes(string, 'latin-1') if type(string) is str else string#012UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)

Describe the results you expected:
AgentX should not crash due to bad string in Transceiver DB. Agentx should be stable and should validate strings that is read from DB table which is populated by external daemons.

Additional information you deem important (e.g. issue happens only occasionally):

**Output of `show version`:**

```
(paste your output here)
```

**Attach debug file `sudo generate_dump`:**

```
(paste your output here)
```
@qiluo-msft
Copy link
Contributor

Another test case \xdcff\xdcff triggers another bug we found during debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants