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 * |
