Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
dhcpcd: Update to Version 5.5.6
Browse files Browse the repository at this point in the history
Change-Id: I98c378688be723a2a602ec17c26bc13f2fd83cc8
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
  • Loading branch information
Dmitry Shmidt committed Jul 23, 2012
1 parent 2af699e commit a3a2260
Show file tree
Hide file tree
Showing 37 changed files with 2,130 additions and 717 deletions.
2 changes: 1 addition & 1 deletion Android.mk
Expand Up @@ -9,7 +9,7 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := arp.c bind.c common.c control.c dhcp.c dhcpcd.c duid.c \
eloop.c if-options.c if-pref.c ipv4ll.c net.c signals.c configure.c \
if-linux.c if-linux-wireless.c lpf.c compat/getline.c \
platform-linux.c compat/closefrom.c ifaddrs.c
platform-linux.c compat/closefrom.c ifaddrs.c ipv6rs.c

#LOCAL_C_INCLUDES := $(KERNEL_HEADERS)
LOCAL_SHARED_LIBRARIES := libc libcutils libnetutils
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -2,7 +2,7 @@

PROG= dhcpcd
SRCS= arp.c bind.c common.c control.c dhcp.c dhcpcd.c duid.c eloop.c
SRCS+= if-options.c if-pref.c ipv4ll.c net.c signals.c
SRCS+= if-options.c if-pref.c ipv4ll.c ipv6rs.c net.c signals.c
SRCS+= configure.c

CFLAGS?= -O2
Expand Down
2 changes: 1 addition & 1 deletion README
@@ -1,5 +1,5 @@
dhcpcd - DHCP client daemon
Copyright (c) 2006-2010 Roy Marples <roy@marples.name>
Copyright (c) 2006-2012 Roy Marples <roy@marples.name>


Installation
Expand Down
6 changes: 4 additions & 2 deletions arp.c
@@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
* Copyright (c) 2006-2008 Roy Marples <roy@marples.name>
* Copyright (c) 2006-2011 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -119,7 +119,7 @@ handle_arp_packet(void *arg)
state->fail.s_addr = 0;
for(;;) {
bytes = get_raw_packet(iface, ETHERTYPE_ARP,
arp_buffer, sizeof(arp_buffer));
arp_buffer, sizeof(arp_buffer), NULL);
if (bytes == 0 || bytes == -1)
return;
/* We must have a full ARP header */
Expand Down Expand Up @@ -204,6 +204,8 @@ send_arp_announce(void *arg)
struct if_state *state = iface->state;
struct timeval tv;

if (state->new == NULL)
return;
if (iface->arp_fd == -1) {
open_socket(iface, ETHERTYPE_ARP);
add_event(iface->arp_fd, handle_arp_packet, iface);
Expand Down
7 changes: 5 additions & 2 deletions bpf.c
@@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
* Copyright (c) 2006-2008 Roy Marples <roy@marples.name>
* Copyright (c) 2006-2011 Roy Marples <roy@marples.name>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -160,7 +160,7 @@ send_raw_packet(const struct interface *iface, int protocol,
* So we pass the buffer in the API so we can loop on >1 packet. */
ssize_t
get_raw_packet(struct interface *iface, int protocol,
void *data, ssize_t len)
void *data, ssize_t len, int *partialcsum)
{
int fd = -1;
struct bpf_hdr packet;
Expand All @@ -172,6 +172,9 @@ get_raw_packet(struct interface *iface, int protocol,
else
fd = iface->raw_fd;

if (partialcsum != NULL)
*partialcsum = 0; /* Not supported on BSD */

for (;;) {
if (iface->buffer_len == 0) {
bytes = read(fd, iface->buffer, iface->buffer_size);
Expand Down
28 changes: 27 additions & 1 deletion common.c
@@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
* Copyright (c) 2006-2009 Roy Marples <roy@marples.name>
* Copyright (c) 2006-2012 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -200,6 +200,32 @@ get_monotonic(struct timeval *tp)
return gettimeofday(tp, NULL);
}

ssize_t
setvar(char ***e, const char *prefix, const char *var, const char *value)
{
size_t len = strlen(var) + strlen(value) + 3;

if (prefix)
len += strlen(prefix) + 1;
**e = xmalloc(len);
if (prefix)
snprintf(**e, len, "%s_%s=%s", prefix, var, value);
else
snprintf(**e, len, "%s=%s", var, value);
(*e)++;
return len;
}

ssize_t
setvard(char ***e, const char *prefix, const char *var, int value)
{
char buffer[32];

snprintf(buffer, sizeof(buffer), "%d", value);
return setvar(e, prefix, var, buffer);
}


time_t
uptime(void)
{
Expand Down
6 changes: 4 additions & 2 deletions common.h
@@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
* Copyright (c) 2006-2009 Roy Marples <roy@marples.name>
* Copyright (c) 2006-2011 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -28,8 +28,8 @@
#ifndef COMMON_H
#define COMMON_H

#include <sys/time.h>
#include <stdio.h>
#include <time.h>

#include "config.h"
#include "defs.h"
Expand Down Expand Up @@ -72,6 +72,8 @@ int set_nonblock(int);
char *get_line(FILE * __restrict);
extern int clock_monotonic;
int get_monotonic(struct timeval *);
ssize_t setvar(char ***, const char *, const char *, const char *);
ssize_t setvard(char ***, const char *, const char *, int);
time_t uptime(void);
int writepid(int, pid_t);
void *xrealloc(void *, size_t);
Expand Down

0 comments on commit a3a2260

Please sign in to comment.