Increase the valid name of the iface to IFNAMSIZ
Define MAX_IFACE_LENGTH as IFNAMSIZ instead of 10, to
prevent netd from treating an interface name 'rmnet_sdio0'
as invalid.
Also fix an off-by-one error.
Change-Id: If6b2b27d2da6eb72f01c090cbe4f7dc2b9c296ae
diff --git a/SecondaryTableController.h b/SecondaryTableController.h
index 259ab43..58914df 100644
--- a/SecondaryTableController.h
+++ b/SecondaryTableController.h
@@ -19,7 +19,12 @@
#include <sysutils/FrameworkListener.h>
-static const unsigned int MAX_IFACE_LENGTH = 10;
+#include <linux/if.h>
+
+#ifndef IFNAMSIZ
+#define IFNAMSIZ 16
+#endif
+
static const int INTERFACES_TRACKED = 10;
static const int BASE_TABLE_NUMBER = 60;
static int MAX_TABLE_NUMBER = BASE_TABLE_NUMBER + INTERFACES_TRACKED;
@@ -40,7 +45,7 @@
int modifyRoute(SocketClient *cli, const char *action, char *iface, char *dest, int prefix,
char *gateway, int tableIndex);
- char mInterfaceTable[INTERFACES_TRACKED][MAX_IFACE_LENGTH];
+ char mInterfaceTable[INTERFACES_TRACKED][IFNAMSIZ + 1];
int mInterfaceRuleCount[INTERFACES_TRACKED];
void modifyRuleCount(int tableIndex, const char *action);
int verifyTableIndex(int tableIndex);