Commit fc408b39 authored by Dan Williams's avatar Dan Williams
Browse files

2005-02-14 Dan Williams <dcbw@redhat.com>

	Patch from Peter Jones:
	* dhcpcd/client.c
		- Ensure we return RET_DHCP_CEASED everywhere we should
	* dhcpcd/udpipgen.c
		- Use faster TOS for IP packets
		- Don't set ip_id since we're UDP

	Patch from Tomislav Vujec:
	* src/nm-dbus-dhcp.c
	  test/nm-dhcp-opt-test.c
		- Clean up warnings to enable cvs tree compilation.
	* configure.in
		- Set AM_MAINTAINER_MODE


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@451 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent e9b83073
2005-02-14 Dan Williams <dcbw@redhat.com>
Patch from Peter Jones:
* dhcpcd/client.c
- Ensure we return RET_DHCP_CEASED everywhere we should
* dhcpcd/udpipgen.c
- Use faster TOS for IP packets
- Don't set ip_id since we're UDP
Patch from Tomislav Vujec:
* src/nm-dbus-dhcp.c
test/nm-dhcp-opt-test.c
- Clean up warnings to enable cvs tree compilation.
2005-02-14 Tomislav Vujec <tvujec@redhat.com>
* configure.in
......
......@@ -2,6 +2,7 @@ AC_PREREQ(2.52)
AC_INIT(NetworkManager, 0.3.3, dcbw@redhat.com, NetworkManager)
AM_INIT_AUTOMAKE([subdir-objects])
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)
......@@ -36,7 +37,7 @@ AC_CHECK_FUNCS(select socket uname)
GETTEXT_PACKAGE=NetworkManager
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
ALL_LINGUAS="bs cs da de el en_CA es gu ja nb nl no pa pt_BR sk sq sv wa zh_CN"
ALL_LINGUAS="bs cs da de el en_CA es gu hr ja nb nl no pa pt_BR sk sq sv wa zh_CN"
AM_GLIB_GNU_GETTEXT
AC_ARG_WITH(distro, AC_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, gentoo, debian, or slackware]))
......
......@@ -472,13 +472,14 @@ int dhcp_handle_transaction (dhcp_interface *iface, unsigned int expected_reply_
* we return RET_DHCP_TIMEOUT.
*/
gettimeofday (&overall_end, NULL);
overall_end.tv_sec += iface->client_options->base_timeout;
/* Send the request, then wait for the reply for a certain period of time
* that increases with each failed request. Quit when we reach our end time though.
*/
#ifdef DEBUG
syslog (LOG_INFO, "DHCP: Starting request loop");
syslog (LOG_INFO, "DHCP: Starting request loop, overall start_time = {%lds, %ldus}\n",
(long)overall_end.tv_sec, (long)overall_end.tv_usec);
overall_end.tv_sec += iface->client_options->base_timeout;
#endif
do
{
......@@ -699,6 +700,8 @@ out:
free (pkt_recv);
if (recv_sk >= 0)
close (recv_sk);
if (iface->cease)
err = RET_DHCP_CEASED;
return err;
}
/*****************************************************************************/
......@@ -756,6 +759,8 @@ int dhcp_init (dhcp_interface *iface)
err = dhcp_handle_transaction (iface, DHCP_OFFER, &build_dhcp_discover, &dhcp_resp2);
if (err == RET_DHCP_SUCCESS)
memcpy (&dhcp_resp, &dhcp_resp2, sizeof (dhcp_response_return));
else if (err == RET_DHCP_CEASED)
return err;
}
iface->ciaddr = dhcp_resp.dhcp_msg.yiaddr;
......@@ -815,7 +820,7 @@ int dhcp_request(dhcp_interface *iface, dhcp_msg_build_proc buildDhcpMsg)
((unsigned char *)&(iface->ciaddr))[2], ((unsigned char *)&(iface->ciaddr))[3]);
dhcpDecline ();
iface->ciaddr = 0;
return RET_DHCP_ADDRESS_IN_USE;
return iface->cease ? RET_DHCP_CEASED : RET_DHCP_ADDRESS_IN_USE;
}
if (DebugFlag)
......@@ -830,7 +835,7 @@ int dhcp_request(dhcp_interface *iface, dhcp_msg_build_proc buildDhcpMsg)
memcpy (&(iface->siaddr), iface->dhcp_options.val[dhcpServerIdentifier], 4);
memcpy (iface->shaddr, dhcp_resp.server_hw_addr, ETH_ALEN);
return RET_DHCP_BOUND;
return iface->cease ? RET_DHCP_CEASED : RET_DHCP_BOUND;
}
/*****************************************************************************/
int dhcp_renew(dhcp_interface *iface)
......
......@@ -69,9 +69,16 @@ void udpipgen (udpiphdr *udpip, unsigned int saddr, unsigned int daddr, unsigned
memcpy (ip,(struct ip *)udpip->ip, sizeof (ip_local));
ip->ip_hl = 5;
ip->ip_v = IPVERSION;
ip->ip_tos = 0; /* normal service */
ip->ip_tos = IPTOS_LOWDELAY;
ip->ip_len = htons (dhcp_msg_len + sizeof (udpiphdr));
/* Hmm, since the UDP packets shouldnt' be fragmented, ip_id = 0 */
#if 0
ip->ip_id = htons (*ip_id); *ip_id++;
#else
ip->ip_id = 0;
#endif
ip->ip_off = 0;
ip->ip_ttl = IPDEFTTL; /* time to live, 64 by default */
ip->ip_p = IPPROTO_UDP;
......
......@@ -46,6 +46,7 @@ static int nm_dbus_dhcp_record_type (int id)
return DBUS_TYPE_BYTE;
}
g_assert_not_reached();
return DBUS_TYPE_INVALID;
}
#define DBUS_REPLY_BYTYPE(Dtype, Ctype) do { \
......
......@@ -57,6 +57,7 @@ static char *dbus_type_to_string (int type)
return "string";
}
g_assert_not_reached ();
return NULL;
}
......@@ -190,8 +191,8 @@ void print_array (DBusConnection *connection, int opt, int opt_type)
int *int32 = NULL;
gboolean *bool = NULL;
unsigned char *byte = NULL;
void *item;
char *method;
void *item = NULL;
char *method = NULL;
int ret;
const char *name = NULL;
......@@ -258,7 +259,7 @@ void print_one_item (DBusConnection *connection, int opt, int opt_type)
unsigned char byte;
char *string = NULL;
void *item = NULL;
char *method;
char *method = NULL;
int ret;
const char *name = NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment