gchar *interface, gchar *gateway, gint address_family)
{
const gchar *path = ROUTE_EXEC_PATH;
- gchar *const args[] = { "/sbin/route", "add", "-net", ip_addr,
- "netmask", netmask, "dev", interface, NULL };
+
+ if (gateway == NULL || strcmp(gateway, "") == 0)
+ gchar *const args[] = { "/sbin/route", "add", "-net", ip_addr,
+ "netmask", netmask, "dev", interface, NULL };
+ else
+ gchar *const args[] = { "/sbin/route", "add", "-net", ip_addr, "gw", gateway,
+ "netmask", netmask, "dev", interface, NULL };
+
gchar *const envs[] = { NULL };
const gchar* buf = NULL;
gchar* ch = NULL;
gchar *interface, gchar *gateway, gint address_family)
{
const char *path = ROUTE_EXEC_PATH;
- gchar *const args[] = { "/sbin/route", "del", "-net", ip_addr,
- "netmask", netmask, "dev", interface, NULL };
+
+ if (gateway == NULL || strcmp(gateway, "") == 0)
+ gchar *const args[] = { "/sbin/route", "del", "-net", ip_addr,
+ "netmask", netmask, "dev", interface, NULL };
+ else
+ gchar *const args[] = { "/sbin/route", "del", "-net", ip_addr, "gw", gateway,
+ "netmask", netmask, "dev", interface, NULL };
+
char *const envs[] = { NULL };
const char* buf = NULL;
char* ch = NULL;