/* * LD_PRELOAD lib for faking calls to the apmib library. * * $ mips-linux-gcc -Wall -fPIC -shared apmib.c -o apmib-ld.so */ #include #include #define MIB_IP_ADDR 170 #define MIB_HW_VER 0x250 #define MIB_CAPTCHA 0x2C1 #define DEBUG int apmib_init(void) { // Fake it. return 1; } void apmib_get(int code, int *value) { switch(code) { case MIB_HW_VER: *value = 0xF1; break; case MIB_IP_ADDR: *value = 0x7F000001; break; case MIB_CAPTCHA: *value = 1; break; } #ifdef DEBUG printf("Code: 0x%X (%d) Value: 0x%X (%d)\n", code, code, *value, *value); #endif return; }