Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Feb 2005 11:53:03 +0900 (JST)
From:      Yamamoto Shigeru <shigeru@iij.ad.jp>
To:        ports@FreeBSD.org
Subject:   update patch of security/wpa_supplicant, from 0.3.0 to 0.3.8
Message-ID:  <20050216.115303.39149829.shigeru@iij.ad.jp>

next in thread | raw e-mail | index | archive | help
----Next_Part(Wed_Feb_16_11:53:03_2005_009)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Hi, all,

I modify @ports/security/wpa_supplicant/ from 0.3.0 to 0.3.8,
 and make a diff, which is created by "diff -aruN".

my works are,

- change base code: 0.3.0 => 0.3.8 (latest stable release)
- add a patch to create /var/run/wpa_supplicant.pid
- install start/stop script
- install sample configuration file (/usr/local/etc/wpa_supplicatn.conf.sample)

Currently, I'm using this on my NotePC and I have no problem in WEP and
WPA-PSK environment.

If there are no problems in my patch,
 please update @ports/security/wpa_supplicant.

Thanks,
-------
YAMAMOTO Shigeru	<shigeru@iij.ad.jp>

----Next_Part(Wed_Feb_16_11:53:03_2005_009)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="patch-wpa_supplicant"

diff -aruN --exclude CVS wpa_supplicant/Makefile wpa_supplicant.new/Makefile
--- wpa_supplicant/Makefile	Sun Jan  9 15:55:41 2005
+++ wpa_supplicant.new/Makefile	Wed Feb 16 00:56:59 2005
@@ -2,12 +2,12 @@
 # Date created:		7 December 2004
 # Whom:			sam
 #
-# $FreeBSD: ports/security/wpa_supplicant/Makefile,v 1.5 2005/01/08 19:06:48 brooks Exp $
+# $FreeBSD$
 #
 
 PORTNAME=	wpa_supplicant
-PORTVERSION=	0.3.0
-PORTREVISION=	1
+PORTVERSION=	0.3.8
+#PORTREVISION=	1
 CATEGORIES=	security net
 MASTER_SITES=	http://hostap.epitest.fi/releases/
 
@@ -16,9 +16,12 @@
 
 BUILD_DEPENDS=	${LOCALBASE}/lib/libdnet.a:${PORTSDIR}/net/libdnet
 
-PLIST_FILES=	bin/wpa_supplicant \
-		bin/wpa_passphrase \
-		bin/wpa_cli
+PLIST_FILES=	sbin/wpa_supplicant \
+		sbin/wpa_passphrase \
+		sbin/wpa_cli
+
+PLIST_FILES+=	etc/rc.d/${PORTNAME}.sh
+PLIST_FILES+=	etc/${PORTNAME}.conf.sample
 
 .if !defined(NOPORTDOCS)
 DOCFILES=	README \
@@ -39,6 +42,9 @@
 	@${MKDIR} ${DOCSDIR}
 	@${INSTALL_DATA} ${DOCFILES:S|^|${WRKSRC}/|} ${DOCSDIR}
 .endif
+	${INSTALL_SCRIPT} ${FILESDIR}/${PORTNAME}.sh ${PREFIX}/etc/rc.d/${PORTNAME}.sh
+	${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME}.conf ${PREFIX}/etc/${PORTNAME}.conf.sample
+	${CHMOD} 600 ${PREFIX}/etc/${PORTNAME}.conf.sample
 
 .include <bsd.port.pre.mk>
 
