summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS3
-rw-r--r--conf/distro/openmoko.conf11
-rw-r--r--packages/linux/linux-openmoko.inc4
-rw-r--r--packages/linux/linux-openmoko_2.6.24.bb11
-rw-r--r--packages/opkg/opkg.inc2
-rw-r--r--packages/popt/popt-1.13/.mtn2git_empty0
-rw-r--r--packages/popt/popt-1.13/iconv.patch13
-rw-r--r--packages/popt/popt_1.13.bb6
-rw-r--r--packages/pump/.mtn2git_empty0
-rw-r--r--packages/pump/pump/.mtn2git_empty0
-rw-r--r--packages/pump/pump/debian.patch2141
-rw-r--r--packages/pump/pump_0.8.24.bb19
-rw-r--r--packages/slugos-init/files/modulefunctions34
-rw-r--r--packages/slugos-init/files/turnup6
-rw-r--r--packages/slugos-init/slugos-init_4.8.bb2
15 files changed, 2213 insertions, 39 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index fd26450557..37655b663e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -96,7 +96,8 @@ Person: Jeremy Lainé
Mail: jeremy.laine@bolloretelecom.eu
Website: http://www.jerryweb.org/
Machines: mpc8313e-rdb
-Recipes: libexosip2, python-cheetah, python-django, python-pyopenssl
+Recipes: libexosip2, python-cheetah, python-django, python-pyopenssl,
+Recipes: pump
Person: Joaquim Duran
Mail: joaquinduran@adtelecom.es
diff --git a/conf/distro/openmoko.conf b/conf/distro/openmoko.conf
index 62d2189c8a..2b7aea03b9 100644
--- a/conf/distro/openmoko.conf
+++ b/conf/distro/openmoko.conf
@@ -47,10 +47,13 @@ PREFERRED_PROVIDER_libgsmd = "libgsmd"
# override the PACKAGE_ARCH of certain packages for openmoko distro
#
# Same kernel runs on both these machines
-PACKAGE_ARCH_pn-linux-openmoko_fic-gta01 = "${MACHINE_CLASS}"
-PACKAGE_ARCH_pn-linux-openmoko_fic-gta02 = "${MACHINE_CLASS}"
-PACKAGE_ARCH_pn-linux-openmoko-devel_fic-gta01 = "${MACHINE_CLASS}"
-PACKAGE_ARCH_pn-linux-openmoko-devel_fic-gta02 = "${MACHINE_CLASS}"
+# Currently not used but left here in case someone wants to switch on
+# quickly
+#PACKAGE_ARCH_pn-linux-openmoko_fic-gta01 = "${MACHINE_CLASS}"
+#PACKAGE_ARCH_pn-linux-openmoko_fic-gta02 = "${MACHINE_CLASS}"
+#PACKAGE_ARCH_pn-linux-openmoko-devel_fic-gta01 = "${MACHINE_CLASS}"
+#PACKAGE_ARCH_pn-linux-openmoko-devel_fic-gta02 = "${MACHINE_CLASS}"
+
# Same kernel so same usb
PACKAGE_ARCH_pn-usb-gadget-mode_fic-gta01 = "${MACHINE_CLASS}"
PACKAGE_ARCH_pn-usb-gadget-mode_fic-gta02 = "${MACHINE_CLASS}"
diff --git a/packages/linux/linux-openmoko.inc b/packages/linux/linux-openmoko.inc
index 4f1981c8b3..69d7845f04 100644
--- a/packages/linux/linux-openmoko.inc
+++ b/packages/linux/linux-openmoko.inc
@@ -1,9 +1,7 @@
# extra stuff we need for openmoko that is not in linux.inc
do_deploy_append() {
- mv ${DEPLOY_DIR_IMAGE}/modules-${PV}-${PR}-${MACHINE}.tgz ${DEPLOY_DIR_IMAGE}/modules-${PV}-${PR}-${MACHINE_CLASS}.tgz
- mv ${DEPLOY_DIR_IMAGE}/uImage-${PV}-${PR}-${MACHINE}.bin ${DEPLOY_DIR_IMAGE}/uImage-${PV}-${PR}-${MACHINE_CLASS}.bin
rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin
- ln -sf ${DEPLOY_DIR_IMAGE}/uImage-${PV}-${PR}-${MACHINE_CLASS}.bin ${DEPLOY_DIR_IMAGE}/uImage-${MACHINE_CLASS}-latest.bin
+ ln -sf ${DEPLOY_DIR_IMAGE}/uImage-${PV}-${PR}-${MACHINE_ARCH}.bin ${DEPLOY_DIR_IMAGE}/uImage-${MACHINE_ARCH}-latest.bin
}
RDEPENDS_kernel-image += "mtd-utils"
diff --git a/packages/linux/linux-openmoko_2.6.24.bb b/packages/linux/linux-openmoko_2.6.24.bb
index 0a7b34ba30..b60a43efe4 100644
--- a/packages/linux/linux-openmoko_2.6.24.bb
+++ b/packages/linux/linux-openmoko_2.6.24.bb
@@ -11,10 +11,10 @@ KERNEL_VERSION = "${KERNEL_RELEASE}"
# re-enabled this when feature is fully implemented in OE
#SRCREV_FORMAT = "patches-rconfig"
SRCREV_FORMAT = "patches"
-CONFIG_REV = "4165"
-
+CONFIG_REV_fic-gta01 = "4251"
+CONFIG_REV_fic-gta02 = "4251"
PV = "${VANILLA_VERSION}+svnr${SRCREV}-r${CONFIG_REV}"
-PR = "r4"
+PR = "r5"
KERNEL_IMAGETYPE = "uImage"
UBOOT_ENTRYPOINT = "30008000"
@@ -55,11 +55,14 @@ module_autoload_snd-mixer-oss = "snd-mixer-oss"
# sd/mmc
module_autoload_s3cmci = "s3cmci"
+CONFIG_NAME_fic-gta01 = "gta01"
+CONFIG_NAME_fic-gta02 = "gta02"
+
do_prepatch() {
mv ${WORKDIR}/patches ${S}/patches && cd ${S} && quilt push -av
mv patches patches.openmoko
mv .pc .pc.old
- mv ${WORKDIR}/config/defconfig-${KERNEL_RELEASE} ${WORKDIR}/defconfig
+ mv ${WORKDIR}/config/defconfig-${CONFIG_NAME} ${WORKDIR}/defconfig
}
addtask prepatch after do_unpack before do_patch
diff --git a/packages/opkg/opkg.inc b/packages/opkg/opkg.inc
index 6459ca78d8..40b9fffa3c 100644
--- a/packages/opkg/opkg.inc
+++ b/packages/opkg/opkg.inc
@@ -6,7 +6,7 @@ DEPENDS = "curl gpgme"
PV = "0.0+svnr${SRCREV}"
SRC_URI = "svn://svn.openmoko.org/trunk/src/target/;module=opkg;proto=http \
- file://fix_endianness.patch;patch=1"
+ file://fix_endianness.patch;patch=1;maxrev=4246"
S = "${WORKDIR}/opkg"
inherit autotools pkgconfig
diff --git a/packages/popt/popt-1.13/.mtn2git_empty b/packages/popt/popt-1.13/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/popt/popt-1.13/.mtn2git_empty
diff --git a/packages/popt/popt-1.13/iconv.patch b/packages/popt/popt-1.13/iconv.patch
new file mode 100644
index 0000000000..83c70b0560
--- /dev/null
+++ b/packages/popt/popt-1.13/iconv.patch
@@ -0,0 +1,13 @@
+Index: popt-1.13/Makefile.am
+===================================================================
+--- popt-1.13.orig/Makefile.am 2008-03-25 21:51:12.000000000 +0100
++++ popt-1.13/Makefile.am 2008-03-25 21:51:42.000000000 +0100
+@@ -39,7 +39,7 @@
+ usrlib_LTLIBRARIES = libpopt.la
+
+ libpopt_la_SOURCES = popt.c findme.c poptparse.c poptconfig.c popthelp.c poptint.c
+-libpopt_la_LDFLAGS = -no-undefined @LTLIBINTL@
++libpopt_la_LDFLAGS = -no-undefined @LTLIBINTL@ @LTLIBICONV@
+
+ if HAVE_LD_VERSION_SCRIPT
+ libpopt_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libpopt.vers
diff --git a/packages/popt/popt_1.13.bb b/packages/popt/popt_1.13.bb
index 9b071ba731..7a736bde87 100644
--- a/packages/popt/popt_1.13.bb
+++ b/packages/popt/popt_1.13.bb
@@ -2,11 +2,13 @@ require popt.inc
DEPENDS = "gettext virtual/libintl"
-PR = "r0"
+PR = "r1"
inherit autotools
-SRC_URI = "http://freshmeat.net/redir/popt/72854/url_bz2/popt-${PV}.tar.gz"
+SRC_URI = "http://freshmeat.net/redir/popt/72854/url_bz2/popt-${PV}.tar.gz \
+ file://iconv.patch;patch=1 \
+ "
do_stage() {
oe_libinstall -a -so libpopt ${STAGING_LIBDIR}
diff --git a/packages/pump/.mtn2git_empty b/packages/pump/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/pump/.mtn2git_empty
diff --git a/packages/pump/pump/.mtn2git_empty b/packages/pump/pump/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/pump/pump/.mtn2git_empty
diff --git a/packages/pump/pump/debian.patch b/packages/pump/pump/debian.patch
new file mode 100644
index 0000000000..63001b88df
--- /dev/null
+++ b/packages/pump/pump/debian.patch
@@ -0,0 +1,2141 @@
+--- pump-0.8.24.orig/dhcp.c
++++ pump-0.8.24/dhcp.c
+@@ -31,9 +31,11 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <netinet/udp.h>
++#include <netpacket/packet.h>
+ #include <popt.h>
+ #include <resolv.h>
+ #include <signal.h>
++#include <stdint.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -82,9 +84,6 @@
+ #define DHCP_OPTION_CLASS_IDENTIFIER 60
+ #define DHCP_OPTION_CLIENT_IDENTIFIER 61
+
+-#define BOOTP_CLIENT_PORT 68
+-#define BOOTP_SERVER_PORT 67
+-
+ #define BOOTP_OPCODE_REQUEST 1
+ #define BOOTP_OPCODE_REPLY 2
+
+@@ -126,6 +125,12 @@
+ bp_int16 len;
+ };
+
++struct ippkt {
++ struct ip ip;
++ struct udphdr udp;
++ char payload[sizeof(struct bootpRequest)];
++} __attribute__ ((packed));
++
+ static void parseReply(struct bootpRequest * breq, struct pumpNetIntf * intf);
+ static char * prepareRequest(struct bootpRequest * breq,
+ int sock, char * device, time_t startTime);
+@@ -134,36 +139,24 @@
+ static char * handleTransaction(int s, struct pumpOverrideInfo * override,
+ struct bootpRequest * breq,
+ struct bootpRequest * bresp,
+- struct sockaddr_in * serverAddr,
++ struct sockaddr * serverAddr,
++ socklen_t serverAddrLen,
+ struct sockaddr_in * respondant,
+- int useBootpPacket,
++ int useBootpPacket, int raw,
+ time_t startTime, int dhcpResponseType);
+ static int dhcpMessageType(struct bootpRequest * response);
+-static int oldKernel(void);
+ static char * getInterfaceInfo(struct pumpNetIntf * intf, int s);
+ static char * perrorstr(char * msg);
+ static void addClientIdentifier(int flags, struct bootpRequest * req);
+ static void buildRequest(struct bootpRequest * req, int flags, int type,
+ char * reqHostname, char *class, int lease);
+ static void updateSecCount(struct bootpRequest * breq, time_t startTime);
++static void makeraw(struct ippkt *buf, const void *payload, size_t len);
++static uint32_t checksum(const void *, size_t, uint32_t);
++static uint32_t wrapsum(uint32_t);
+
+ static const char vendCookie[] = { 99, 130, 83, 99, 255 };
+
+-static int oldKernel(void) {
+- struct utsname ubuf;
+- int major1, major2;
+-
+- uname(&ubuf);
+- if (!strcasecmp(ubuf.sysname, "linux")) {
+- if (sscanf(ubuf.release, "%d.%d", &major1, &major2) != 2 ||
+- (major1 < 2) || (major1 == 2 && major2 == 0)) {
+- return 1;
+- }
+- }
+-
+- return 0;
+-}
+-
+ static char * getInterfaceInfo(struct pumpNetIntf * intf, int s) {
+ struct ifreq req;
+ struct sockaddr_in * addrp;
+@@ -177,6 +170,10 @@
+ intf->broadcast = addrp->sin_addr;
+ intf->set = PUMP_INTFINFO_HAS_BROADCAST;
+
++ if (ioctl(s, SIOCGIFINDEX, &req))
++ return perrorstr("SIOCGIFINDEX");
++ intf->ifindex = req.ifr_ifindex;
++
+ return NULL;
+ }
+
+@@ -205,15 +202,18 @@
+ }
+
+
+-char * pumpDisableInterface(char * device) {
++char * pumpDisableInterface(struct pumpNetIntf * intf) {
+ struct ifreq req;
+ int s;
+
++ if (intf->flags & PUMP_FLAG_NOSETUP)
++ return NULL;
++
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+
+ memset(&req,0,sizeof(req));
+
+- strcpy(req.ifr_name, device);
++ strcpy(req.ifr_name, intf->device);
+ if (ioctl(s, SIOCGIFFLAGS, &req)) {
+ close(s);
+ return perrorstr("SIOCGIFFLAGS");
+@@ -235,6 +235,12 @@
+ struct ifreq req;
+ struct rtentry route;
+ int s;
++ char * rc;
++
++ if (intf->flags & PUMP_FLAG_NOSETUP)
++ return NULL;
++
++ if ((rc = pumpDisableInterface(intf))) return rc;
+
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+
+@@ -246,34 +252,46 @@
+ strcpy(req.ifr_name, intf->device);
+
+ addrp->sin_addr = intf->ip;
+- if (ioctl(s, SIOCSIFADDR, &req))
+- return perrorstr("SIOCSIFADDR");
++ if (ioctl(s, SIOCSIFADDR, &req)) {
++ rc = perrorstr("SIOCSIFADDR");
++ goto out;
++ }
+
+ addrp->sin_addr = intf->netmask;
+- if (ioctl(s, SIOCSIFNETMASK, &req))
+- return perrorstr("SIOCSIFNETMASK");
++ if (ioctl(s, SIOCSIFNETMASK, &req)) {
++ rc = perrorstr("SIOCSIFNETMASK");
++ goto out;
++ }
+
+ addrp->sin_addr = intf->broadcast;
+- if (ioctl(s, SIOCSIFBRDADDR, &req))
+- return perrorstr("SIOCSIFBRDADDR");
++ if (ioctl(s, SIOCSIFBRDADDR, &req)) {
++ rc = perrorstr("SIOCSIFBRDADDR");
++ goto out;
++ }
+
+ if (intf->set & PUMP_INTFINFO_HAS_MTU) {
+- req.ifr_mtu = intf->mtu;
+- if (ioctl(s, SIOCSIFMTU, &req))
+- return perrorstr("SIOCSIFMTU");
++ req.ifr_mtu = intf->mtu;
++ if (ioctl(s, SIOCSIFMTU, &req)) {
++ rc = perrorstr("SIOCSIFMTU");
++ goto out;
++ }
+ }
+
+ /* Bring up the device, and specifically allow broadcasts through it.
+ Don't mess with flags we don't understand though. */
+- if (ioctl(s, SIOCGIFFLAGS, &req))
+- return perrorstr("SIOCGIFFLAGS");
++ if (ioctl(s, SIOCGIFFLAGS, &req)) {
++ rc = perrorstr("SIOCGIFFLAGS");
++ goto out;
++ }
+
+ req.ifr_flags |= IFF_UP | IFF_RUNNING | IFF_BROADCAST;
+
+- if (ioctl(s, SIOCSIFFLAGS, &req))
+- return perrorstr("SIOCSIFFLAGS");
++ if (ioctl(s, SIOCSIFFLAGS, &req)) {
++ rc = perrorstr("SIOCSIFFLAGS");
++ goto out;
++ }
+
+- if (!strcmp(intf->device, "lo") || oldKernel()) {
++ if (!strcmp(intf->device, "lo")) {
+ /* add a route for this network */
+ route.rt_dev = intf->device;
+ route.rt_flags = RTF_UP;
+@@ -288,11 +306,14 @@
+
+ if (ioctl(s, SIOCADDRT, &route)) {
+ /* the route cannot already exist, as we've taken the device down */
+- return perrorstr("SIOCADDRT 1");
++ rc = perrorstr("SIOCADDRT 1");
++ goto out;
+ }
+ }
+
+- return NULL;
++out:
++ close(s);
++ return rc;
+ }
+
+ int pumpSetupDefaultGateway(struct in_addr * gw) {
+@@ -317,23 +338,30 @@
+ route.rt_dev = NULL;
+
+ if (ioctl(s, SIOCADDRT, &route)) {
++ close(s);
+ syslog(LOG_ERR, "failed to set default route: %s", strerror(errno));
+ return -1;
+ }
+
++ close(s);
+ return 0;
+ }
+
+ char * pumpPrepareInterface(struct pumpNetIntf * intf, int s) {
+ struct sockaddr_in * addrp;
+ struct ifreq req;
+- struct rtentry route;
+
+ memset(&req,0,sizeof(req));
++ strcpy(req.ifr_name, intf->device);
+
+- addrp = (struct sockaddr_in *) &req.ifr_addr;
++ if (ioctl(s, SIOCGIFINDEX, &req))
++ return perrorstr("SIOCGIFINDEX");
++ intf->ifindex = req.ifr_ifindex;
+
+- strcpy(req.ifr_name, intf->device);
++ if (intf->flags & PUMP_FLAG_NOSETUP)
++ return NULL;
++
++ addrp = (struct sockaddr_in *) &req.ifr_addr;
+ addrp->sin_family = AF_INET;
+ addrp->sin_port = 0;
+ memset(&addrp->sin_addr, 0, sizeof(addrp->sin_addr));
+@@ -344,48 +372,19 @@
+ if (ioctl(s, SIOCSIFADDR, &req))
+ return perrorstr("SIOCSIFADDR");
+
+- if (oldKernel()) {
+- if (ioctl(s, SIOCSIFNETMASK, &req))
+- return perrorstr("SIOCSIFNETMASK");
+-
+- /* the broadcast address is 255.255.255.255 */
+- memset(&addrp->sin_addr, 255, sizeof(addrp->sin_addr));
+- if (ioctl(s, SIOCSIFBRDADDR, &req))
+- return perrorstr("SIOCSIFBRDADDR");
+- }
+-
+ if (ioctl(s, SIOCGIFFLAGS, &req))
+ return perrorstr("SIOCGIFFLAGS");
+ req.ifr_flags |= IFF_UP | IFF_BROADCAST | IFF_RUNNING;
+ if (ioctl(s, SIOCSIFFLAGS, &req))
+ return perrorstr("SIOCSIFFLAGS");
+
+- memset(&route, 0, sizeof(route));
+- memcpy(&route.rt_gateway, addrp, sizeof(*addrp));
+-
+- addrp->sin_family = AF_INET;
+- addrp->sin_port = 0;
+- addrp->sin_addr.s_addr = INADDR_ANY;
+- memcpy(&route.rt_dst, addrp, sizeof(*addrp));
+- memcpy(&route.rt_genmask, addrp, sizeof(*addrp));
+-
+- route.rt_dev = intf->device;
+- route.rt_flags = RTF_UP;
+- route.rt_metric = 0;
+-
+- if (ioctl(s, SIOCADDRT, &route)) {
+- if (errno != EEXIST) {
+- close(s);
+- return perrorstr("SIOCADDRT 3");
+- }
+- }
+-
+ return NULL;
+ }
+
+ static int dhcpMessageType(struct bootpRequest * response) {
+ unsigned char * chptr;
+ unsigned char option, length;
++
+
+ chptr = response->vendor;
+
+@@ -516,9 +515,17 @@
+ break;
+
+ case BOOTP_OPTION_GATEWAY:
+- memcpy(&intf->gateway, chptr, 4);
++ intf->numGateways = 0;
++ for (i = 0; i < length; i += 4) {
++ if (intf->numGateways < MAX_GATEWAYS) {
++ memcpy(&intf->gateways[intf->numGateways++], chptr + i,
++ 4);
++ syslog(LOG_DEBUG, "intf: gateways[%i]: %s",
++ i/4, inet_ntoa (intf->gateways[i/4]));
++ }
++ }
+ intf->set |= PUMP_NETINFO_HAS_GATEWAY;
+- syslog (LOG_DEBUG, "intf: gateway: %s", inet_ntoa (intf->gateway));
++ syslog (LOG_DEBUG, "intf: numGateways: %i", intf->numGateways);
+ break;
+
+ case BOOTP_OPTION_HOSTNAME:
+@@ -692,6 +699,9 @@
+ struct in_addr address;
+ unsigned char *vndptr;
+ unsigned char option, length;
++
++ if (!verbose)
++ return;
+
+ memset(&address,0,sizeof(address));
+
+@@ -744,12 +754,12 @@
+ sprintf (vendor, "%3u %3u", option, length);
+ for (i = 0; i < length; i++)
+ {
+- if (strlen (vendor) > 22)
++ if (strlen (vendor) > sizeof(vendor2) - 6)
+ {
+ syslog (LOG_DEBUG, "%s: vendor: %s", name, vendor);
+ strcpy (vendor, "++++++");
+ }
+- snprintf (vendor2, 27, "%s 0x%02x", vendor, *vndptr++);
++ snprintf (vendor2, sizeof(vendor2), "%s 0x%02x", vendor, *vndptr++);
+ strcpy (vendor, vendor2);
+
+ }
+@@ -763,11 +773,12 @@
+ }
+
+ static char * handleTransaction(int s, struct pumpOverrideInfo * override,
+- struct bootpRequest * breq,
++ struct bootpRequest * breq,
+ struct bootpRequest * bresp,
+- struct sockaddr_in * serverAddr,
++ struct sockaddr * serverAddr,
++ socklen_t serverAddrLen,
+ struct sockaddr_in * respondant,
+- int useBootpPacket,
++ const int useBootpPacket, const int raw,
+ time_t startTime, int dhcpResponseType) {
+ struct timeval tv;
+ fd_set readfs;
+@@ -786,6 +797,9 @@
+ struct udphdr * udpHdr = NULL;
+ struct psuedohUdpHeader pHdr;
+ time_t start = pumpUptime();
++ struct ippkt buf;
++ void * pkt;
++ size_t pktlen, breqlen;
+
+ memset(&pHdr,0,sizeof(pHdr));
+ debugbootpRequest("breq", breq);
+@@ -802,17 +816,26 @@
+ return strerror(errno);
+ }
+
+- while (!gotit && tries) {
+- i = sizeof(*breq);
+- if (useBootpPacket)
+- i -= (DHCP_VENDOR_LENGTH - BOOTP_VENDOR_LENGTH);
++ pkt = breq;
++ breqlen = sizeof(*breq);
++ if (useBootpPacket)
++ breqlen -= (DHCP_VENDOR_LENGTH - BOOTP_VENDOR_LENGTH);
++ pktlen = breqlen;
++ if (raw) {
++ pkt = &buf;
++ pktlen += sizeof(struct ip) + sizeof(struct udphdr);
++ }
+
++ while (!gotit && tries) {
+ if (resend) {
+ if (startTime != -1)
+ updateSecCount(breq, startTime);
+
+- if (sendto(s, breq, i, 0, (struct sockaddr *) serverAddr,
+- sizeof(*serverAddr)) != i) {
++ if (raw)
++ makeraw(&buf, breq, breqlen);
++
++ if (sendto(s, pkt, pktlen, 0, (struct sockaddr *) serverAddr,
++ serverAddrLen) != pktlen) {
+ close(sin);
+ return perrorstr("sendto");
+ }
+@@ -890,9 +913,9 @@
+ continue;
+ */
+
+- if (ntohs(udpHdr->source) != BOOTP_SERVER_PORT)
++ if (udpHdr->source != bootp_server_port)
+ continue;
+- if (ntohs(udpHdr->dest) != BOOTP_CLIENT_PORT)
++ if (udpHdr->dest != bootp_client_port)
+ continue;
+ /* Go on with this packet; it looks sane */
+
+@@ -1022,12 +1045,12 @@
+ }
+
+ if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1)) {
+- syslog(LOG_ERR, "SO_BINDTODEVICE %s (%zd) failed: %s", device, strlen(device), strerror(errno));
++ syslog(LOG_ERR, "SO_BINDTODEVICE %s (%zu) failed: %s", device, strlen(device), strerror(errno));
+ }
+
+ memset(&clientAddr.sin_addr, 0, sizeof(&clientAddr.sin_addr));
+ clientAddr.sin_family = AF_INET;
+- clientAddr.sin_port = htons(BOOTP_CLIENT_PORT); /* bootp client */
++ clientAddr.sin_port = bootp_client_port; /* bootp client */
+
+ if (bind(s, (struct sockaddr *) &clientAddr, sizeof(clientAddr))) {
+ close(s);
+@@ -1046,7 +1069,7 @@
+ char hostname[1024];
+
+ if (!(intf->set & PUMP_INTFINFO_HAS_LEASE)) {
+- pumpDisableInterface(intf->device);
++ pumpDisableInterface(intf);
+ syslog(LOG_INFO, "disabling interface %s", intf->device);
+
+ return 0;
+@@ -1057,7 +1080,7 @@
+ if ((chptr = prepareRequest(&breq, s, intf->device, pumpUptime()))) {
+ close(s);
+ while (1) {
+- pumpDisableInterface(intf->device);
++ pumpDisableInterface(intf);
+ return 0;
+ }
+ }
+@@ -1072,6 +1095,7 @@
+ strlen(intf->hostname) + 1, intf->hostname);
+ } else {
+ gethostname(hostname, sizeof(hostname));
++ hostname[sizeof(hostname) - 1] = 0;
+ if (strcmp(hostname, "localhost") &&
+ strcmp(hostname, "localhost.localdomain")) {
+ addVendorCode(&breq, BOOTP_OPTION_HOSTNAME,
+@@ -1080,13 +1104,13 @@
+ }
+
+ serverAddr.sin_family = AF_INET;
+- serverAddr.sin_port = htons(BOOTP_SERVER_PORT); /* bootp server */
++ serverAddr.sin_port = bootp_server_port; /* bootp server */
+ serverAddr.sin_addr = intf->bootServer;
+
+- handleTransaction(s, NULL, &breq, &bresp, &serverAddr, NULL, 0,
+- -1, NORESPONSE);
++ handleTransaction(s, NULL, &breq, &bresp, (struct sockaddr *) &serverAddr,
++ sizeof(serverAddr), NULL, 0, 0, -1, NORESPONSE);
+
+- pumpDisableInterface(intf->device);
++ pumpDisableInterface(intf);
+ close(s);
+
+ if (intf->set & PUMP_NETINFO_HAS_HOSTNAME)
+@@ -1116,7 +1140,7 @@
+
+ if ((chptr = prepareRequest(&breq, s, intf->device, pumpUptime()))) {
+ close(s);
+- while (1); /* problem */
++ return 1;
+ }
+
+ messageType = DHCP_TYPE_REQUEST;
+@@ -1132,6 +1156,7 @@
+ intf->hostname);
+ } else {
+ gethostname(hostname, sizeof(hostname));
++ hostname[sizeof(hostname) - 1] = 0;
+ if (strcmp(hostname, "localhost") &&
+ strcmp(hostname, "localhost.localdomain")) {
+ addVendorCode(&breq, BOOTP_OPTION_HOSTNAME,
+@@ -1143,11 +1168,12 @@
+ addVendorCode(&breq, DHCP_OPTION_LEASE, 4, &i);
+
+ serverAddr.sin_family = AF_INET;
+- serverAddr.sin_port = htons(BOOTP_SERVER_PORT); /* bootp server */
++ serverAddr.sin_port = bootp_server_port; /* bootp server */
+ serverAddr.sin_addr = intf->bootServer;
+
+- if (handleTransaction(s, NULL, &breq, &bresp, &serverAddr, NULL, 0,
+- startTime, DHCP_TYPE_ACK)) {
++ if (handleTransaction(s, NULL, &breq, &bresp,
++ (struct sockaddr *) &serverAddr, sizeof(serverAddr),
++ NULL, 0, 0, startTime, DHCP_TYPE_ACK)) {
+ close(s);
+ return 1;
+ }
+@@ -1232,6 +1258,7 @@
+ if (!reqHostname) {
+ reqHostname = alloca(200);
+ gethostname(reqHostname, 200);
++ reqHostname[199] = 0;
+ if (!strcmp(reqHostname, "localhost") ||
+ !strcmp(reqHostname, "localhost.localdomain"))
+ reqHostname = NULL;
+@@ -1254,15 +1281,13 @@
+ struct pumpOverrideInfo * override) {
+ int s;
+ struct sockaddr_in serverAddr;
+- struct sockaddr_in clientAddr;
+- struct sockaddr_in broadcastAddr;
++ struct sockaddr_ll broadcastAddr;
+ struct bootpRequest breq, bresp;
+ char * chptr;
+ time_t startTime = pumpUptime();
+- int true = 1;
+- int ttl = 16;
+ char * saveDeviceName;
+ unsigned char messageType;
++ struct pumpOverrideInfo saveOverride;
+
+ /* If device is the same as intf->device, don't let the memset()
+ blow away the device name */
+@@ -1270,25 +1295,25 @@
+ strcpy(saveDeviceName, device);
+ device = saveDeviceName;
+
++ memcpy(&saveOverride, override, sizeof(*override));
++ override = &saveOverride;
++
+ memset(intf, 0, sizeof(*intf));
+ strcpy(intf->device, device);
+ intf->reqLease = reqLease;
+ intf->set |= PUMP_INTFINFO_HAS_REQLEASE;
++ memcpy(&intf->override, override, sizeof(*override));
+
+- s = socket(AF_INET, SOCK_DGRAM, 0);
++ /* Save these for later */
++ intf->flags = flags & PUMP_FLAG_WINCLIENTID;
++ if (override && (override->flags & OVERRIDE_FLAG_NOSETUP))
++ intf->flags |= PUMP_FLAG_NOSETUP;
++
++ s = socket(AF_PACKET, SOCK_DGRAM, ntohs(ETH_P_IP));
+ if (s < 0) {
+ return perrorstr("socket");
+ }
+
+- if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &true, sizeof(true))) {
+- close(s);
+- return perrorstr("setsockopt");
+- }
+- if (setsockopt(s, SOL_IP, IP_TTL, &ttl, sizeof(ttl))) {
+- close(s);
+- return perrorstr("setsockopt");
+- }
+-
+ if (flags & PUMP_FLAG_NOCONFIG) {
+ if ((chptr = getInterfaceInfo(intf, s))) {
+ close(s);
+@@ -1301,7 +1326,7 @@
+
+ if ((chptr = prepareRequest(&breq, s, intf->device, startTime))) {
+ close(s);
+- pumpDisableInterface(intf->device);
++ pumpDisableInterface(intf);
+ return chptr;
+ }
+
+@@ -1318,19 +1343,10 @@
+ addVendorCode(&breq, DHCP_OPTION_CLASS_IDENTIFIER,
+ strlen(class) + 1, class);
+ }
+- memset(&clientAddr.sin_addr, 0, sizeof(&clientAddr.sin_addr));
+- clientAddr.sin_family = AF_INET;
+- clientAddr.sin_port = htons(BOOTP_CLIENT_PORT); /* bootp client */
+-
+- if (bind(s, (struct sockaddr *) &clientAddr, sizeof(clientAddr))) {
+- pumpDisableInterface(intf->device);
+- close(s);
+- return perrorstr("bind");
+- }
+
+ memset(&serverAddr,0,sizeof(serverAddr));
+ serverAddr.sin_family = AF_INET;
+- serverAddr.sin_port = htons(BOOTP_SERVER_PORT); /* bootp server */
++ serverAddr.sin_port = bootp_server_port; /* bootp server */
+
+ #if 0
+ /* seems like a good idea?? */
+@@ -1339,27 +1355,21 @@
+ #endif
+
+ memset(&broadcastAddr,0,sizeof(broadcastAddr));
+- broadcastAddr.sin_family = AF_INET;
+- broadcastAddr.sin_port = htons(BOOTP_SERVER_PORT);
+-
+-#if 0
+- /* this too! */
+- if (intf->set & PUMP_INTFINFO_HAS_BROADCAST)
+- broadcastAddr.sin_addr = intf->broadcast;
+-#endif
+-
+- memset(&broadcastAddr.sin_addr, 0xff,
+- sizeof(broadcastAddr.sin_addr)); /* all 1's broadcast */
++ memset(&broadcastAddr.sll_addr, ~0, ETH_ALEN);
++ broadcastAddr.sll_halen = ETH_ALEN;
++ broadcastAddr.sll_ifindex = intf->ifindex;
++ broadcastAddr.sll_protocol = htons(ETH_P_IP);
+
+ syslog (LOG_DEBUG, "PUMP: sending discover\n");
+
+ if (override && (override->flags & OVERRIDE_FLAG_NOBOOTP))
+ syslog (LOG_DEBUG, "PUMP: Ignoring non-DHCP BOOTP responses\n");
+
+- if ((chptr = handleTransaction(s, override, &breq, &bresp, &broadcastAddr,
+- NULL, (override && (override->flags & OVERRIDE_FLAG_NOBOOTP))?0:1, startTime, DHCP_TYPE_OFFER))) {
++ if ((chptr = handleTransaction(s, override, &breq, &bresp,
++ (struct sockaddr *) &broadcastAddr,
++ sizeof(broadcastAddr), NULL, (override && (override->flags & OVERRIDE_FLAG_NOBOOTP))?0:1, 1, startTime, DHCP_TYPE_OFFER))) {
+ close(s);
+- pumpDisableInterface(intf->device);
++ pumpDisableInterface(intf);
+ return chptr;
+ }
+
+@@ -1378,17 +1388,19 @@
+
+ /* Send another DHCP_DISCOVER with the proper option list */
+ if ((chptr = handleTransaction(s, override, &breq, &bresp,
+- &broadcastAddr, NULL, 0,
++ (struct sockaddr *) &broadcastAddr,
++ sizeof(broadcastAddr),
++ NULL, 0, 1,
+ startTime, DHCP_TYPE_OFFER))) {
+ close(s);
+- pumpDisableInterface(intf->device);
++ pumpDisableInterface(intf);
+ return chptr;
+ }
+
+
+ if (dhcpMessageType(&bresp) != DHCP_TYPE_OFFER) {
+ close(s);
+- pumpDisableInterface(intf->device);
++ pumpDisableInterface(intf);
+ return "dhcp offer expected";
+ }
+
+@@ -1396,7 +1408,7 @@
+
+ if (getVendorCode(&bresp, DHCP_OPTION_SERVER, &serverAddr.sin_addr, sizeof(struct in_addr))) {
+ syslog (LOG_DEBUG, "DHCPOFFER didn't include server address");
+- intf->bootServer = broadcastAddr.sin_addr;
++ intf->bootServer.s_addr = INADDR_BROADCAST;
+ }
+
+ initVendorCodes(&breq);
+@@ -1409,10 +1421,12 @@
+ /* why do we need to use the broadcast address here? better reread the
+ spec! */
+ if ((chptr = handleTransaction(s, override, &breq, &bresp,
+- &broadcastAddr, NULL, 0,
++ (struct sockaddr *) &broadcastAddr,
++ sizeof(broadcastAddr),
++ NULL, 0, 1,
+ startTime, DHCP_TYPE_ACK))) {
+ close(s);
+- pumpDisableInterface(intf->device);
++ pumpDisableInterface(intf);
+ return chptr;
+ }
+
+@@ -1422,7 +1436,7 @@
+
+ if (getVendorCode(&bresp, DHCP_OPTION_SERVER, &intf->bootServer, sizeof(struct in_addr))) {
+ syslog (LOG_DEBUG, "DHCPACK didn't include server address");
+- intf->bootServer = broadcastAddr.sin_addr;
++ intf->bootServer.s_addr = INADDR_BROADCAST;
+ }
+
+ intf->set |= PUMP_INTFINFO_HAS_BOOTSERVER;
+@@ -1434,9 +1448,6 @@
+ if (flags & PUMP_FLAG_FORCEHNLOOKUP)
+ intf->set &= ~(PUMP_NETINFO_HAS_DOMAIN | PUMP_NETINFO_HAS_HOSTNAME);
+
+- /* Save these for later */
+- intf->flags = flags & PUMP_FLAG_WINCLIENTID;
+-
+ return NULL;
+ }
+
+@@ -1448,10 +1459,9 @@
+ }
+
+ void pumpInitOverride(struct pumpOverrideInfo * override) {
+- strcpy(override->intf.device, "MASTER");
++ strcpy(override->device, "MASTER");
+ override->timeout = DEFAULT_TIMEOUT;
+ override->numRetries = DEFAULT_NUM_RETRIES;
+- override->script = NULL;
+ }
+
+ /*
+@@ -1487,3 +1497,68 @@
+ return (time_t)secs;
+ }
+
++static void makeraw(struct ippkt *buf, const void *payload, size_t len) {
++ size_t total = sizeof(struct ip) + sizeof(struct udphdr) + len;
++
++ buf->ip.ip_v = 4;
++ buf->ip.ip_hl = 5;
++ buf->ip.ip_tos = IPTOS_LOWDELAY;
++ buf->ip.ip_len = htons(total);
++ buf->ip.ip_id = 0;
++ buf->ip.ip_off = 0;
++ buf->ip.ip_ttl = 16;
++ buf->ip.ip_p = IPPROTO_UDP;
++ buf->ip.ip_sum = 0;
++ buf->ip.ip_src.s_addr = INADDR_ANY;
++ buf->ip.ip_dst.s_addr = INADDR_BROADCAST;
++
++ buf->ip.ip_sum = wrapsum(checksum(&buf->ip, sizeof(buf->ip), 0));
++
++ buf->udp.source = bootp_client_port;
++ buf->udp.dest = bootp_server_port;
++ buf->udp.len = htons(sizeof(struct udphdr) + len);
++ buf->udp.check = 0;
++
++ buf->udp.check =
++ wrapsum(
++ checksum(
++ &buf->udp, sizeof(buf->udp),
++ checksum(
++ payload, len,
++ checksum(
++ &buf->ip.ip_src,
++ 2 * sizeof(buf->ip.ip_src),
++ IPPROTO_UDP +
++ (uint32_t)
++ ntohs(buf->udp.len)
++ )
++ )
++ )
++ );
++
++ memcpy(buf->payload, payload, len);
++}
++
++uint32_t checksum(const void *buf, size_t len, uint32_t sum) {
++ const char *p = buf;
++ size_t i;
++
++ for (i = 0; i < (len & ~1); i += 2) {
++ sum += ntohs(*(uint16_t *)(p + i));
++ if (sum > 0xffff)
++ sum -= 0xffff;
++ }
++
++ if (i < len) {
++ sum += p[i] << 8;
++ if (sum > 0xffff)
++ sum -= 0xffff;
++ }
++
++ return sum;
++}
++
++uint32_t wrapsum(uint32_t sum) {
++ sum = ~sum & 0xffff;
++ return htons(sum);
++}
+--- pump-0.8.24.orig/config.c
++++ pump-0.8.24/config.c
+@@ -101,8 +101,9 @@
+ }
+
+ *nextO = *override;
+- strcpy(nextO->intf.device, rest);
+- nextO->script = override->script ? strdup(override->script) : NULL;
++ strcpy(nextO->device, rest);
++ if (override->script[0])
++ strcpy(nextO->script, override->script);
+
+ (*lineNum)++;
+ if (readStanza(&next, overrideList, nextO, lineNum)) return 1;
+@@ -155,6 +156,8 @@
+
+ override->numRetries = num;
+ } else if (!strcmp(start, "domainsearch")) {
++ size_t len;
++
+ if (overrideList != override) {
+ parseError(*lineNum, "domainsearch directive may not occur "
+ "inside of device specification");
+@@ -169,12 +172,18 @@
+ return 1;
+ }
+
++ len = strlen(argv[0]);
++ if (len >= sizeof(override->searchPath)) {
++ parseError(*lineNum, "domainsearch directive is too long");
++ return 1;
++ }
++
+ /*
+ We don't free this as other configurations may have inherited
+ it. This could be the wrong decision, but leak would be tiny
+ so why worry?
+ */
+- override->searchPath = strdup(argv[0]);
++ memcpy(override->searchPath, argv[0], len + 1);
+ free(argv);
+ } else if (!strcmp(start, "nodns")) {
+ if (*rest) {
+@@ -200,7 +209,25 @@
+ return 1;
+ }
+ override->flags |= OVERRIDE_FLAG_NONISDOMAIN;
++ } else if (!strcmp(start, "nosetup")) {
++ if (*rest) {
++ parseError(*lineNum, "unexpected argument to nosetup directive");