svn commit: r304747 - in head/net/rp-pppoe: . files
Matthias Andree
mandree at FreeBSD.org
Sun Sep 23 15:33:15 UTC 2012
Author: mandree
Date: Sun Sep 23 15:33:15 2012
New Revision: 304747
URL: http://svn.freebsd.org/changeset/ports/304747
Log:
- Update to new upstream release 3.11.
- Convert to Options NG (for NOPORTDOCS -> DOCS)
- Rediff patches.
- Fix a few omissions in the upstream BPF-related source,
the upstream no longer maintains *BSD.
- Fix a bug in MD5 that does not completely zero out its
work area - this is an omnipresent bug.
Warning: only discovery against a Linux-based PPPoE server v3.8 was tested,
not server-mode or running a session.
Added:
head/net/rp-pppoe/files/patch-configure (contents, props changed)
head/net/rp-pppoe/files/patch-if.c (contents, props changed)
head/net/rp-pppoe/files/patch-md5.c (contents, props changed)
head/net/rp-pppoe/files/patch-pppoe.h (contents, props changed)
head/net/rp-pppoe/files/patch-relay.c (contents, props changed)
head/net/rp-pppoe/files/patch-relay.h (contents, props changed)
Deleted:
head/net/rp-pppoe/files/patch-ab
head/net/rp-pppoe/files/patch-ac
head/net/rp-pppoe/files/patch-ad
head/net/rp-pppoe/files/patch-ae
head/net/rp-pppoe/files/patch-gcc41-aa
Modified:
head/net/rp-pppoe/Makefile (contents, props changed)
head/net/rp-pppoe/distinfo (contents, props changed)
Modified: head/net/rp-pppoe/Makefile
==============================================================================
--- head/net/rp-pppoe/Makefile Sun Sep 23 15:14:54 2012 (r304746)
+++ head/net/rp-pppoe/Makefile Sun Sep 23 15:33:15 2012 (r304747)
@@ -6,7 +6,7 @@
#
PORTNAME= rp-pppoe
-PORTVERSION= 3.10
+PORTVERSION= 3.11
CATEGORIES= net
MASTER_SITES= http://www.roaringpenguin.com/files/download/
@@ -30,7 +30,15 @@ DOC_FILES= CHANGES HOW-TO-CONNECT KERNEL
PROBLEMS
SCRIPT_FILES= pppoe-connect pppoe-init pppoe-setup pppoe-start \
pppoe-status pppoe-stop
-.ifndef (NOPORTDOCS)
+
+OPTIONS_DEFINE= DOCS
+
+# work around "Present But Cannot Be Compiled" issue in GNU configure:
+CFLAGS+= -include sys/types.h -include sys/socket.h -include netinet/in.h
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MDOCS}
PORTDOCS= *
.endif
@@ -49,6 +57,7 @@ post-patch:
@${REINPLACE_CMD} -e "s!/etc/ppp!${PREFIX}/etc/ppp!g" \
${WRKSRC}/scripts/${f}
.endfor
+ @${REINPLACE_CMD} -e "s/\$$^/\$$>/g" ${WRKSRC}/src/Makefile.in
do-install:
# Binaries
Modified: head/net/rp-pppoe/distinfo
==============================================================================
--- head/net/rp-pppoe/distinfo Sun Sep 23 15:14:54 2012 (r304746)
+++ head/net/rp-pppoe/distinfo Sun Sep 23 15:33:15 2012 (r304747)
@@ -1,2 +1,2 @@
-SHA256 (rp-pppoe-3.10.tar.gz) = 709ca7402594acc1d80b99c20219112b5c00e6ac48ae6049fc626fbaf4ce49f6
-SIZE (rp-pppoe-3.10.tar.gz) = 215288
+SHA256 (rp-pppoe-3.11.tar.gz) = 86a1a4d92fcea74fa6dd45516c5975933fa978b36fafe71f76ea70b4b4747720
+SIZE (rp-pppoe-3.11.tar.gz) = 223234
Added: head/net/rp-pppoe/files/patch-configure
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/net/rp-pppoe/files/patch-configure Sun Sep 23 15:33:15 2012 (r304747)
@@ -0,0 +1,11 @@
+--- ./configure.orig 2012-08-17 20:31:25.000000000 +0200
++++ ./configure 2012-09-23 17:27:26.000000000 +0200
+@@ -4672,7 +4672,7 @@
+
+
+ # Determine what targets to build
+-TARGETS="pppoe pppoe-server"
++TARGETS="pppoe pppoe-server pppoe-relay"
+
+ # pppoe-sniff is built only on Linux and Solaris
+ if test "$ac_cv_header_linux_if_packet_h" = "yes" -o "$ac_cv_header_sys_dlpi_h" = "yes" ; then
Added: head/net/rp-pppoe/files/patch-if.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/net/rp-pppoe/files/patch-if.c Sun Sep 23 15:33:15 2012 (r304747)
@@ -0,0 +1,33 @@
+--- ./if.c.orig 2012-08-17 20:31:25.000000000 +0200
++++ ./if.c 2012-09-23 17:27:26.000000000 +0200
+@@ -274,7 +274,7 @@
+ * traffic on this network.
+ ***********************************************************************/
+ int
+-openInterface(char const *ifname, UINT16_t type, unsigned char *hwaddr)
++openInterface(char const *ifname, UINT16_t type, unsigned char *hwaddr, UINT16_t *mtu)
+ {
+ static int fd = -1;
+ char bpfName[32];
+@@ -285,7 +285,12 @@
+ int i;
+
+ /* BSD only opens one socket for both Discovery and Session packets */
++#if defined(__FreeBSD__)
++ /* Confirmed for FreeBSD 4.8-R [SeaD] */
++ if (!hwaddr) {
++#else
+ if (fd >= 0) {
++#endif
+ return fd;
+ }
+
+@@ -395,6 +400,8 @@
+ rp_fatal(buffer);
+ }
+
++ if (mtu) *mtu = ifr.ifr_mtu;
++
+ syslog(LOG_INFO, "Interface=%.16s HWaddr=%02X:%02X:%02X:%02X:%02X:%02X Device=%.32s Buffer size=%d",
+ ifname,
+ hwaddr[0], hwaddr[1], hwaddr[2],
Added: head/net/rp-pppoe/files/patch-md5.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/net/rp-pppoe/files/patch-md5.c Sun Sep 23 15:33:15 2012 (r304747)
@@ -0,0 +1,11 @@
+--- ./md5.c.orig 2012-08-17 20:31:25.000000000 +0200
++++ ./md5.c 2012-09-23 17:27:55.000000000 +0200
+@@ -141,7 +141,7 @@
+ MD5Transform(ctx->buf, (uint32 *) ctx->in);
+ byteReverse((unsigned char *) ctx->buf, 4);
+ memcpy(digest, ctx->buf, 16);
+- memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
++ memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
+ }
+
+ #ifndef ASM_MD5
Added: head/net/rp-pppoe/files/patch-pppoe.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/net/rp-pppoe/files/patch-pppoe.h Sun Sep 23 15:33:15 2012 (r304747)
@@ -0,0 +1,18 @@
+--- ./pppoe.h.orig 2012-08-17 20:31:25.000000000 +0200
++++ ./pppoe.h 2012-09-23 17:27:26.000000000 +0200
+@@ -72,10 +72,14 @@
+ #include <net/if_ppp.h>
+ #endif
+
++#ifdef __FreeBSD__
++#include <sys/types.h>
++#include <net/ethernet.h>
++#endif
++
+ #ifdef USE_BPF
+ extern int bpfSize;
+ struct PPPoEPacketStruct;
+-void sessionDiscoveryPacket(struct PPPoEPacketStruct *packet);
+ #define BPF_BUFFER_IS_EMPTY (bpfSize <= 0)
+ #define BPF_BUFFER_HAS_DATA (bpfSize > 0)
+ #define ethhdr ether_header
Added: head/net/rp-pppoe/files/patch-relay.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/net/rp-pppoe/files/patch-relay.c Sun Sep 23 15:33:15 2012 (r304747)
@@ -0,0 +1,179 @@
+--- ./relay.c.orig 2012-08-17 20:31:25.000000000 +0200
++++ ./relay.c 2012-09-23 17:27:26.000000000 +0200
+@@ -751,6 +751,11 @@
+ relayLoop()
+ {
+ fd_set readable, readableCopy;
++#if defined(__FreeBSD__)
++ PPPoEPacket packet;
++ int size;
++ int type;
++#endif
+ int maxFD;
+ int i, r;
+ int sock;
+@@ -780,6 +785,27 @@
+ continue;
+ }
+
++#if defined(__FreeBSD__)
++ for (i=0; i<NumInterfaces; i++) {
++ /* Because FreeBSD use one interface for both Discovery and
++ Session types we use first socket for packet receiving [SeaD] */
++ if (!FD_ISSET(Interfaces[i].discoverySock, &readableCopy))
++ continue;
++ if (receivePacket(Interfaces[i].discoverySock, &packet, &size) < 0)
++ continue;
++
++ /* Ignore unknown code/version */
++ if (packet.ver != 1 || packet.type != 1)
++ continue;
++
++ type = etherType(&packet);
++ if (type == Eth_PPPOE_Discovery) {
++ relayGotDiscoveryPacket(&Interfaces[i], &packet, size);
++ } else if (type == Eth_PPPOE_Session) {
++ relayGotSessionPacket(&Interfaces[i], &packet, size);
++ }
++ }
++#else
+ /* Handle session packets first */
+ for (i=0; i<NumInterfaces; i++) {
+ if (FD_ISSET(Interfaces[i].sessionSock, &readableCopy)) {
+@@ -794,6 +820,7 @@
+ }
+ }
+
++#endif
+ /* Handle the session-cleaning process */
+ if (FD_ISSET(CleanPipe[0], &readableCopy)) {
+ char dummy;
+@@ -813,6 +840,46 @@
+ *%DESCRIPTION:
+ * Receives and processes a discovery packet.
+ ***********************************************************************/
++#if defined(__FreeBSD__)
++void
++relayGotDiscoveryPacket(PPPoEInterface const *iface,
++ PPPoEPacket *packet,
++ int size)
++{
++
++ if (ntohs(packet->length) + HDR_SIZE > size) {
++ syslog(LOG_ERR, "Bogus PPPoE length field (%u)",
++ (unsigned int) ntohs(packet->length));
++ return;
++ }
++
++ /* Drop Ethernet frame padding */
++ if (size > ntohs(packet->length) + HDR_SIZE) {
++ size = ntohs(packet->length) + HDR_SIZE;
++ }
++
++ switch(packet->code) {
++ case CODE_PADT:
++ relayHandlePADT(iface, packet, size);
++ break;
++ case CODE_PADI:
++ relayHandlePADI(iface, packet, size);
++ break;
++ case CODE_PADO:
++ relayHandlePADO(iface, packet, size);
++ break;
++ case CODE_PADR:
++ relayHandlePADR(iface, packet, size);
++ break;
++ case CODE_PADS:
++ relayHandlePADS(iface, packet, size);
++ break;
++ default:
++ syslog(LOG_ERR, "Discovery packet on %s with unknown code %d",
++ iface->name, (int) packet->code);
++ }
++}
++#else
+ void
+ relayGotDiscoveryPacket(PPPoEInterface const *iface)
+ {
+@@ -860,6 +927,7 @@
+ iface->name, (int) packet.code);
+ }
+ }
++#endif
+
+ /**********************************************************************
+ *%FUNCTION: relayGotSessionPacket
+@@ -870,6 +938,65 @@
+ *%DESCRIPTION:
+ * Receives and processes a session packet.
+ ***********************************************************************/
++#if defined(__FreeBSD__)
++void
++relayGotSessionPacket(PPPoEInterface const *iface,
++ PPPoEPacket *packet,
++ int size)
++{
++ SessionHash *sh;
++ PPPoESession *ses;
++
++ /* Must be a session packet */
++ if (packet->code != CODE_SESS) {
++ syslog(LOG_ERR, "Session packet with code %d", (int) packet->code);
++ return;
++ }
++
++ /* Ignore session packets whose destination address isn't ours */
++ if (memcmp(packet->ethHdr.h_dest, iface->mac, ETH_ALEN)) {
++ return;
++ }
++
++ /* Validate length */
++ if (ntohs(packet->length) + HDR_SIZE > size) {
++ syslog(LOG_ERR, "Bogus PPPoE length field (%u)",
++ (unsigned int) ntohs(packet->length));
++ return;
++ }
++
++ /* Drop Ethernet frame padding */
++ if (size > ntohs(packet->length) + HDR_SIZE) {
++ size = ntohs(packet->length) + HDR_SIZE;
++ }
++
++ /* We're in business! Find the hash */
++ sh = findSession(packet->ethHdr.h_source, packet->session);
++ if (!sh) {
++ /* Don't log this. Someone could be running the client and the
++ relay on the same box. */
++ return;
++ }
++
++ /* Relay it */
++ ses = sh->ses;
++ ses->epoch = Epoch;
++ sh = sh->peer;
++ packet->session = sh->sesNum;
++ memcpy(packet->ethHdr.h_source, sh->interface->mac, ETH_ALEN);
++ memcpy(packet->ethHdr.h_dest, sh->peerMac, ETH_ALEN);
++#if 0
++ fprintf(stderr, "Relaying %02x:%02x:%02x:%02x:%02x:%02x(%s:%d) to %02x:%02x:%02x:%02x:%02x:%02x(%s:%d)\n",
++ sh->peer->peerMac[0], sh->peer->peerMac[1], sh->peer->peerMac[2],
++ sh->peer->peerMac[3], sh->peer->peerMac[4], sh->peer->peerMac[5],
++ sh->peer->interface->name, ntohs(sh->peer->sesNum),
++ sh->peerMac[0], sh->peerMac[1], sh->peerMac[2],
++ sh->peerMac[3], sh->peerMac[4], sh->peerMac[5],
++ sh->interface->name, ntohs(sh->sesNum));
++#endif
++ sendPacket(NULL, sh->interface->sessionSock, packet, size);
++}
++#else
+ void
+ relayGotSessionPacket(PPPoEInterface const *iface)
+ {
+@@ -936,6 +1063,7 @@
+ #endif
+ sendPacket(NULL, sh->interface->sessionSock, &packet, size);
+ }
++#endif
+
+ /**********************************************************************
+ *%FUNCTION: relayHandlePADT
Added: head/net/rp-pppoe/files/patch-relay.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/net/rp-pppoe/files/patch-relay.h Sun Sep 23 15:33:15 2012 (r304747)
@@ -0,0 +1,16 @@
+--- ./relay.h.orig 2012-08-17 20:31:25.000000000 +0200
++++ ./relay.h 2012-09-23 17:27:26.000000000 +0200
+@@ -51,8 +51,13 @@
+
+ /* Function prototypes */
+
++#if defined(__FreeBSD__)
++void relayGotSessionPacket(PPPoEInterface const *iface, PPPoEPacket *packet, int size);
++void relayGotDiscoveryPacket(PPPoEInterface const *iface, PPPoEPacket *packet, int size);
++#else
+ void relayGotSessionPacket(PPPoEInterface const *i);
+ void relayGotDiscoveryPacket(PPPoEInterface const *i);
++#endif
+ PPPoEInterface *findInterface(int sock);
+ unsigned int hash(unsigned char const *mac, UINT16_t sesNum);
+ SessionHash *findSession(unsigned char const *mac, UINT16_t sesNum);
More information about the svn-ports-all
mailing list