Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv20066/src
Modified Files:
dhcp-librawnet.h dhcp-rawnet.c dhcp-interface.h
dhcp-interface.c
Log Message:
fixed mtu issue in interface handling code; added get_mtu
Index: dhcp-librawnet.h
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-librawnet.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** dhcp-librawnet.h 27 Jun 2003 03:15:50 -0000 1.20
--- dhcp-librawnet.h 5 Jul 2003 19:18:17 -0000 1.21
***************
*** 370,377 ****
extern int rawnet_get_real_hw_addr(rawnet_t *net, eth_addr_t *addr);
extern ip_addr_t rawnet_get_ip_addr(rawnet_t *net);
extern int rawnet_send_packet(rawnet_t *net);
extern int rawnet_use_fake_hw_addr(rawnet_t *raw, char *mac_string);
extern void reinitialize_rawnet(rawnet_t *net, int promiscuous);
-
extern int rawnet_up(rawnet_t *net);
--- 370,377 ----
extern int rawnet_get_real_hw_addr(rawnet_t *net, eth_addr_t *addr);
extern ip_addr_t rawnet_get_ip_addr(rawnet_t *net);
+ extern uint16_t rawnet_get_mtu(rawnet_t *net);
extern int rawnet_send_packet(rawnet_t *net);
extern int rawnet_use_fake_hw_addr(rawnet_t *raw, char *mac_string);
extern void reinitialize_rawnet(rawnet_t *net, int promiscuous);
extern int rawnet_up(rawnet_t *net);
Index: dhcp-rawnet.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-rawnet.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** dhcp-rawnet.c 25 Jun 2003 01:54:14 -0000 1.10
--- dhcp-rawnet.c 5 Jul 2003 19:18:17 -0000 1.11
***************
*** 124,127 ****
--- 124,132 ----
}
+ uint16_t rawnet_get_mtu(rawnet_t *net)
+ {
+ return interface_get_mtu(net->intf_handle);
+ }
+
list_t *rawnet_list_active_interfaces(void)
{
***************
*** 254,257 ****
--- 259,267 ----
return NULL;
}
+ }
+
+ if(net->mtu == -1) { /* were we passed an mtu? */
+ /* if not get it from the interface that was just brought up. */
+ net->mtu = rawnet_get_mtu(net);
}
Index: dhcp-interface.h
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-interface.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** dhcp-interface.h 8 Jun 2003 22:42:45 -0000 1.4
--- dhcp-interface.h 5 Jul 2003 19:18:18 -0000 1.5
***************
*** 35,38 ****
--- 35,39 ----
extern int interface_is_up(interface_control_t *ic);
extern uint16_t interface_get_type(interface_control_t *ic);
+ extern uint16_t interface_get_mtu(interface_control_t *ic);
#endif /* DHCP_INTERFACE_H */
Index: dhcp-interface.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-interface.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** dhcp-interface.c 8 Jun 2003 22:42:45 -0000 1.8
--- dhcp-interface.c 5 Jul 2003 19:18:18 -0000 1.9
***************
*** 114,118 ****
}
! ic->interface_entry->intf_mtu = 1500;
ic->interface_entry->intf_flags |= INTF_FLAG_UP;
--- 114,119 ----
}
! if(mtu != -1)
! ic->interface_entry->intf_mtu = mtu;
ic->interface_entry->intf_flags |= INTF_FLAG_UP;
***************
*** 265,268 ****
--- 266,279 ----
return DLT_NULL; /* do our best. */
+ }
+
+ return ic->interface_entry->intf_type;
+ }
+
+ uint16_t interface_get_mtu(interface_control_t *ic)
+ {
+ if(interface_get_info(ic)) {
+ ERROR_MESSAGE("could not get interface data link type %s : %s",
+ ic->interface_entry->intf_name, strerror(errno));
}
|