diff options
author | Khem Raj <raj.khem@gmail.com> | 2010-06-02 10:40:03 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2010-06-02 10:40:03 -0700 |
commit | a9f8abee2d7926ba2518f96ad58ac53634a64e8b (patch) | |
tree | 6e17ef0bb468ae8d1d8eeba7593a7d843ccc7569 | |
parent | 1e641a55aad361df9049fa82f321c41ed5863cdd (diff) |
pump: Pull patches from gentoo and debian and make it compilable with uclibc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | recipes/pump/pump/00_00_all_debian.patch (renamed from recipes/pump/pump/debian.patch) | 433 | ||||
-rw-r--r-- | recipes/pump/pump/00_all_retvals.patch | 38 | ||||
-rw-r--r-- | recipes/pump/pump/10_all_gentoo.patch | 557 | ||||
-rw-r--r-- | recipes/pump/pump/20_all_redefinition.patch | 13 | ||||
-rw-r--r-- | recipes/pump/pump/30_all_Makefile.patch | 20 | ||||
-rw-r--r-- | recipes/pump/pump/40_all_manpage.patch | 22 | ||||
-rw-r--r-- | recipes/pump/pump_0.8.24.bb | 13 |
7 files changed, 886 insertions, 210 deletions
diff --git a/recipes/pump/pump/debian.patch b/recipes/pump/pump/00_00_all_debian.patch index 63001b88df..0f546a09f7 100644 --- a/recipes/pump/pump/debian.patch +++ b/recipes/pump/pump/00_00_all_debian.patch @@ -1,5 +1,115 @@ ---- pump-0.8.24.orig/dhcp.c -+++ pump-0.8.24/dhcp.c +diff --git a/Makefile b/Makefile +index e8b885d..f9eff0b 100644 +--- a/Makefile ++++ b/Makefile +@@ -6,7 +6,7 @@ USRSBINPATH = $(sbindir) + USRLIBPATH = $(libdir) + INCPATH = $(includedir) + MAN8PATH = $(mandir)/man8 +-CFLAGS = -fPIC -I. -Wall -Werror -g $(RPM_OPT_FLAGS) -D__STANDALONE__ -DVERSION=\"$(VERSION)\" ++CFLAGS = $(DEB_CFLAGS) -I. -Wall -Werror -g $(RPM_OPT_FLAGS) -D__STANDALONE__ -DVERSION=\"$(VERSION)\" -D_GNU_SOURCE + CVSROOT = $(shell cat CVS/Root 2>/dev/null) + + ARCH := $(patsubst i%86,i386,$(shell uname -m)) +diff --git a/config.c b/config.c +index 4d2518b..323366d 100644 +--- a/config.c ++++ b/config.c +@@ -101,8 +101,9 @@ static int readStanza(char ** cfg, struct pumpOverrideInfo * overrideList, + } + + *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 @@ static int readStanza(char ** cfg, struct pumpOverrideInfo * overrideList, + + 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 @@ static int readStanza(char ** cfg, struct pumpOverrideInfo * overrideList, + 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 @@ static int readStanza(char ** cfg, struct pumpOverrideInfo * overrideList, + return 1; + } + override->flags |= OVERRIDE_FLAG_NONISDOMAIN; ++ } else if (!strcmp(start, "nosetup")) { ++ if (*rest) { ++ parseError(*lineNum, "unexpected argument to nosetup directive"); ++ return 1; ++ } ++ override->flags |= ++ OVERRIDE_FLAG_NOSETUP | ++ OVERRIDE_FLAG_NODNS | ++ OVERRIDE_FLAG_NOGATEWAY | ++ OVERRIDE_FLAG_NONISDOMAIN; ++ } else if (!strcmp(start, "noresolvconf")) { ++ if (*rest) { ++ parseError(*lineNum, "unexpected argument to noresolvconf directive"); ++ return 1; ++ } ++ override->flags |= OVERRIDE_FLAG_NORESOLVCONF; + } else if (!strcmp(start, "script")) { ++ size_t len; ++ + if (overrideList != override) { + parseError(*lineNum, "script directive may not occur " + "inside of device specification"); +@@ -214,7 +241,14 @@ static int readStanza(char ** cfg, struct pumpOverrideInfo * overrideList, + "single argument"); + return 1; + } +- override->script = strdup(argv[0]); ++ ++ len = strlen(argv[0]); ++ if (len >= sizeof(override->script)) { ++ parseError(*lineNum, "script directive is too long"); ++ return 1; ++ } ++ ++ memcpy(override->script, argv[0], len + 1); + free(argv); + } else { + char * error; +@@ -245,7 +279,6 @@ int readPumpConfig(char * configFile, struct pumpOverrideInfo ** overrides) { + if ((fd = open(configFile, O_RDONLY)) < 0) { + *overrides = calloc(sizeof(**overrides), 2); + pumpInitOverride(*overrides); +- close(fd); + return 0; + } + +diff --git a/dhcp.c b/dhcp.c +index 852c28f..4794af8 100644 +--- a/dhcp.c ++++ b/dhcp.c @@ -31,9 +31,11 @@ #include <netinet/in.h> #include <netinet/ip.h> @@ -12,7 +122,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -@@ -82,9 +84,6 @@ +@@ -82,9 +84,6 @@ typedef short bp_int16; #define DHCP_OPTION_CLASS_IDENTIFIER 60 #define DHCP_OPTION_CLIENT_IDENTIFIER 61 @@ -22,7 +132,7 @@ #define BOOTP_OPCODE_REQUEST 1 #define BOOTP_OPCODE_REPLY 2 -@@ -126,6 +125,12 @@ +@@ -126,6 +125,12 @@ struct psuedohUdpHeader { bp_int16 len; }; @@ -35,7 +145,7 @@ 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 @@ +@@ -134,36 +139,24 @@ static void initVendorCodes(struct bootpRequest * breq); static char * handleTransaction(int s, struct pumpOverrideInfo * override, struct bootpRequest * breq, struct bootpRequest * bresp, @@ -78,7 +188,7 @@ static char * getInterfaceInfo(struct pumpNetIntf * intf, int s) { struct ifreq req; struct sockaddr_in * addrp; -@@ -177,6 +170,10 @@ +@@ -177,6 +170,10 @@ static char * getInterfaceInfo(struct pumpNetIntf * intf, int s) { intf->broadcast = addrp->sin_addr; intf->set = PUMP_INTFINFO_HAS_BROADCAST; @@ -89,7 +199,7 @@ return NULL; } -@@ -205,15 +202,18 @@ +@@ -205,15 +202,18 @@ static char * perrorstr(char * msg) { } @@ -110,7 +220,7 @@ if (ioctl(s, SIOCGIFFLAGS, &req)) { close(s); return perrorstr("SIOCGIFFLAGS"); -@@ -235,6 +235,12 @@ +@@ -235,6 +235,12 @@ char * pumpSetupInterface(struct pumpNetIntf * intf) { struct ifreq req; struct rtentry route; int s; @@ -123,7 +233,7 @@ s = socket(AF_INET, SOCK_DGRAM, 0); -@@ -246,34 +252,46 @@ +@@ -246,34 +252,46 @@ char * pumpSetupInterface(struct pumpNetIntf * intf) { strcpy(req.ifr_name, intf->device); addrp->sin_addr = intf->ip; @@ -184,7 +294,7 @@ /* add a route for this network */ route.rt_dev = intf->device; route.rt_flags = RTF_UP; -@@ -288,11 +306,14 @@ +@@ -288,11 +306,14 @@ char * pumpSetupInterface(struct pumpNetIntf * intf) { if (ioctl(s, SIOCADDRT, &route)) { /* the route cannot already exist, as we've taken the device down */ @@ -201,7 +311,7 @@ } int pumpSetupDefaultGateway(struct in_addr * gw) { -@@ -317,23 +338,30 @@ +@@ -317,23 +338,30 @@ int pumpSetupDefaultGateway(struct in_addr * gw) { route.rt_dev = NULL; if (ioctl(s, SIOCADDRT, &route)) { @@ -235,7 +345,7 @@ addrp->sin_family = AF_INET; addrp->sin_port = 0; memset(&addrp->sin_addr, 0, sizeof(addrp->sin_addr)); -@@ -344,48 +372,19 @@ +@@ -344,48 +372,19 @@ char * pumpPrepareInterface(struct pumpNetIntf * intf, int s) { if (ioctl(s, SIOCSIFADDR, &req)) return perrorstr("SIOCSIFADDR"); @@ -285,7 +395,7 @@ chptr = response->vendor; -@@ -516,9 +515,17 @@ +@@ -516,9 +515,17 @@ static void parseReply(struct bootpRequest * breq, struct pumpNetIntf * intf) { break; case BOOTP_OPTION_GATEWAY: @@ -305,7 +415,7 @@ break; case BOOTP_OPTION_HOSTNAME: -@@ -692,6 +699,9 @@ +@@ -692,6 +699,9 @@ void debugbootpRequest(char *name, struct bootpRequest *breq) { struct in_addr address; unsigned char *vndptr; unsigned char option, length; @@ -315,7 +425,7 @@ memset(&address,0,sizeof(address)); -@@ -744,12 +754,12 @@ +@@ -744,12 +754,12 @@ void debugbootpRequest(char *name, struct bootpRequest *breq) { sprintf (vendor, "%3u %3u", option, length); for (i = 0; i < length; i++) { @@ -330,7 +440,7 @@ strcpy (vendor, vendor2); } -@@ -763,11 +773,12 @@ +@@ -763,11 +773,12 @@ void debugbootpRequest(char *name, struct bootpRequest *breq) { } static char * handleTransaction(int s, struct pumpOverrideInfo * override, @@ -346,7 +456,7 @@ time_t startTime, int dhcpResponseType) { struct timeval tv; fd_set readfs; -@@ -786,6 +797,9 @@ +@@ -786,6 +797,9 @@ static char * handleTransaction(int s, struct pumpOverrideInfo * override, struct udphdr * udpHdr = NULL; struct psuedohUdpHeader pHdr; time_t start = pumpUptime(); @@ -356,7 +466,7 @@ memset(&pHdr,0,sizeof(pHdr)); debugbootpRequest("breq", breq); -@@ -802,17 +816,26 @@ +@@ -802,17 +816,26 @@ static char * handleTransaction(int s, struct pumpOverrideInfo * override, return strerror(errno); } @@ -389,7 +499,7 @@ close(sin); return perrorstr("sendto"); } -@@ -890,9 +913,9 @@ +@@ -890,9 +913,9 @@ static char * handleTransaction(int s, struct pumpOverrideInfo * override, continue; */ @@ -401,7 +511,7 @@ continue; /* Go on with this packet; it looks sane */ -@@ -1022,12 +1045,12 @@ +@@ -1022,12 +1045,12 @@ static int createSocket(const char * device) { } if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1)) { @@ -416,7 +526,7 @@ if (bind(s, (struct sockaddr *) &clientAddr, sizeof(clientAddr))) { close(s); -@@ -1046,7 +1069,7 @@ +@@ -1046,7 +1069,7 @@ int pumpDhcpRelease(struct pumpNetIntf * intf) { char hostname[1024]; if (!(intf->set & PUMP_INTFINFO_HAS_LEASE)) { @@ -425,7 +535,7 @@ syslog(LOG_INFO, "disabling interface %s", intf->device); return 0; -@@ -1057,7 +1080,7 @@ +@@ -1057,7 +1080,7 @@ int pumpDhcpRelease(struct pumpNetIntf * intf) { if ((chptr = prepareRequest(&breq, s, intf->device, pumpUptime()))) { close(s); while (1) { @@ -434,7 +544,7 @@ return 0; } } -@@ -1072,6 +1095,7 @@ +@@ -1072,6 +1095,7 @@ int pumpDhcpRelease(struct pumpNetIntf * intf) { strlen(intf->hostname) + 1, intf->hostname); } else { gethostname(hostname, sizeof(hostname)); @@ -442,7 +552,7 @@ if (strcmp(hostname, "localhost") && strcmp(hostname, "localhost.localdomain")) { addVendorCode(&breq, BOOTP_OPTION_HOSTNAME, -@@ -1080,13 +1104,13 @@ +@@ -1080,13 +1104,13 @@ int pumpDhcpRelease(struct pumpNetIntf * intf) { } serverAddr.sin_family = AF_INET; @@ -460,7 +570,7 @@ close(s); if (intf->set & PUMP_NETINFO_HAS_HOSTNAME) -@@ -1116,7 +1140,7 @@ +@@ -1116,7 +1140,7 @@ int pumpDhcpRenew(struct pumpNetIntf * intf) { if ((chptr = prepareRequest(&breq, s, intf->device, pumpUptime()))) { close(s); @@ -469,7 +579,7 @@ } messageType = DHCP_TYPE_REQUEST; -@@ -1132,6 +1156,7 @@ +@@ -1132,6 +1156,7 @@ int pumpDhcpRenew(struct pumpNetIntf * intf) { intf->hostname); } else { gethostname(hostname, sizeof(hostname)); @@ -477,7 +587,7 @@ if (strcmp(hostname, "localhost") && strcmp(hostname, "localhost.localdomain")) { addVendorCode(&breq, BOOTP_OPTION_HOSTNAME, -@@ -1143,11 +1168,12 @@ +@@ -1143,11 +1168,12 @@ int pumpDhcpRenew(struct pumpNetIntf * intf) { addVendorCode(&breq, DHCP_OPTION_LEASE, 4, &i); serverAddr.sin_family = AF_INET; @@ -493,7 +603,7 @@ close(s); return 1; } -@@ -1232,6 +1258,7 @@ +@@ -1232,6 +1258,7 @@ static void buildRequest(struct bootpRequest * req, int flags, int type, if (!reqHostname) { reqHostname = alloca(200); gethostname(reqHostname, 200); @@ -501,7 +611,7 @@ if (!strcmp(reqHostname, "localhost") || !strcmp(reqHostname, "localhost.localdomain")) reqHostname = NULL; -@@ -1254,15 +1281,13 @@ +@@ -1254,15 +1281,13 @@ char * pumpDhcpClassRun(char * device, int flags, int reqLease, struct pumpOverrideInfo * override) { int s; struct sockaddr_in serverAddr; @@ -519,7 +629,7 @@ /* If device is the same as intf->device, don't let the memset() blow away the device name */ -@@ -1270,25 +1295,25 @@ +@@ -1270,25 +1295,25 @@ char * pumpDhcpClassRun(char * device, int flags, int reqLease, strcpy(saveDeviceName, device); device = saveDeviceName; @@ -555,7 +665,7 @@ if (flags & PUMP_FLAG_NOCONFIG) { if ((chptr = getInterfaceInfo(intf, s))) { close(s); -@@ -1301,7 +1326,7 @@ +@@ -1301,7 +1326,7 @@ char * pumpDhcpClassRun(char * device, int flags, int reqLease, if ((chptr = prepareRequest(&breq, s, intf->device, startTime))) { close(s); @@ -564,7 +674,7 @@ return chptr; } -@@ -1318,19 +1343,10 @@ +@@ -1318,19 +1343,10 @@ char * pumpDhcpClassRun(char * device, int flags, int reqLease, addVendorCode(&breq, DHCP_OPTION_CLASS_IDENTIFIER, strlen(class) + 1, class); } @@ -585,7 +695,7 @@ #if 0 /* seems like a good idea?? */ -@@ -1339,27 +1355,21 @@ +@@ -1339,27 +1355,21 @@ char * pumpDhcpClassRun(char * device, int flags, int reqLease, #endif memset(&broadcastAddr,0,sizeof(broadcastAddr)); @@ -621,7 +731,7 @@ return chptr; } -@@ -1378,17 +1388,19 @@ +@@ -1378,17 +1388,19 @@ char * pumpDhcpClassRun(char * device, int flags, int reqLease, /* Send another DHCP_DISCOVER with the proper option list */ if ((chptr = handleTransaction(s, override, &breq, &bresp, @@ -644,7 +754,7 @@ return "dhcp offer expected"; } -@@ -1396,7 +1408,7 @@ +@@ -1396,7 +1408,7 @@ char * pumpDhcpClassRun(char * device, int flags, int reqLease, if (getVendorCode(&bresp, DHCP_OPTION_SERVER, &serverAddr.sin_addr, sizeof(struct in_addr))) { syslog (LOG_DEBUG, "DHCPOFFER didn't include server address"); @@ -653,7 +763,7 @@ } initVendorCodes(&breq); -@@ -1409,10 +1421,12 @@ +@@ -1409,10 +1421,12 @@ char * pumpDhcpClassRun(char * device, int flags, int reqLease, /* why do we need to use the broadcast address here? better reread the spec! */ if ((chptr = handleTransaction(s, override, &breq, &bresp, @@ -668,7 +778,7 @@ return chptr; } -@@ -1422,7 +1436,7 @@ +@@ -1422,7 +1436,7 @@ char * pumpDhcpClassRun(char * device, int flags, int reqLease, if (getVendorCode(&bresp, DHCP_OPTION_SERVER, &intf->bootServer, sizeof(struct in_addr))) { syslog (LOG_DEBUG, "DHCPACK didn't include server address"); @@ -677,7 +787,7 @@ } intf->set |= PUMP_INTFINFO_HAS_BOOTSERVER; -@@ -1434,9 +1448,6 @@ +@@ -1434,9 +1448,6 @@ char * pumpDhcpClassRun(char * device, int flags, int reqLease, if (flags & PUMP_FLAG_FORCEHNLOOKUP) intf->set &= ~(PUMP_NETINFO_HAS_DOMAIN | PUMP_NETINFO_HAS_HOSTNAME); @@ -687,7 +797,7 @@ return NULL; } -@@ -1448,10 +1459,9 @@ +@@ -1448,10 +1459,9 @@ char * pumpDhcpRun(char * device, int flags, int reqLease, } void pumpInitOverride(struct pumpOverrideInfo * override) { @@ -699,7 +809,7 @@ } /* -@@ -1487,3 +1497,68 @@ +@@ -1487,3 +1497,68 @@ time_t pumpUptime() { return (time_t)secs; } @@ -768,112 +878,10 @@ + 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"); -+ return 1; -+ } -+ override->flags |= -+ OVERRIDE_FLAG_NOSETUP | -+ OVERRIDE_FLAG_NODNS | -+ OVERRIDE_FLAG_NOGATEWAY | -+ OVERRIDE_FLAG_NONISDOMAIN; -+ } else if (!strcmp(start, "noresolvconf")) { -+ if (*rest) { -+ parseError(*lineNum, "unexpected argument to noresolvconf directive"); -+ return 1; -+ } -+ override->flags |= OVERRIDE_FLAG_NORESOLVCONF; - } else if (!strcmp(start, "script")) { -+ size_t len; -+ - if (overrideList != override) { - parseError(*lineNum, "script directive may not occur " - "inside of device specification"); -@@ -214,7 +241,14 @@ - "single argument"); - return 1; - } -- override->script = strdup(argv[0]); -+ -+ len = strlen(argv[0]); -+ if (len >= sizeof(override->script)) { -+ parseError(*lineNum, "script directive is too long"); -+ return 1; -+ } -+ -+ memcpy(override->script, argv[0], len + 1); - free(argv); - } else { - char * error; -@@ -245,7 +279,6 @@ - if ((fd = open(configFile, O_RDONLY)) < 0) { - *overrides = calloc(sizeof(**overrides), 2); - pumpInitOverride(*overrides); -- close(fd); - return 0; - } - ---- pump-0.8.24.orig/Makefile -+++ pump-0.8.24/Makefile -@@ -6,7 +6,7 @@ - USRLIBPATH = $(libdir) - INCPATH = $(includedir) - MAN8PATH = $(mandir)/man8 --CFLAGS = -fPIC -I. -Wall -Werror -g $(RPM_OPT_FLAGS) -D__STANDALONE__ -DVERSION=\"$(VERSION)\" -+CFLAGS = $(DEB_CFLAGS) -I. -Wall -Werror -g $(RPM_OPT_FLAGS) -D__STANDALONE__ -DVERSION=\"$(VERSION)\" -D_GNU_SOURCE - CVSROOT = $(shell cat CVS/Root 2>/dev/null) - - ARCH := $(patsubst i%86,i386,$(shell uname -m)) ---- pump-0.8.24.orig/pump.8 -+++ pump-0.8.24/pump.8 +diff --git a/pump.8 b/pump.8 +index fc68ba4..04deffd 100644 +--- a/pump.8 ++++ b/pump.8 @@ -1,4 +1,5 @@ .\" Copyright 1999 Red Hat Software, Inc. +.\" August 2004: Updated by Thomas Hood <jdthood@yahoo.co.uk> @@ -912,22 +920,20 @@ .SH DESCRIPTION -pump is a daemon that manages network interfaces that are -controlled by either the DHCP or BOOTP protocol. -- --While pump may be started manually, it is normally started --automatically by the /sbin/ifup script for devices configured --via BOOTP or DHCP. -- --Once pump is managing an interface, you can run pump to query +.B pump +is a daemon that manages network interfaces that are controlled +by either the DHCP or BOOTP protocol. -+ + +-While pump may be started manually, it is normally started +-automatically by the /sbin/ifup script for devices configured +-via BOOTP or DHCP. +While +.B pump +may be started manually, it is normally started automatically by +.BR ifup (8) +for devices configured via BOOTP or DHCP. -+ + +-Once pump is managing an interface, you can run pump to query +If +.B pump +is managing an interface, you can run it again to query @@ -1049,7 +1055,7 @@ .nf .ta +3i -@@ -91,71 +143,108 @@ +@@ -91,71 +143,108 @@ device eth1 { .fi .pp @@ -1187,7 +1193,7 @@ Probably limited to Ethernet, might work on PLIP, probably not ARCnet and Token Ring. The configuration file should let you do more things. -@@ -163,5 +252,5 @@ +@@ -163,5 +252,5 @@ things. Submit bug reports at the Bug Track link at http://developer.redhat.com/ .SH QUIBBLE @@ -1195,8 +1201,10 @@ -like the name (I know, hard to believe)! +A pump, like a boot[p], is something you wear on your foot. +Some of us like the name (I know, hard to believe)! ---- pump-0.8.24.orig/pump.c -+++ pump-0.8.24/pump.c +diff --git a/pump.c b/pump.c +index 0bd3ff2..83641d2 100644 +--- a/pump.c ++++ b/pump.c @@ -52,6 +52,12 @@ #include "config.h" #include "pump.h" @@ -1210,7 +1218,7 @@ #define N_(foo) (foo) #define PROGNAME "pump" -@@ -69,6 +75,7 @@ +@@ -69,6 +75,7 @@ struct command { int flags; int reqLease; /* in seconds */ char reqHostname[200]; @@ -1218,7 +1226,7 @@ } start; int result; /* 0 for success */ struct { -@@ -90,8 +97,6 @@ +@@ -90,8 +97,6 @@ struct command { } u; }; @@ -1227,7 +1235,7 @@ char * readSearchPath(void) { int fd; struct stat sb; -@@ -132,14 +137,15 @@ +@@ -132,14 +137,15 @@ char * readSearchPath(void) { return NULL; } @@ -1245,7 +1253,7 @@ if (!domain) { domain = readSearchPath(); -@@ -148,63 +154,56 @@ +@@ -148,63 +154,56 @@ static void createResolvConf(struct pumpNetIntf * intf, char * domain, strcpy(chptr, domain); free(domain); domain = chptr; @@ -1348,7 +1356,7 @@ } void setupDomain(struct pumpNetIntf * intf, -@@ -248,8 +247,8 @@ +@@ -248,8 +247,8 @@ void setupDns(struct pumpNetIntf * intf, struct pumpOverrideInfo * override) { return; } @@ -1359,7 +1367,7 @@ return; } -@@ -258,7 +257,7 @@ +@@ -258,7 +257,7 @@ void setupDns(struct pumpNetIntf * intf, struct pumpOverrideInfo * override) { if (intf->set & PUMP_NETINFO_HAS_HOSTNAME) { hn = intf->hostname; } else { @@ -1368,15 +1376,15 @@ he = gethostbyaddr((char *) &intf->ip, sizeof(intf->ip), AF_INET); -@@ -278,11 +277,35 @@ +@@ -278,11 +277,35 @@ void setupDns(struct pumpNetIntf * intf, struct pumpOverrideInfo * override) { dn = intf->domain; } - createResolvConf(intf, dn, 0); + createResolvConf(intf, override, dn); -+ } -+} -+ + } + } + +void unsetupDns(struct pumpNetIntf * intf, struct pumpOverrideInfo * override) { + struct stat buf; + char *arg; @@ -1390,13 +1398,13 @@ + if (asprintf(&arg, "/sbin/resolvconf -d %s", intf->device) < 0) { + syslog(LOG_ERR, "failed to release resolvconf: %s", strerror(errno)); + return; - } ++ } + + if (system(arg) != 0) + syslog(LOG_ERR, "resolvconf -d %s failed", intf->device); + free(arg); - } - ++} ++ static void callIfupPost(struct pumpNetIntf* intf) { +#ifdef debian + /* can/should we call a debian one? */ @@ -1405,7 +1413,7 @@ pid_t child; char * argv[3]; char arg[64]; -@@ -304,6 +327,7 @@ +@@ -304,6 +327,7 @@ static void callIfupPost(struct pumpNetIntf* intf) { } waitpid(child, NULL, 0); @@ -1413,7 +1421,7 @@ } static void callScript(char* script,int msg,struct pumpNetIntf* intf) { -@@ -312,13 +336,17 @@ +@@ -312,13 +336,17 @@ static void callScript(char* script,int msg,struct pumpNetIntf* intf) { char ** nextArg; char * class = NULL, * chptr; @@ -1432,7 +1440,7 @@ case PUMP_SCRIPT_NEWLEASE: class = "up"; chptr = inet_ntoa(intf->ip); -@@ -357,35 +385,58 @@ +@@ -357,35 +385,58 @@ static void callScript(char* script,int msg,struct pumpNetIntf* intf) { waitpid(child, NULL, 0); } @@ -1502,7 +1510,7 @@ /* if this interface has an expired lease due to * renewal failures and it's time to try again to * get a new lease, then try again -@@ -402,7 +453,7 @@ +@@ -402,7 +453,7 @@ static void runDaemon(int sock, char * configFile, struct pumpOverrideInfo * ove intf[i].reqLease, intf[i].set & PUMP_NETINFO_HAS_HOSTNAME ? intf[i].hostname : NULL, @@ -1511,7 +1519,7 @@ /* failed to get a new lease, so try * again in 30 seconds -@@ -411,14 +462,12 @@ +@@ -411,14 +462,12 @@ static void runDaemon(int sock, char * configFile, struct pumpOverrideInfo * ove } else { intf[i].set &= ~PUMP_INTFINFO_NEEDS_NEWLEASE; @@ -1529,7 +1537,7 @@ if (closest != -1) { tv.tv_sec = intf[closest].renewAt - pumpUptime(); if (tv.tv_sec <= 0) { -@@ -434,13 +483,6 @@ +@@ -434,13 +483,6 @@ static void runDaemon(int sock, char * configFile, struct pumpOverrideInfo * ove */ if ((intf[closest].renewAt = pumpUptime() + 30) > intf[closest].leaseExpiration) { @@ -1543,13 +1551,12 @@ intf[closest].set &= ~PUMP_INTFINFO_HAS_LEASE; intf[closest].set |= PUMP_INTFINFO_NEEDS_NEWLEASE; -@@ -450,39 +492,23 @@ +@@ -450,39 +492,23 @@ static void runDaemon(int sock, char * configFile, struct pumpOverrideInfo * ove intf[closest].reqLease, intf[closest].set & PUMP_NETINFO_HAS_HOSTNAME ? intf[closest].hostname : NULL, - intf + closest, o)) { -+ intf + closest, &intf[closest].override)) { - +- - /* failed to get a new lease, so try - * again in 30 seconds - */ @@ -1558,7 +1565,8 @@ - /* ifdef this out since we now try more than once to get - * a new lease and don't, therefore, want to remove the interface - */ -- ++ intf + closest, &intf[closest].override)) { + - if (numInterfaces == 1) { - callScript(o->script, PUMP_SCRIPT_DOWN, - &intf[closest]); @@ -1593,7 +1601,7 @@ callIfupPost(&intf[closest]); } -@@ -493,6 +519,48 @@ +@@ -493,6 +519,48 @@ static void runDaemon(int sock, char * configFile, struct pumpOverrideInfo * ove if (select(sock + 1, &fds, NULL, NULL, closest != -1 ? &tv : NULL) > 0) { @@ -1642,7 +1650,7 @@ conn = accept(sock, (struct sockaddr *) &addr, &addrLength); if (read(conn, &cmd, sizeof(cmd)) != sizeof(cmd)) { -@@ -504,7 +572,7 @@ +@@ -504,7 +572,7 @@ static void runDaemon(int sock, char * configFile, struct pumpOverrideInfo * ove case CMD_DIE: for (i = 0; i < numInterfaces; i++) { pumpDhcpRelease(intf + i); @@ -1651,7 +1659,7 @@ } syslog(LOG_INFO, "terminating at root's request"); -@@ -515,35 +583,20 @@ +@@ -515,35 +583,20 @@ static void runDaemon(int sock, char * configFile, struct pumpOverrideInfo * ove exit(0); case CMD_STARTIFACE: @@ -1693,7 +1701,7 @@ cmd.u.result = 0; numInterfaces++; } -@@ -557,7 +610,8 @@ +@@ -557,7 +610,8 @@ static void runDaemon(int sock, char * configFile, struct pumpOverrideInfo * ove else { cmd.u.result = pumpDhcpRenew(intf + i); if (!cmd.u.result) { @@ -1703,7 +1711,7 @@ callIfupPost(intf + i); } } -@@ -570,7 +624,7 @@ +@@ -570,7 +624,7 @@ static void runDaemon(int sock, char * configFile, struct pumpOverrideInfo * ove cmd.u.result = RESULT_UNKNOWNIFACE; else { cmd.u.result = pumpDhcpRelease(intf + i); @@ -1712,7 +1720,16 @@ if (numInterfaces == 1) { int j; cmd.type = CMD_RESULT; -@@ -633,12 +687,16 @@ +@@ -598,7 +652,7 @@ static void runDaemon(int sock, char * configFile, struct pumpOverrideInfo * ove + if (intf[i].set & PUMP_NETINFO_HAS_HOSTNAME) + strncpy(cmd.u.status.hostname, + intf->hostname, sizeof(cmd.u.status.hostname)); +- cmd.u.status.hostname[sizeof(cmd.u.status.hostname)] = '\0'; ++ cmd.u.status.hostname[sizeof(cmd.u.status.hostname) - 1] = '\0'; + + if (intf[i].set & PUMP_NETINFO_HAS_DOMAIN) + strncpy(cmd.u.status.domain, +@@ -633,12 +687,16 @@ static void runDaemon(int sock, char * configFile, struct pumpOverrideInfo * ove exit(0); } @@ -1730,7 +1747,7 @@ if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) return -1; -@@ -650,13 +708,44 @@ +@@ -650,13 +708,44 @@ static int openControlSocket(char * configFile, struct pumpOverrideInfo * overri if (!connect(sock, (struct sockaddr *) &addr, addrLength)) return sock; @@ -1779,7 +1796,7 @@ if (!(child = fork())) { close(sock); -@@ -664,12 +753,28 @@ +@@ -664,12 +753,28 @@ static int openControlSocket(char * configFile, struct pumpOverrideInfo * overri close(1); close(2); @@ -1810,7 +1827,7 @@ umask(077); if (bind(sock, (struct sockaddr *) &addr, addrLength)) { syslog(LOG_ERR, "bind to %s failed: %s\n", CONTROLSOCKET, -@@ -682,7 +787,8 @@ +@@ -682,7 +787,8 @@ static int openControlSocket(char * configFile, struct pumpOverrideInfo * overri if (fork()) _exit(0); @@ -1820,7 +1837,7 @@ { time_t now,upt; int updays,uphours,upmins,upsecs; -@@ -700,20 +806,25 @@ +@@ -700,20 +806,25 @@ static int openControlSocket(char * configFile, struct pumpOverrideInfo * overri } } @@ -1849,7 +1866,7 @@ } void printStatus(struct pumpNetIntf i, char * hostname, char * domain, -@@ -729,8 +840,13 @@ +@@ -729,8 +840,13 @@ void printStatus(struct pumpNetIntf i, char * hostname, char * domain, printf("\tBoot server %s\n", inet_ntoa(i.bootServer)); printf("\tNext server %s\n", inet_ntoa(i.nextServer)); @@ -1865,7 +1882,7 @@ if (i.set & PUMP_INTFINFO_HAS_BOOTFILE) printf("\tBoot file: %s\n", bootFile); -@@ -802,7 +918,6 @@ +@@ -802,7 +918,6 @@ int main (int argc, const char ** argv) { char * hostname = ""; poptContext optCon; int rc; @@ -1873,7 +1890,7 @@ int test = 0; int flags = 0; int lease_hrs = 0; -@@ -811,8 +926,11 @@ +@@ -811,8 +926,11 @@ int main (int argc, const char ** argv) { int winId = 0; int release = 0, renew = 0, status = 0, lookupHostname = 0, nodns = 0; int nogateway = 0, nobootp = 0; @@ -1885,7 +1902,7 @@ struct pumpOverrideInfo * overrides; int cont; struct poptOption options[] = { -@@ -836,14 +954,22 @@ +@@ -836,14 +954,22 @@ int main (int argc, const char ** argv) { N_("Release interface"), NULL }, { "renew", 'R', POPT_ARG_NONE, &renew, 0, N_("Force immediate lease renewal"), NULL }, @@ -1908,7 +1925,7 @@ { "win-client-ident", '\0', POPT_ARG_NONE, &winId, 0, N_("Set the client identifier to match Window's") }, /*{ "test", 't', POPT_ARG_NONE, &test, 0, -@@ -852,6 +978,23 @@ +@@ -852,6 +978,23 @@ int main (int argc, const char ** argv) { POPT_AUTOHELP { NULL, '\0', 0, NULL, 0 } }; @@ -1932,7 +1949,7 @@ memset(&cmd, 0, sizeof(cmd)); memset(&response, 0, sizeof(response)); -@@ -871,6 +1014,11 @@ +@@ -871,6 +1014,11 @@ int main (int argc, const char ** argv) { return 1; } @@ -1944,7 +1961,7 @@ /* make sure the config file is parseable before going on any further */ if (readPumpConfig(configFile, &overrides)) return 1; -@@ -885,16 +1033,6 @@ +@@ -885,16 +1033,6 @@ int main (int argc, const char ** argv) { flags |= PUMP_FLAG_WINCLIENTID; if (lookupHostname) flags |= PUMP_FLAG_FORCEHNLOOKUP; @@ -1961,7 +1978,7 @@ if (killDaemon) { cmd.type = CMD_DIE; -@@ -908,6 +1046,8 @@ +@@ -908,6 +1046,8 @@ int main (int argc, const char ** argv) { cmd.type = CMD_STOPIFACE; strcpy(cmd.u.stop.device, device); } else { @@ -1970,7 +1987,7 @@ cmd.type = CMD_STARTIFACE; strcpy(cmd.u.start.device, device); cmd.u.start.flags = flags; -@@ -916,19 +1056,47 @@ +@@ -916,19 +1056,47 @@ int main (int argc, const char ** argv) { else cmd.u.start.reqLease = lease; strcpy(cmd.u.start.reqHostname, hostname); @@ -2027,8 +2044,10 @@ if (response.type == CMD_RESULT) { if (response.u.result) { ---- pump-0.8.24.orig/pump.h -+++ pump-0.8.24/pump.h +diff --git a/pump.h b/pump.h +index 50263bc..6c2be0e 100644 +--- a/pump.h ++++ b/pump.h @@ -6,6 +6,7 @@ #include <arpa/inet.h> #include <sys/time.h> @@ -2070,7 +2089,7 @@ int set; struct in_addr ip, netmask, broadcast, network; struct in_addr bootServer, nextServer; -@@ -58,13 +77,14 @@ +@@ -58,13 +77,14 @@ struct pumpNetIntf { int reqLease; /* in seconds */ char * hostname, * domain; /* dynamically allocated */ char * nisDomain; /* dynamically allocated */ @@ -2086,7 +2105,7 @@ int numLog; int numLpr; int numNtp; -@@ -72,6 +92,7 @@ +@@ -72,6 +92,7 @@ struct pumpNetIntf { int numXdm; int numDns; int flags; @@ -2094,7 +2113,7 @@ /* these don't really belong here, but anaconda's about the only thing * that uses pump and this stuff is needed for the loader on s390 */ -@@ -79,20 +100,6 @@ +@@ -79,20 +100,6 @@ struct pumpNetIntf { struct in_addr ptpaddr; /* ptp address for ptp devs like ctc */ }; @@ -2115,7 +2134,7 @@ void pumpInitOverride(struct pumpOverrideInfo * override); char * pumpDhcpClassRun(char * device, int flags, int lease, char * reqHostname, char * class, struct pumpNetIntf * intf, -@@ -103,7 +110,7 @@ +@@ -103,7 +110,7 @@ char * pumpDhcpRun(char * device, int flags, int lease, char * pumpSetupInterface(struct pumpNetIntf * intf); /* setup an interface for sending a broadcast -- uses all 0's address */ char * pumpPrepareInterface(struct pumpNetIntf * intf, int s); @@ -2124,7 +2143,7 @@ int pumpDhcpRenew(struct pumpNetIntf * intf); int pumpDhcpRelease(struct pumpNetIntf * intf); int pumpSetupDefaultGateway(struct in_addr * gw); -@@ -113,5 +120,14 @@ +@@ -113,5 +120,14 @@ time_t pumpUptime(void); #define RESULT_FAILED 1 #define RESULT_UNKNOWNIFACE 2 diff --git a/recipes/pump/pump/00_all_retvals.patch b/recipes/pump/pump/00_all_retvals.patch new file mode 100644 index 0000000000..5caef14695 --- /dev/null +++ b/recipes/pump/pump/00_all_retvals.patch @@ -0,0 +1,38 @@ +--- pump-0.8.24/pump.c 2008-12-20 12:29:28.000000000 +0100 ++++ pump.c 2008-12-20 12:28:47.000000000 +0100 +@@ -555,7 +555,11 @@ + + listen(sock, 5); + +- write(conn, &c, 1); ++ if (write(conn, &c, 1) < 0) { ++ syslog(LOG_ERR, "failed to write to connection: %s\n", ++ strerror(errno)); ++ exit(1); ++ } + + out: + close(conn); +@@ -731,7 +735,8 @@ + if (!connect(sock_in, (struct sockaddr *) &addr_in, sizeof(addr_in))) { + char c; + +- read(sock_in, &c, 1); ++ if( read(sock_in, &c, 1) < 0) {} ++ + close(sock_in); + goto again; + } +@@ -774,7 +779,11 @@ + exit(1); + } + +- chdir("/"); ++ if( chdir("/") < 0 ) { ++ syslog(LOG_ERR, "couldn't chdir to root: %s\n", strerror(errno)); ++ exit(1); ++ } ++ + umask(077); + if (bind(sock, (struct sockaddr *) &addr, addrLength)) { + syslog(LOG_ERR, "bind to %s failed: %s\n", CONTROLSOCKET, diff --git a/recipes/pump/pump/10_all_gentoo.patch b/recipes/pump/pump/10_all_gentoo.patch new file mode 100644 index 0000000000..e0e67beda6 --- /dev/null +++ b/recipes/pump/pump/10_all_gentoo.patch @@ -0,0 +1,557 @@ +diff -Nru pump-0.8.24.orig/config.c pump-0.8.24/config.c +--- pump-0.8.24.orig/config.c 2009-02-11 10:47:07.000000000 +0100 ++++ pump-0.8.24/config.c 2009-02-11 10:47:33.000000000 +0100 +@@ -155,15 +155,26 @@ + } + + override->numRetries = num; +- } else if (!strcmp(start, "domainsearch")) { +- size_t len; ++ } else if (!strcmp(start, "routemetric")) { ++ poptParseArgvString(rest, &argc, &argv); + +- if (overrideList != override) { +- parseError(*lineNum, "domainsearch directive may not occur " +- "inside of device specification"); ++ if (argc != 1) { ++ parseError(*lineNum, "routemetric directive expects a " ++ "single argument"); + return 1; + } + ++ num = strtol(argv[0], &chptr, 0); ++ if (*chptr) { ++ parseError(*lineNum, "routemetric requires a numeric " ++ "argument"); ++ return 1; ++ } ++ ++ override->routeMetric = num; ++ } else if (!strcmp(start, "domainsearch")) { ++ size_t len; ++ + poptParseArgvString(rest, &argc, &argv); + + if (argc != 1) { +@@ -209,6 +220,12 @@ + return 1; + } + override->flags |= OVERRIDE_FLAG_NONISDOMAIN; ++ } else if (!strcmp(start, "nontp")) { ++ if (*rest) { ++ parseError(*lineNum, "unexpected argument to nontp directive"); ++ return 1; ++ } ++ override->flags |= OVERRIDE_FLAG_NONTP; + } else if (!strcmp(start, "nosetup")) { + if (*rest) { + parseError(*lineNum, "unexpected argument to nosetup directive"); +@@ -228,12 +245,6 @@ + } else if (!strcmp(start, "script")) { + size_t len; + +- if (overrideList != override) { +- parseError(*lineNum, "script directive may not occur " +- "inside of device specification"); +- return 1; +- } +- + poptParseArgvString(rest, &argc, &argv); + + if (argc != 1) { +diff -Nru pump-0.8.24.orig/dhcp.c pump-0.8.24/dhcp.c +--- pump-0.8.24.orig/dhcp.c 2009-02-11 10:47:07.000000000 +0100 ++++ pump-0.8.24/dhcp.c 2009-02-11 10:47:33.000000000 +0100 +@@ -204,16 +204,30 @@ + + char * pumpDisableInterface(struct pumpNetIntf * intf) { + struct ifreq req; ++ struct sockaddr_in * addrp; + int s; + + if (intf->flags & PUMP_FLAG_NOSETUP) + return NULL; + + s = socket(AF_INET, SOCK_DGRAM, 0); +- +- memset(&req,0,sizeof(req)); + ++ memset(&req,0,sizeof(req)); + strcpy(req.ifr_name, intf->device); ++ ++ addrp = (struct sockaddr_in *) &req.ifr_addr; ++ addrp->sin_family = AF_INET; ++ addrp->sin_addr.s_addr = 0; ++ if (ioctl(s, SIOCSIFADDR, &req)) { ++ close(s); ++ return perrorstr("SIOCSIFADDR"); ++ } ++ ++ if (intf->override.flags & OVERRIDE_FLAG_KEEPUP) { ++ close(s); ++ return NULL; ++ } ++ + if (ioctl(s, SIOCGIFFLAGS, &req)) { + close(s); + return perrorstr("SIOCGIFFLAGS"); +@@ -291,18 +305,27 @@ + goto out; + } + +- if (!strcmp(intf->device, "lo")) { +- /* add a route for this network */ +- route.rt_dev = intf->device; +- route.rt_flags = RTF_UP; +- route.rt_metric = 0; ++ route.rt_dev = intf->device; ++ route.rt_flags = RTF_UP; ++ route.rt_metric = 0; ++ ++ addrp->sin_family = AF_INET; ++ addrp->sin_port = 0; ++ addrp->sin_addr = intf->network; ++ memcpy(&route.rt_dst, addrp, sizeof(*addrp)); ++ addrp->sin_addr = intf->netmask; ++ memcpy(&route.rt_genmask, addrp, sizeof(*addrp)); ++ ++ if (strcmp(intf->device,"lo") && intf->override.routeMetric) { ++ if (ioctl(s, SIOCDELRT, &route)) { ++ rc = perrorstr("SIOCDELRT"); ++ goto out; ++ } ++ } + +- addrp->sin_family = AF_INET; +- addrp->sin_port = 0; +- addrp->sin_addr = intf->network; +- memcpy(&route.rt_dst, addrp, sizeof(*addrp)); +- addrp->sin_addr = intf->netmask; +- memcpy(&route.rt_genmask, addrp, sizeof(*addrp)); ++ if (!strcmp(intf->device, "lo") || intf->override.routeMetric) { ++ if (intf->override.routeMetric) ++ route.rt_metric = intf->override.routeMetric + 1; + + if (ioctl(s, SIOCADDRT, &route)) { + /* the route cannot already exist, as we've taken the device down */ +@@ -316,31 +339,37 @@ + return rc; + } + +-int pumpSetupDefaultGateway(struct in_addr * gw) { ++int pumpSetupDefaultGateway(struct pumpNetIntf * intf) { + struct sockaddr_in addr; + struct rtentry route; + int s; ++ int i; + + s = socket(AF_INET, SOCK_DGRAM, 0); +- +- memset(&addr,0,sizeof(addr)); +- memset(&route,0,sizeof(route)); +- addr.sin_family = AF_INET; +- addr.sin_port = 0; +- addr.sin_addr.s_addr = INADDR_ANY; +- memcpy(&route.rt_dst, &addr, sizeof(addr)); +- memcpy(&route.rt_genmask, &addr, sizeof(addr)); +- addr.sin_addr = *gw; +- memcpy(&route.rt_gateway, &addr, sizeof(addr)); +- +- route.rt_flags = RTF_UP | RTF_GATEWAY; +- route.rt_metric = 0; +- route.rt_dev = NULL; + +- if (ioctl(s, SIOCADDRT, &route)) { +- close(s); +- syslog(LOG_ERR, "failed to set default route: %s", strerror(errno)); +- return -1; ++ for (i = intf->numGateways - 1; i >= 0; i--) { ++ memset(&addr,0,sizeof(addr)); ++ memset(&route,0,sizeof(route)); ++ addr.sin_family = AF_INET; ++ addr.sin_port = 0; ++ addr.sin_addr.s_addr = INADDR_ANY; ++ memcpy(&route.rt_dst, &addr, sizeof(addr)); ++ memcpy(&route.rt_genmask, &addr, sizeof(addr)); ++ addr.sin_addr = intf->gateways[i]; ++ memcpy(&route.rt_gateway, &addr, sizeof(addr)); ++ ++ route.rt_flags = RTF_UP | RTF_GATEWAY; ++ route.rt_dev = intf->device; ++ if (intf->override.routeMetric) ++ route.rt_metric = intf->override.routeMetric + 1; ++ else ++ route.rt_metric = 0; ++ ++ if (ioctl(s, SIOCADDRT, &route)) { ++ close(s); ++ syslog(LOG_ERR, "failed to set default route: %s", strerror(errno)); ++ return -1; ++ } + } + + close(s); +@@ -386,7 +415,7 @@ + unsigned char option, length; + + +- chptr = response->vendor; ++ chptr = (unsigned char *) response->vendor; + + chptr += 4; + while (*chptr != 0xFF) { +@@ -463,7 +492,7 @@ + intf->set |= PUMP_INTFINFO_HAS_NEXTSERVER; + syslog (LOG_DEBUG, "intf: next server: %s", inet_ntoa (intf->nextServer)); + +- chptr = breq->vendor; ++ chptr = (unsigned char *) breq->vendor; + chptr += 4; + while (*chptr != 0xFF && (void *) chptr < (void *) breq->vendor + DHCP_VENDOR_LENGTH) { + option = *chptr++; +@@ -729,7 +758,7 @@ + syslog (LOG_DEBUG, "%s: servername: %s", name, breq->servername); + syslog (LOG_DEBUG, "%s: bootfile: %s", name, breq->bootfile); + +- vndptr = breq->vendor; ++ vndptr = (unsigned char *) breq->vendor; + sprintf (vendor, "0x%02x 0x%02x 0x%02x 0x%02x", vndptr[0], vndptr[1], vndptr[2], vndptr[3]); + vndptr += 4; + syslog (LOG_DEBUG, "%s: vendor: %s", name, vendor); +@@ -741,7 +770,7 @@ + if (option == 0xFF) + { + sprintf (vendor, "0x%02x", option); +- vndptr = breq->vendor + DHCP_VENDOR_LENGTH; ++ vndptr = (unsigned char *)breq->vendor + DHCP_VENDOR_LENGTH; + } + else if (option == 0x00) + { +@@ -990,7 +1019,7 @@ + unsigned char * chptr; + int theOption, theLength; + +- chptr = breq->vendor; ++ chptr = (unsigned char *) breq->vendor; + chptr += 4; + while (*chptr != 0xFF && *chptr != option) { + theOption = *chptr++; +@@ -1010,7 +1039,7 @@ + unsigned char * chptr; + unsigned int length, theOption; + +- chptr = bresp->vendor; ++ chptr = (unsigned char *) bresp->vendor; + chptr += 4; + while (*chptr != 0xFF && *chptr != option) { + theOption = *chptr++; +diff -Nru pump-0.8.24.orig/pump.8 pump-0.8.24/pump.8 +--- pump-0.8.24.orig/pump.8 2009-02-11 10:47:07.000000000 +0100 ++++ pump-0.8.24/pump.8 2009-02-11 10:47:33.000000000 +0100 +@@ -1,5 +1,6 @@ + .\" Copyright 1999 Red Hat Software, Inc. + .\" August 2004: Updated by Thomas Hood <jdthood@yahoo.co.uk> ++.\" July 2005: Updated by Roy Marples <uberlord@gentoo.org> + .\" + .\" This man page is free documentation; you can redistribute it and/or modify + .\" it under the terms of the GNU General Public License as published by +@@ -29,8 +30,10 @@ + .IR IFACE ] + .BR "" [ \-l | \-\-lease + .IR HOURS ] ++.BR "" [ \-m | \-\-route\-metric ++.IR METRIC ] + .BR "" [ \-\-lookup\-hostname ] +-.BR "" [ \-\-no\-dns "] [" \-\-no\-gateway "] [" \-\-no\-setup "] [" \-\-no\-resolvconf ] ++.BR "" [ \-\-no\-dns "] [" \-\-no\-gateway "] [" \-\- no\-ntp "] [" \-\-no\-setup "] + .BR "" [ \-\-release "] [" \-\-renew "] [" \-\-script = + .IR ISCRIPT ] + .BR "" [ \-\-status ] +@@ -67,13 +70,16 @@ + \-d \-\-no\-dns Don't update DNS resolver configuration + \-h \-\-hostname=\fIHOSTNAME\fR Request \fIHOSTNAME\fR + \-i \-\-interface=\fIIFACE\fR Manage \fIIFACE\fR rather than eth0 ++ \-\-keep\-up Keep the interface up when released + \-k \-\-kill Kill daemon (and disable all interfaces) + \-l \-\-lease=\fIHOURS\fR Request least time of \fIHOURS\fR + \-\-lookup\-hostname Look up hostname in DNS + \-R \-\-renew Renew lease immediately + \-r \-\-release Release interface ++\-m \-\-route-metric=\fIMETRIC\fR Metric to use on routes (normally 0) + \-\-no\-gateway Don't configurate a default route for this interface + \-\-no\-resolvconf Don't use the \fBresolvconf\fR program to update resolv.conf ++ \-\-no\-ntp Don't update ntp.conf + \-\-no\-setup Don't set up anything + \-\-script=\fISCRIPT\fR Call \fISCRIPT\fR (or null string to disable) + \-s \-\-status Display interface status +@@ -164,8 +170,13 @@ + Use \fISEARCHPATH\fR as the DNS search path instead of the domain + name returned by the server or the domain part of the fully + qualified hostname. +-As a machine only has a single DNS search path, this directive may +-only be used globally. ++ ++.TP ++\fBkeepup\fR ++Keep the interface up when released. ++Normally \fBpump\fR brings the interface down when it releases its ++lease, but some daemons such as ifplugd or wpa_supplicant still need the ++interface to be up so that they can still work. + + .TP + \fBnonisdomain\fR +@@ -173,22 +184,24 @@ + Normally \fBpump\fR sets the system's NIS domain + if an NIS domain is specified by the DHCP server + and the current NIS domain is empty or \fBlocaldomain\fR. +-This directive may only be used within a \fBdevice\fR directive. + + .TP + \fBnodns\fR + Don't update /etc/resolv.conf when the interface is configured. +-This directive may only be used within a \fBdevice\fR directive. + + .TP + \fBnogateway\fR + Ignore any default gateway suggested by the DHCP server for this device. +-This can be useful on machines with multiple Ethernet cards. ++This can be useful on machines with multiple devices. ++ ++.TP ++\fBnontp\fR ++Don't update /etc/ntp.conf when the interface is configured. + + .TP + \fBnosetup\fR + Don't set up anything on the local machine as a result of DHCP operations. +-This implies \fBnodns\fR, \fBnonisdomain\fR and \fBnogateway\fR. ++This implies \fBnodns\fR, \fBnonisdomain\fR, \fBnogateway\fR and \fBnontp\fR. + This option is useful, for example, + if you want to perform setup in customised scripts. + +diff -Nru pump-0.8.24.orig/pump.c pump-0.8.24/pump.c +--- pump-0.8.24.orig/pump.c 2009-02-11 10:47:07.000000000 +0100 ++++ pump-0.8.24/pump.c 2009-02-11 10:47:33.000000000 +0100 +@@ -188,9 +188,17 @@ + + errno = 0; + +- if (domain) +- if(fprintf(f, "search %s\n", domain) < 0) +- syslog(LOG_ERR, "failed to write resolver configuration data\n"); ++ fprintf(f, "# Generated by pump for interface %s\n", intf->device); ++ ++ if (domain) { ++ if (strchr(domain, ' ')) { ++ if(fprintf(f, "search %s\n", domain) < 0) ++ syslog(LOG_ERR, "failed to write resolver configuration data\n"); ++ } else { ++ if(fprintf(f, "search %s\n", domain) < 0) ++ syslog(LOG_ERR, "failed to write resolver configuration data\n"); ++ } ++ } + + for (i = 0; i < intf->numDns; i++) + if(fprintf(f, "nameserver %s\n", inet_ntoa(intf->dnsServers[i])) < 0) +@@ -301,35 +309,6 @@ + free(arg); + } + +-static void callIfupPost(struct pumpNetIntf* intf) { +-#ifdef debian +- /* can/should we call a debian one? */ +- return; +-#else +- pid_t child; +- char * argv[3]; +- char arg[64]; +- +- argv[0] = "/etc/sysconfig/network-scripts/ifup-post"; +- snprintf(arg,64,"ifcfg-%s",intf->device); +- argv[1] = arg; +- argv[2] = NULL; +- +- if (!(child = fork())) { +- /* send the script to init */ +- if (fork()) _exit(0); +- +- execvp(argv[0], argv); +- +- syslog(LOG_ERR,"failed to run %s: %s", argv[0], strerror(errno)); +- +- _exit(0); +- } +- +- waitpid(child, NULL, 0); +-#endif +-} +- + static void callScript(char* script,int msg,struct pumpNetIntf* intf) { + pid_t child; + char * argv[20]; +@@ -392,12 +371,8 @@ + + syslog(LOG_INFO, "configured interface %s", intf->device); + +- if (!(o->flags & OVERRIDE_FLAG_NOGATEWAY)) { +- int i; +- +- for (i = intf->numGateways - 1; i >= 0; i--) +- pumpSetupDefaultGateway(&intf->gateways[i]); +- } ++ if (!(o->flags & OVERRIDE_FLAG_NOGATEWAY)) ++ pumpSetupDefaultGateway(intf); + + setupDns(intf, o); + setupDomain(intf, o); +@@ -509,7 +484,6 @@ + } else { + callScript(intf[closest].override.script, + PUMP_SCRIPT_RENEWAL, &intf[closest]); +- callIfupPost(&intf[closest]); + } + + continue; /* recheck timeouts */ +@@ -616,7 +590,6 @@ + if (!cmd.u.result) { + callScript(intf[i].override.script, + PUMP_SCRIPT_RENEWAL, intf + i); +- callIfupPost(intf + i); + } + } + break; +@@ -850,7 +823,6 @@ + printf("\tNext server %s\n", inet_ntoa(i.nextServer)); + + if (i.numGateways) { +- printf("\tGateway: %s\n", inet_ntoa(i.gateways[0])); + printf("\tGateways:"); + for (j = 0; j < i.numGateways; j++) + printf(" %s", inet_ntoa(i.gateways[j])); +@@ -934,12 +906,15 @@ + int killDaemon = 0; + int winId = 0; + int release = 0, renew = 0, status = 0, lookupHostname = 0, nodns = 0; +- int nogateway = 0, nobootp = 0; ++ int nogateway = 0, nobootp = 0, nontp = 0; + int nosetup = 0; + int noresolvconf = 0; ++ int routeMetric = 0; ++ int keepUp = 0; + struct command cmd, response; + char * configFile = "/etc/pump.conf"; + char * script = NULL; ++ char * searchPath = NULL; + struct pumpOverrideInfo * overrides; + int cont; + struct poptOption options[] = { +@@ -951,6 +926,8 @@ + { "interface", 'i', POPT_ARG_STRING, &device, 0, + N_("Interface to configure (normally eth0)"), + N_("iface") }, ++ { "keep-up", 'u', POPT_ARG_NONE, &keepUp, 0, ++ N_("Keep the interface up when releasing it") }, + { "kill", 'k', POPT_ARG_NONE, &killDaemon, 0, + N_("Kill daemon (and disable all interfaces)"), NULL }, + { "lease", 'l', POPT_ARG_INT, &lease_hrs, 0, +@@ -963,7 +940,9 @@ + N_("Release interface"), NULL }, + { "renew", 'R', POPT_ARG_NONE, &renew, 0, + N_("Force immediate lease renewal"), NULL }, +- { "verbose", 'v', POPT_ARG_NONE, &verbose, 0, ++ { "route-metric", 'm', POPT_ARG_INT, &routeMetric, 0, ++ N_("Metric applied to routes (normally 0)"), N_("(metric)") }, ++ { "verbose", 'v', POPT_ARG_NONE, &verbose, 0, + N_("Log verbose debug info"), NULL }, + { "status", 's', POPT_ARG_NONE, &status, 0, + N_("Display interface status"), NULL }, +@@ -971,12 +950,16 @@ + N_("Don't update resolv.conf"), NULL }, + { "no-gateway", '\0', POPT_ARG_NONE, &nogateway, 0, + N_("Don't set a gateway for this interface"), NULL }, ++ { "no-ntp", '\0', POPT_ARG_NONE, &nontp, 0, ++ N_("Don't update ntp.conf"), NULL }, + { "no-setup", '\0', POPT_ARG_NONE, &nosetup, 0, + N_("Don't set up anything"), NULL }, + { "no-resolvconf", '\0', POPT_ARG_NONE, &noresolvconf, 0, + N_("Don't set up resolvconf"), NULL }, + { "no-bootp", '\0', POPT_ARG_NONE, &nobootp, 0, + N_("Ignore non-DHCP BOOTP responses"), NULL }, ++ { "search-path", 'p', POPT_ARG_STRING, &searchPath, 0, ++ N_("Use this DNS search path instead of the supplied one"), NULL }, + { "script", '\0', POPT_ARG_STRING, &script, 0, + N_("Script to use") }, + { "win-client-ident", '\0', POPT_ARG_NONE, &winId, 0, +@@ -1023,6 +1006,11 @@ + return 1; + } + ++ if (searchPath && strlen(searchPath) > sizeof(overrides->searchPath)) { ++ fprintf(stderr, _("%s: --search-path argument is to long\n"), PROGNAME); ++ return 1; ++ } ++ + if (script && strlen(script) > sizeof(overrides->script)) { + fprintf(stderr, _("%s: --script argument is too long\n"), PROGNAME); + return 1; +@@ -1042,7 +1030,7 @@ + flags |= PUMP_FLAG_WINCLIENTID; + if (lookupHostname) + flags |= PUMP_FLAG_FORCEHNLOOKUP; +- ++ + if (killDaemon) { + cmd.type = CMD_DIE; + } else if (status) { +@@ -1078,14 +1066,22 @@ + o->flags |= OVERRIDE_FLAG_NOBOOTP; + if (nogateway) + o->flags |= OVERRIDE_FLAG_NOGATEWAY; ++ if (nontp) ++ o->flags |= OVERRIDE_FLAG_NONTP; + if (nosetup) + o->flags |= + OVERRIDE_FLAG_NOSETUP | + OVERRIDE_FLAG_NODNS | + OVERRIDE_FLAG_NOGATEWAY | ++ OVERRIDE_FLAG_NONTP | + OVERRIDE_FLAG_NONISDOMAIN; + if (noresolvconf) + o->flags |= OVERRIDE_FLAG_NORESOLVCONF; ++ if (keepUp) ++ o->flags |= OVERRIDE_FLAG_KEEPUP; ++ o->routeMetric = routeMetric; ++ if (searchPath) ++ strcpy(o->searchPath, searchPath); + if (script) + strcpy(o->script, script); + +diff -Nru pump-0.8.24.orig/pump.h pump-0.8.24/pump.h +--- pump-0.8.24.orig/pump.h 2009-02-11 10:47:07.000000000 +0100 ++++ pump-0.8.24/pump.h 2009-02-11 10:47:33.000000000 +0100 +@@ -55,6 +55,8 @@ + #define OVERRIDE_FLAG_NOBOOTP (1 << 3) + #define OVERRIDE_FLAG_NOSETUP (1 << 4) + #define OVERRIDE_FLAG_NORESOLVCONF (1 << 5) ++#define OVERRIDE_FLAG_NONTP (1 << 6) ++#define OVERRIDE_FLAG_KEEPUP (1 << 7) + + struct pumpOverrideInfo { + char device[10]; +@@ -63,6 +65,7 @@ + int numRetries; + int timeout; + char script[1024]; ++ int routeMetric; + }; + + /* all of these in_addr things are in network byte order! */ +@@ -113,7 +116,7 @@ + char * pumpDisableInterface(struct pumpNetIntf * intf); + int pumpDhcpRenew(struct pumpNetIntf * intf); + int pumpDhcpRelease(struct pumpNetIntf * intf); +-int pumpSetupDefaultGateway(struct in_addr * gw); ++int pumpSetupDefaultGateway(struct pumpNetIntf * intf); + time_t pumpUptime(void); + + #define RESULT_OKAY 0 diff --git a/recipes/pump/pump/20_all_redefinition.patch b/recipes/pump/pump/20_all_redefinition.patch new file mode 100644 index 0000000000..3fab8c24a0 --- /dev/null +++ b/recipes/pump/pump/20_all_redefinition.patch @@ -0,0 +1,13 @@ +diff -Nru pump-0.8.24.orig/pump.c pump-0.8.24/pump.c +--- pump-0.8.24.orig/pump.c 2009-02-11 10:48:34.000000000 +0100 ++++ pump-0.8.24/pump.c 2009-02-11 10:48:54.000000000 +0100 +@@ -58,7 +58,9 @@ + int bootp_server_port; + #endif + ++#if !defined(N_) + #define N_(foo) (foo) ++#endif + + #define PROGNAME "pump" + #define CONTROLSOCKET "/var/run/pump.sock" diff --git a/recipes/pump/pump/30_all_Makefile.patch b/recipes/pump/pump/30_all_Makefile.patch new file mode 100644 index 0000000000..a06f557181 --- /dev/null +++ b/recipes/pump/pump/30_all_Makefile.patch @@ -0,0 +1,20 @@ +diff -Nru pump-0.8.24.vanilla/Makefile pump-0.8.24/Makefile +--- pump-0.8.24.vanilla/Makefile 2009-03-07 15:55:01.000000000 +0000 ++++ pump-0.8.24/Makefile 2009-03-07 15:56:21.000000000 +0000 +@@ -6,14 +6,13 @@ + USRLIBPATH = $(libdir) + INCPATH = $(includedir) + MAN8PATH = $(mandir)/man8 +-CFLAGS = $(DEB_CFLAGS) -I. -Wall -Werror -g $(RPM_OPT_FLAGS) -D__STANDALONE__ -DVERSION=\"$(VERSION)\" -D_GNU_SOURCE ++CFLAGS = $(DEB_CFLAGS) -I. -Wall $(RPM_OPT_FLAGS) -D__STANDALONE__ -DVERSION=\"$(VERSION)\" -D_GNU_SOURCE + CVSROOT = $(shell cat CVS/Root 2>/dev/null) + + ARCH := $(patsubst i%86,i386,$(shell uname -m)) + ARCH := $(patsubst sparc%,sparc,$(ARCH)) + +-LOADLIBES = -Wl,-Bstatic -lpopt -Wl,-Bdynamic -lresolv +-LDFLAGS = -g ++LOADLIBES = -lpopt -lresolv + + CVSTAG = r$(subst .,-,$(VERSION)) + diff --git a/recipes/pump/pump/40_all_manpage.patch b/recipes/pump/pump/40_all_manpage.patch new file mode 100644 index 0000000000..e9b5a0eba2 --- /dev/null +++ b/recipes/pump/pump/40_all_manpage.patch @@ -0,0 +1,22 @@ +diff --git a/pump.8 b/pump.8 +index d1dce5c..d976748 100644 +--- a/pump.8 ++++ b/pump.8 +@@ -77,7 +77,7 @@ switch long option description + \-R \-\-renew Renew lease immediately + \-r \-\-release Release interface + \-m \-\-route-metric=\fIMETRIC\fR Metric to use on routes (normally 0) +- \-\-no\-gateway Don't configurate a default route for this interface ++ \-\-no\-gateway Don't configure a default route for this interface + \-\-no\-resolvconf Don't use the \fBresolvconf\fR program to update resolv.conf + \-\-no\-ntp Don't update ntp.conf + \-\-no\-setup Don't set up anything +@@ -253,7 +253,7 @@ If the UNIX domain socket (normally \fI/var/run/pump.sock\fR) + does not exist, + .B pump + tries to connect to tcp/127.0.0.1:68. +-If it is also unreacheable (possibly due to packet filtering), ++If it is also unreachable (possibly due to packet filtering), + .B pump + will issue a warning to stderr and assume that there is no + instance of itself running. diff --git a/recipes/pump/pump_0.8.24.bb b/recipes/pump/pump_0.8.24.bb index 7bff529cdf..686011db9e 100644 --- a/recipes/pump/pump_0.8.24.bb +++ b/recipes/pump/pump_0.8.24.bb @@ -2,13 +2,20 @@ DESCRIPTION = "BOOTP and DHCP client for automatic IP configuration" SECTION = "console/network" PRIORITY = "optional" LICENSE = "GPL" -DEPENDS = "popt" +DEPENDS = "popt virtual/libiconv" + +PR = "r1" S = "${WORKDIR}/pump-${PV}" SRC_URI = "http://ftp.de.debian.org/debian/pool/main/p/pump/pump_0.8.24.orig.tar.gz \ - file://debian.patch" - + file://00_00_all_debian.patch \ + file://00_all_retvals.patch \ + file://10_all_gentoo.patch \ + file://20_all_redefinition.patch \ + file://30_all_Makefile.patch \ + file://40_all_manpage.patch \ + " do_compile() { oe_runmake pump } |