summaryrefslogtreecommitdiffstats
path: root/netcfg/netcfg.c
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2010-08-18 11:16:00 -0700
committerJean-Baptiste Queru <jbq@google.com>2010-08-18 11:16:00 -0700
commit58b64acef07e6426914a8cb2d972778fbe138655 (patch)
tree62a31bcf71d748419086767014c834c37d10af1a /netcfg/netcfg.c
parent838336fa61f2f06898322f059570708def823398 (diff)
downloadsystem_core-58b64acef07e6426914a8cb2d972778fbe138655.zip
system_core-58b64acef07e6426914a8cb2d972778fbe138655.tar.gz
system_core-58b64acef07e6426914a8cb2d972778fbe138655.tar.bz2
Revert "- creates proper ifc.h and dhcp.h headers for libnetutils"
This reverts commit c88e09cb98fb3690c3cf49f5a825532e0d9bf300.
Diffstat (limited to 'netcfg/netcfg.c')
-rw-r--r--netcfg/netcfg.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/netcfg/netcfg.c b/netcfg/netcfg.c
index 9cd883a..fc9cf48 100644
--- a/netcfg/netcfg.c
+++ b/netcfg/netcfg.c
@@ -19,13 +19,17 @@
#include <stdlib.h>
#include <errno.h>
#include <dirent.h>
-#include <netinet/ether.h>
-
-#include <netutils/ifc.h>
-#include <netutils/dhcp.h>
static int verbose = 0;
+int ifc_init();
+void ifc_close();
+int ifc_up(char *iname);
+int ifc_down(char *iname);
+int ifc_remove_host_routes(char *iname);
+int ifc_remove_default_route(char *iname);
+int ifc_get_info(const char *name, unsigned *addr, unsigned *mask, unsigned *flags);
+int do_dhcp(char *iname);
void die(const char *reason)
{
@@ -33,12 +37,16 @@ void die(const char *reason)
exit(1);
}
-const char *ipaddr(in_addr_t addr)
+const char *ipaddr(unsigned addr)
{
- struct in_addr in_addr;
-
- in_addr.s_addr = addr;
- return inet_ntoa(in_addr);
+ static char buf[32];
+
+ sprintf(buf,"%d.%d.%d.%d",
+ addr & 255,
+ ((addr >> 8) & 255),
+ ((addr >> 16) & 255),
+ (addr >> 24));
+ return buf;
}
void usage(void)
@@ -78,15 +86,6 @@ int dump_interfaces(void)
return 0;
}
-int set_hwaddr(const char *name, const char *asc) {
- struct ether_addr *addr = ether_aton(asc);
- if (!addr) {
- printf("Failed to parse '%s'\n", asc);
- return -1;
- }
- return ifc_set_hwaddr(name, addr->ether_addr_octet);
-}
-
struct
{
const char *name;
@@ -98,7 +97,6 @@ struct
{ "down", 1, ifc_down },
{ "flhosts", 1, ifc_remove_host_routes },
{ "deldefault", 1, ifc_remove_default_route },
- { "hwaddr", 2, set_hwaddr },
{ 0, 0, 0 },
};