[dhcp-agent-commits] dhcp-agent/src dhcp-interface.c,1.7,1.8 dhcp-interface.h,1.3,1.4 dhcp-librawnet
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2003-06-08 22:42:49
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv30142/src Modified Files: dhcp-interface.c dhcp-interface.h dhcp-librawnet.h dhcp-packet-build.c dhcp-rawnet.c Log Message: now correctly set the hardware type in the bootp header Index: dhcp-interface.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-interface.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-interface.c 3 Jan 2003 21:29:22 -0000 1.7 --- dhcp-interface.c 8 Jun 2003 22:42:45 -0000 1.8 *************** *** 247,250 **** --- 247,251 ---- } + list_t *interface_get_active_interfaces(void) { *************** *** 255,257 **** --- 256,270 ---- { return (interfaces_get_proc(check_interface_down)); + } + + uint16_t interface_get_type(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)); + + return DLT_NULL; /* do our best. */ + } + + return ic->interface_entry->intf_type; } Index: dhcp-interface.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-interface.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-interface.h 27 Dec 2002 02:53:45 -0000 1.3 --- dhcp-interface.h 8 Jun 2003 22:42:45 -0000 1.4 *************** *** 34,37 **** --- 34,38 ---- extern list_t *interface_get_inactive_interfaces(void); extern int interface_is_up(interface_control_t *ic); + extern uint16_t interface_get_type(interface_control_t *ic); #endif /* DHCP_INTERFACE_H */ Index: dhcp-librawnet.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-librawnet.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-librawnet.h 8 Jun 2003 22:14:15 -0000 1.14 --- dhcp-librawnet.h 8 Jun 2003 22:42:45 -0000 1.15 *************** *** 391,394 **** --- 391,395 ---- extern int rawnet_is_valid(rawnet_t *net); extern const char *rawnet_get_device_name(rawnet_t *net); + extern int rawnet_get_datalink_type(rawnet_t *net); /* packet building routines. */ Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-packet-build.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-packet-build.c 3 Jan 2003 21:29:22 -0000 1.5 --- dhcp-packet-build.c 8 Jun 2003 22:42:45 -0000 1.6 *************** *** 313,317 **** dhcp_set_op(net->dhcp_p, bootp_type); ! dhcp_set_htype(net->dhcp_p, DLT_EN10MB); dhcp_set_hlen(net->dhcp_p, ETH_ADDR_LEN); dhcp_set_hops(net->dhcp_p, 0); --- 313,317 ---- dhcp_set_op(net->dhcp_p, bootp_type); ! dhcp_set_htype(net->dhcp_p, rawnet_get_datalink_type(net)); dhcp_set_hlen(net->dhcp_p, ETH_ADDR_LEN); dhcp_set_hops(net->dhcp_p, 0); Index: dhcp-rawnet.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-rawnet.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-rawnet.c 25 May 2003 03:37:52 -0000 1.7 --- dhcp-rawnet.c 8 Jun 2003 22:42:45 -0000 1.8 *************** *** 705,714 **** } ! /* * * * * * * * * * * * * ! * Device manipulation. * ! * * * * * * * * * * * * */ ! const char *rawnet_get_device_name(rawnet_t *net) { ! return net->device; } --- 705,718 ---- } ! /* return datalink type: use pcap for now since it seems to be ! * giving us the correct datalink FIXME: find out why dnet is ! * giving us wierd numbers and send in patch. */ ! int rawnet_get_datalink_type(rawnet_t *net) { ! if(net->pcap == NULL) { ! return DLT_NULL; /* we have no datalink. */ ! } ! ! return pcap_datalink(net->pcap); } |