Browse Source

Added set_netmask() and set_gateway()

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
988bb50979
2 changed files with 30 additions and 0 deletions
  1. 2
    0
      src/include/gpxe/ip.h
  2. 28
    0
      src/proto/ip.c

+ 2
- 0
src/include/gpxe/ip.h View File

12
 #include <gpxe/in.h>
12
 #include <gpxe/in.h>
13
 
13
 
14
 extern void set_ipaddr ( struct in_addr address );
14
 extern void set_ipaddr ( struct in_addr address );
15
+extern void set_netmask ( struct in_addr address );
16
+extern void set_gateway ( struct in_addr address );
15
 extern void init_tcpip ( void );
17
 extern void init_tcpip ( void );
16
 extern void run_tcpip ( void );
18
 extern void run_tcpip ( void );
17
 
19
 

+ 28
- 0
src/proto/ip.c View File

31
 	uip_sethostaddr ( u.uip_address );
31
 	uip_sethostaddr ( u.uip_address );
32
 }
32
 }
33
 
33
 
34
+/**
35
+ * Set netmask
36
+ *
37
+ */
38
+void set_netmask ( struct in_addr address ) {
39
+	union {
40
+		struct in_addr address;
41
+		uint16_t uip_address[2];
42
+	} u;
43
+
44
+	u.address = address;
45
+	uip_setnetmask ( u.uip_address );
46
+}
47
+
48
+/**
49
+ * Set default gateway
50
+ *
51
+ */
52
+void set_gateway ( struct in_addr address ) {
53
+	union {
54
+		struct in_addr address;
55
+		uint16_t uip_address[2];
56
+	} u;
57
+
58
+	u.address = address;
59
+	uip_setdraddr ( u.uip_address );
60
+}
61
+
34
 /**
62
 /**
35
  * Initialise TCP/IP stack
63
  * Initialise TCP/IP stack
36
  *
64
  *

Loading…
Cancel
Save