begeekmyfriend / smithsnmp

SNMP agent for monitoring
GNU General Public License v2.0
31 stars 17 forks source link

Fixes for external cflags parsing and endianess #5

Closed T-X closed 3 years ago

T-X commented 3 years ago

The following are a set of patches for smithsnmp related to its cflags parsing and endianess conversions. Those are needed to make smithsnmp usable when cross compiling it, for instance via in OpenWrt.

Patches first two patches (4e44b11, 76c6ddb) are simplifications and reduce the usage the custom HTON/NTOH macros. The third patch fixes message parsing issues observed on big endian machines (2919a96) and also replaces the remaining, custom HTON/NTOH byteswap macros with byteswap macros provided by the OS. The remaining four patches for scons fixes cross compiling and allows providing endianess from the build system via CCFLAGS or CFLAGS.

They were tested both on a big endian board (8devices Lima, MIPS) and a little endian board (Wallys DR4029, armv7l) with OpenWrt 17 (LEDE) and OpenWrt 19.07. The former needs a backport for the -iremap gcc flag - "build: Pass -iremap gcc option as a single argument"

T-X commented 3 years ago

Also, here is a fixed OpenWrt Makefile. I believe it was based on smartsnmpd's OpenWrt Makefile:

https://gist.github.com/T-X/571c952172179f7bbe66cf1e286336cb

Changes/fixes to it are:

begeekmyfriend commented 3 years ago

Well done! Thanks a lot!