pump: Pull patches from gentoo and debian and make it compilable with uclibc
authorKhem Raj <raj.khem@gmail.com>
Wed, 2 Jun 2010 17:40:03 +0000 (10:40 -0700)
committerKhem Raj <raj.khem@gmail.com>
Wed, 2 Jun 2010 17:40:03 +0000 (10:40 -0700)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
recipes/pump/pump/00_00_all_debian.patch [moved from recipes/pump/pump/debian.patch with 88% similarity]
recipes/pump/pump/00_all_retvals.patch [new file with mode: 0644]
recipes/pump/pump/10_all_gentoo.patch [new file with mode: 0644]
recipes/pump/pump/20_all_redefinition.patch [new file with mode: 0644]
recipes/pump/pump/30_all_Makefile.patch [new file with mode: 0644]
recipes/pump/pump/40_all_manpage.patch [new file with mode: 0644]
recipes/pump/pump_0.8.24.bb

similarity index 88%
rename from recipes/pump/pump/debian.patch
rename to recipes/pump/pump/00_00_all_debian.patch
index 63001b8..0f546a0 100644 (file)
@@ -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>
  #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
  
  #define BOOTP_OPCODE_REQUEST  1
  #define BOOTP_OPCODE_REPLY    2
  
-@@ -126,6 +125,12 @@
+@@ -126,6 +125,12 @@ struct psuedohUdpHeader {
      bp_int16 len;
  };
  
  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, 
  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;
  
      return NULL;
  }
  
-@@ -205,15 +202,18 @@
+@@ -205,15 +202,18 @@ static char * perrorstr(char * msg) {
  }
  
  
      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;
  
      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;
        /* 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 */
  }
  
  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)) {
      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");
  
     
      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:
                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;
      
      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++)
              {
                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, 
                                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();
      
      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);
      }
  
                close(sin);
                return perrorstr("sendto");
            }
-@@ -890,9 +913,9 @@
+@@ -890,9 +913,9 @@ static char * handleTransaction(int s, struct pumpOverrideInfo * override,
            continue;
  */
  
                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)) {
  
      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)) {
        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) {
            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));
        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;
      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);
      }
  
      messageType = DHCP_TYPE_REQUEST;
-@@ -1132,6 +1156,7 @@
+@@ -1132,6 +1156,7 @@ int pumpDhcpRenew(struct pumpNetIntf * intf) {
                      intf->hostname);
      } else {
        gethostname(hostname, sizeof(hostname));
        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;
        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);
        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;
  
      /* 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;
  
      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);
        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);
      }
  
  #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));
        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, 
            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");
        }
  
        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, 
            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");
        }
  
        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);
  
      return NULL;
  }
  
-@@ -1448,10 +1459,9 @@
+@@ -1448,10 +1459,9 @@ char * pumpDhcpRun(char * device, int flags, int reqLease,
  }
  
  void pumpInitOverride(struct pumpOverrideInfo * override) {
  }
  
  /*
-@@ -1487,3 +1497,68 @@
+@@ -1487,3 +1497,68 @@ time_t pumpUptime() {
      return (time_t)secs;
  }
  
 +      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>
  .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
  
  .nf
  .ta +3i
-@@ -91,71 +143,108 @@
+@@ -91,71 +143,108 @@ device eth1 {
  .fi
  
  .pp
  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
 -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"
  #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];
        } start;
        int result;                             /* 0 for success */
        struct {
-@@ -90,8 +97,6 @@
+@@ -90,8 +97,6 @@ struct command {
      } u;
  };
  
  char * readSearchPath(void) {
      int fd;
      struct stat sb;
-@@ -132,14 +137,15 @@
+@@ -132,14 +137,15 @@ char * readSearchPath(void) {
      return NULL;
  }
  
  
      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;
  }
  
  void setupDomain(struct pumpNetIntf * intf, 
-@@ -248,8 +247,8 @@
+@@ -248,8 +247,8 @@ void setupDns(struct pumpNetIntf * intf, struct pumpOverrideInfo * override) {
        return;
      }
  
        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 {
  
                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;
 +    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? */
      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);
  }
  
  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;
  
        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);
  }
  
                /* 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,
  
                            /* 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;
            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) {
                            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
 -                                      */
 -      /* 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]);
                        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) {
            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);
                }
  
                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:
                    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) {
                        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);
                    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);
  }
  
  
      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;
  
      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);
  
        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);
  
        {
            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
            }
        }
  
  }
  
  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));
  
  
      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;
      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;
      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 },
            { "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 }
          };
  
      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;
      }
  
      /* 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;
  
      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 {
        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);
  
      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>
      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 */
      int numLog;
      int numLpr;
      int numNtp;
-@@ -72,6 +92,7 @@
+@@ -72,6 +92,7 @@ struct pumpNetIntf {
      int numXdm;
      int numDns;
      int flags;
  
      /* 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 */
  };
  
  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);
  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 (file)
index 0000000..5caef14
--- /dev/null
@@ -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 (file)
index 0000000..e0e67be
--- /dev/null
@@ -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 (file)
index 0000000..3fab8c2
--- /dev/null
@@ -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 (file)
index 0000000..a06f557
--- /dev/null
@@ -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 (file)
index 0000000..e9b5a0e
--- /dev/null
@@ -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.
index 7bff529..686011d 100644 (file)
@@ -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 
 }