From 988bb509797ef3b0a68f740f12568fc37e0ac425 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 5 Apr 2006 11:41:15 +0000 Subject: [PATCH] Added set_netmask() and set_gateway() --- src/include/gpxe/ip.h | 2 ++ src/proto/ip.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/include/gpxe/ip.h b/src/include/gpxe/ip.h index 3a971687..29aae517 100644 --- a/src/include/gpxe/ip.h +++ b/src/include/gpxe/ip.h @@ -12,6 +12,8 @@ #include extern void set_ipaddr ( struct in_addr address ); +extern void set_netmask ( struct in_addr address ); +extern void set_gateway ( struct in_addr address ); extern void init_tcpip ( void ); extern void run_tcpip ( void ); diff --git a/src/proto/ip.c b/src/proto/ip.c index 3f46377c..a0f36d74 100644 --- a/src/proto/ip.c +++ b/src/proto/ip.c @@ -31,6 +31,34 @@ void set_ipaddr ( struct in_addr address ) { uip_sethostaddr ( u.uip_address ); } +/** + * Set netmask + * + */ +void set_netmask ( struct in_addr address ) { + union { + struct in_addr address; + uint16_t uip_address[2]; + } u; + + u.address = address; + uip_setnetmask ( u.uip_address ); +} + +/** + * Set default gateway + * + */ +void set_gateway ( struct in_addr address ) { + union { + struct in_addr address; + uint16_t uip_address[2]; + } u; + + u.address = address; + uip_setdraddr ( u.uip_address ); +} + /** * Initialise TCP/IP stack *