diff -aruN --exclude CVS wpa_supplicant/distinfo wpa_supplicant.new/distinfo
--- wpa_supplicant/distinfo	Mon Dec 13 07:23:07 2004
+++ wpa_supplicant.new/distinfo	Tue Feb 15 21:59:11 2005
@@ -1,2 +1,2 @@
-MD5 (wpa_supplicant-0.3.0.tar.gz) = 579e663120882835b5b2484ccfa60548
-SIZE (wpa_supplicant-0.3.0.tar.gz) = 253706
+MD5 (wpa_supplicant-0.3.8.tar.gz) = c9ced104f0322f834a84336c293b4b57
+SIZE (wpa_supplicant-0.3.8.tar.gz) = 301163
diff -aruN --exclude CVS wpa_supplicant/files/patch-grp.h wpa_supplicant.new/files/patch-grp.h
--- wpa_supplicant/files/patch-grp.h	Sun Jan  9 15:55:42 2005
+++ wpa_supplicant.new/files/patch-grp.h	Thu Jan  1 09:00:00 1970
@@ -1,130 +0,0 @@
---- eap.c	Sun Dec  5 16:28:25 2004
-+++ eap.c	Sun Dec 12 15:53:27 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <netinet/in.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_aka.c	Sat Nov 27 10:29:04 2004
-+++ eap_aka.c	Sun Dec 12 15:51:53 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <netinet/in.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_gtc.c	Sat Nov 27 10:29:04 2004
-+++ eap_gtc.c	Sun Dec 12 15:50:50 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <netinet/in.h>
- #include <string.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_leap.c	Sat Nov 27 10:29:04 2004
-+++ eap_leap.c	Sun Dec 12 15:51:40 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <netinet/in.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_md5.c	Sat Dec  4 08:53:24 2004
-+++ eap_md5.c	Sun Dec 12 15:50:32 2004
-@@ -15,6 +15,7 @@
- #include <stdlib.h>
- #include <stdio.h>
- #include <netinet/in.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_mschapv2.c	Sun Dec  5 16:28:25 2004
-+++ eap_mschapv2.c	Sun Dec 12 15:50:42 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <netinet/in.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_otp.c	Sat Nov 27 10:29:04 2004
-+++ eap_otp.c	Sun Dec 12 15:51:01 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <netinet/in.h>
- #include <string.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_peap.c	Sun Dec  5 16:28:25 2004
-+++ eap_peap.c	Sun Dec 12 15:50:15 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <netinet/in.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_psk.c	Sat Nov 27 10:29:04 2004
-+++ eap_psk.c	Sun Dec 12 15:51:47 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <netinet/in.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_sim.c	Sat Nov 27 10:29:04 2004
-+++ eap_sim.c	Sun Dec 12 15:51:08 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <netinet/in.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_tls.c	Sat Nov 27 10:29:04 2004
-+++ eap_tls.c	Sun Dec 12 15:49:28 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <netinet/in.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_tls_common.c	Wed Oct  6 21:25:17 2004
-+++ eap_tls_common.c	Sun Dec 12 15:53:38 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <netinet/in.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
---- eap_ttls.c	Sat Nov 27 10:29:04 2004
-+++ eap_ttls.c	Sun Dec 12 15:50:25 2004
-@@ -16,6 +16,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <netinet/in.h>
-+#include <grp.h>
- 
- #include "common.h"
- #include "eap_i.h"
diff -aruN --exclude CVS wpa_supplicant/files/patch-pidfile wpa_supplicant.new/files/patch-pidfile
--- wpa_supplicant/files/patch-pidfile	Thu Jan  1 09:00:00 1970
+++ wpa_supplicant.new/files/patch-pidfile	Wed Feb 16 01:18:35 2005
@@ -0,0 +1,86 @@
+--- wpa_supplicant.c.orig	Sat Feb  5 15:51:25 2005
++++ wpa_supplicant.c	Wed Feb 16 01:16:55 2005
+@@ -32,6 +32,9 @@
+ #endif /* CONFIG_NATIVE_WINDOWS */
+ #include <fcntl.h>
+ 
++#include <sys/param.h>
++#include <paths.h>
++
+ #define OPENSSL_DISABLE_OLD_DES_SUPPORT
+ #include "common.h"
+ #include "eapol_sm.h"
+@@ -2285,12 +2288,43 @@
+ 	wpa_supplicant_cleanup(wpa_s);
+ }
+ 
++static	const char*	pid_filename = _PATH_VARRUN "wpa_supplicant.pid";
++
++static
++void
++remove_pid_file(void) {
++	unlink(pid_filename);
++}
++
++static
++void
++create_pidfile(const char* path_pid_file) {
++	FILE*	fd;
++
++	if (path_pid_file) {
++		pid_filename = path_pid_file;
++	}
++
++	fd = fopen(pid_filename, "w");
++	if (fd) {
++		pid_t	pid;
++
++		pid = getpid();
++
++		fprintf(fd, "%ld\n", pid);
++		fclose(fd);
++
++		atexit(remove_pid_file);
++	}
++}
++
+ 
+ int main(int argc, char *argv[])
+ {
+ 	struct wpa_supplicant *head, *wpa_s;
+ 	int c;
+ 	const char *confname, *driver, *ifname;
++	const char *path_pid_file = NULL;
+ 	int daemonize = 0, wait_for_interface = 0, disable_eapol = 0, exitcode;
+ 
+ #ifdef CONFIG_NATIVE_WINDOWS
+@@ -2312,7 +2346,7 @@
+ 	ifname = confname = driver = NULL;
+ 
+ 	for (;;) {
+-		c = getopt(argc, argv, "Bc:D:dehi:KLNqtvw");
++		c = getopt(argc, argv, "Bc:D:dehi:KLNp:qtvw");
+ 		if (c < 0)
+ 			break;
+ 		switch (c) {
+@@ -2347,6 +2381,9 @@
+ 		case 'L':
+ 			license();
+ 			return -1;
++		case 'p':
++			path_pid_file = optarg;
++			break;
+ 		case 'q':
+ 			wpa_debug_level++;
+ 			break;
+@@ -2405,6 +2442,10 @@
+ 			exitcode = -1;
+ 			goto cleanup;
+ 		}
++	}
++
++	if (daemonize) {
++		create_pidfile(path_pid_file);
+ 	}
+ 
+ 	eloop_register_signal(SIGINT, wpa_supplicant_terminate, NULL);
diff -aruN --exclude CVS wpa_supplicant/files/patch-type wpa_supplicant.new/files/patch-type
--- wpa_supplicant/files/patch-type	Sun Jan  9 15:55:42 2005
+++ wpa_supplicant.new/files/patch-type	Thu Jan  1 09:00:00 1970
@@ -1,11 +0,0 @@
---- eapol_sm.c	Sun Dec  5 16:28:25 2004
-+++ eapol_sm.c	Sun Dec 12 15:53:17 2004
-@@ -1371,7 +1371,7 @@
- }
- 
- 
--static unsigned int eapol_sm_get_int(void *ctx, enum eapol_int_var variable)
-+static unsigned int eapol_sm_get_int(void *ctx, enum eapol_bool_var variable)
- {
- 	struct eapol_sm *sm = ctx;
- 	if (sm == NULL)
diff -aruN --exclude CVS wpa_supplicant/files/wpa_supplicant.sh wpa_supplicant.new/files/wpa_supplicant.sh
--- wpa_supplicant/files/wpa_supplicant.sh	Thu Jan  1 09:00:00 1970
+++ wpa_supplicant.new/files/wpa_supplicant.sh	Wed Feb 16 01:02:31 2005
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# PROVIDE wpa_supplicant
+# REQUIRE: NETWORKING SERVERS
+# BEFORE: DAEMON
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable wpa_supplicant:
+#
+# wpa_supplicant_enable="YES"
+# wpa_supplicant_interfaces="-i ath0"
+#
+
+. /etc/rc.subr
+
+name=wpa_supplicant
+rcvar=`set_rcvar`
+
+command=/usr/local/sbin/${name}
+pidfile=/var/run/${name}.pid
+wpa_supplicant_config="/usr/local/etc/wpa_supplicant.conf"
+required_files=${wpa_supplicant_config}
+
+load_rc_config $name
+
+wpa_supplicant_flags="-B -w -c ${wpa_supplicant_config} ${wpa_supplicant_interfaces} -p ${pidfile}"
+
+wpa_supplicant_enable=${wpa_supplicant_enable:-"NO"}
+
+run_rc_command "$1"

----Next_Part(Wed_Feb_16_11:53:03_2005_009)----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050216.115303.39149829.shigeru>