FaradayRF / Faraday-Software

Faraday node software
https://www.faradayrf.com
Other
48 stars 19 forks source link

Proxy 164 byte packet expectation #26

Closed kb1lqd closed 7 years ago

kb1lqd commented 7 years ago

Proxy.py: https://github.com/FaradayRF/Faraday-Software/blob/master/proxy/proxy.py

While writing the device configuration program I found that the Proxy program POST expected 164 byte items and this doesn't make much sense. @kb1lqc informed me that this was because of the fixed packet length of the UART layer 4 protocol.

This doesn't make sense because fixed packets are 128 byte's in total prior to framing. The only reasonable explanation is that 164 bytes were a chance length from his testing of telemetry packets and are a result of the specific case of testing and BASE64 encoding size increase. This length would likely change with different data POSTed.

The POST command filtering data for fixed length to avoid random data is pretty useless because:

image

total = len(data["data"])
            sent = 0
            for item in data['data']:
                if len(item) != 164:
                    logger.warning("Packet not 164 characters long!")
                    logger.warning(str(item))
                else:
                    # Correct length packet, send it by putting on the queue!
                    try:
                        postDicts[station][port].append(item)
                    except:
                        postDicts[station][port] = deque([], maxlen=100)
                        postDicts[station][port].append(item)
                    sent += 1
            return json.dumps(
                {"status": "Posted {0} of {1} Packet(s)"
                    .format(sent, total)}), 200
kb1lqd commented 7 years ago

I rigged up a test to figure out what was going on and the summary is:

Application This was the snippet of code that sent a POST command to the Proxy server: image

using a POSTMAN test call:

image

Proxy

The code was modified to print data information and shows:

image

kb1lqd commented 7 years ago

I modified Proxy to NOT filter packet length and the results were a success!

image

The text string "Testing new application!" was successfully received on the CC430 Faraday!

image

I see no harm in removing the POSTed data check for data in Proxy and it will follow the methodology of isolating layers and mediums from eachother when possible.

kb1lqd commented 7 years ago

This bug was resolved by removing the 164 byte check completely in merger #28