FreeBSD Bugzilla – Attachment 148455 Details for
Bug 187363
[new port] net/macchanger: GNU macchanger port for the FreeBSD system
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
1.7.0 version
macchanger.shar (text/plain), 10.77 KB, created by
clutton
on 2014-10-19 02:36:55 UTC
(
hide
)
Description:
1.7.0 version
Filename:
MIME Type:
Creator:
clutton
Created:
2014-10-19 02:36:55 UTC
Size:
10.77 KB
patch
obsolete
># This is a shell archive. Save it in a file, remove anything before ># this line, and then unpack it by entering "sh file". Note, it may ># create directories; files and directories will be owned by you and ># have default permissions. ># ># This archive contains: ># ># macchanger ># macchanger/files ># macchanger/files/patch-configure.ac ># macchanger/files/patch-src_netinfo.c ># macchanger/files/patch-src_main.c ># macchanger/Makefile ># macchanger/distinfo ># macchanger/pkg-descr ># >echo c - macchanger >mkdir -p macchanger > /dev/null 2>&1 >echo c - macchanger/files >mkdir -p macchanger/files > /dev/null 2>&1 >echo x - macchanger/files/patch-configure.ac >sed 's/^X//' >macchanger/files/patch-configure.ac << 'bc6a7efbd91b06038be08ef72820a073' >X--- configure.ac 2014-01-01 18:57:39.000000000 +0200 >X+++ configure.ac 2014-03-19 02:43:40.440612214 +0200 >X@@ -9,6 +9,46 @@ >X >X AC_PROG_INSTALL >X AC_PROG_CC >X+AC_CANONICAL_HOST >X+ >X+case "$host" in >X+*-*-linux*) >X+ AC_DEFINE([LLADDR(s)], [s->sll_addr], [the link level address]) >X+;; >X+*-*-freebsd*) >X+ AC_DEFINE([sockaddr_ll], [sockaddr_dl], [the socket link structures]) >X+ AC_DEFINE([sll_family], [sdl_family], [the socket family member]) >X+ AC_DEFINE([AF_PACKET], [AF_LINK], [the domain name]) >X+ AC_DEFINE([ifr_hwaddr], [ifr_addr], [the address member]) >X+ AC_DEFINE([SIOCSIFHWADDR], [SIOCSIFLLADDR], [the ioctl call]) >X+;; >X+esac >X+ >X+AC_MSG_CHECKING([if sockaddr has the sa_len member]) >X+AC_LINK_IFELSE( >X+ [AC_LANG_PROGRAM( >X+ [[ #include <sys/socket.h> ]], >X+ [[ struct sockaddr sock; return (sock.sa_len); ]])], >X+ [AC_DEFINE([HAVE_SOCKADDR_SA_LEN], [1], >X+ [socket address structures have length fields]) >X+]) >X+ >X+AC_CHECK_HEADER([ifaddrs.h], ,[AC_MSG_ERROR( >X+ [*** ifaddrs.h missing - please install first or check config.log ***])]) >X+ >X+AC_CHECK_HEADERS([linux/if_packet.h net/if_dl.h]) >X+ >X+if test "x$ac_cv_header_linux_if_packet_h" = "xyes" ; then >X+ AC_DEFINE([HAVE_IF_PACKET], [1], >X+ [The Linux if_packet.h header found]) >X+elif test "x$ac_cv_header_net_if_dl_h" = "xyes" ; then >X+ AC_DEFINE([HAVE_IF_DL], [1], >X+ [The BSD if_dl.h header found]) >X+else >X+ AC_MSG_ERROR([*** sockaddr_* missing - please install first or check config.log ***]) >X+fi >X+ >X+AC_CHECK_HEADER(linux/ethtool.h, AC_DEFINE([HAVE_ETHTOOL], [1], [Linux ethernet headers found]), ) >X >X AC_OUTPUT([ >X Makefile >bc6a7efbd91b06038be08ef72820a073 >echo x - macchanger/files/patch-src_netinfo.c >sed 's/^X//' >macchanger/files/patch-src_netinfo.c << '6698a3f09c341f61778b29439b1b7d42' >X--- src/netinfo.c 2013-04-18 08:27:17.000000000 +0300 >X+++ src/netinfo.c 2014-10-17 17:11:31.316621145 +0300 >X@@ -23,14 +23,30 @@ >X * USA >X */ >X >X+#ifdef HAVE_CONFIG_H >X+# include <config.h> >X+#endif >X+ >X #include <stdio.h> >X #include <stdlib.h> >X #include <string.h> >X #include <unistd.h> >X #include <sys/ioctl.h> >X >X-#include <linux/ethtool.h> >X-#include <linux/sockios.h> >X+#include <ifaddrs.h> >X+#include <net/if.h> >X+#include <net/ethernet.h> >X+ >X+#if defined(HAVE_IF_PACKET) >X+# include <linux/if_packet.h> >X+#elif defined(HAVE_IF_DL) >X+# include <net/if_dl.h> >X+#endif >X+ >X+#if defined(HAVE_ETHTOOL) >X+# include <linux/ethtool.h> >X+# include <linux/sockios.h> >X+#endif >X >X #include "netinfo.h" >X >X@@ -49,7 +65,7 @@ >X >X strncpy (new->dev.ifr_name, device, sizeof(new->dev.ifr_name)); >X new->dev.ifr_name[sizeof(new->dev.ifr_name)-1] = '\0'; >X- if (ioctl(new->sock, SIOCGIFHWADDR, &new->dev) < 0) { >X+ if (if_nametoindex(device) == 0) { >X perror ("[ERROR] Set device name"); >X free(new); >X return NULL; >X@@ -66,29 +82,55 @@ >X free(net); >X } >X >X- >X mac_t * >X mc_net_info_get_mac (const net_info_t *net) >X { >X- int i; >X- mac_t *new = (mac_t *) malloc (sizeof(mac_t)); >X+ int i; >X+ mac_t *mac = (mac_t *) malloc (sizeof(mac_t)); >X+ u_char *lladr; >X >X- for (i=0; i<6; i++) { >X- new->byte[i] = net->dev.ifr_hwaddr.sa_data[i] & 0xFF; >X- } >X+ struct ifaddrs *ifap, *ifa; >X+ struct sockaddr_ll *sdl; >X >X- return new; >X-} >X+ if (getifaddrs(&ifap) == 0) { >X+ for (ifa = ifap; ifa; ifa = ifa->ifa_next) { >X+ >X+ sdl = (struct sockaddr_ll *) ifa->ifa_addr; >X+ >X+ if (strcmp(ifa->ifa_name, net->dev.ifr_name) != 0) >X+ continue; >X >X+ if (!sdl && sdl->sll_family != AF_PACKET) >X+ continue; >X+ >X+ lladr = (u_char *) LLADDR(sdl); >X+ for (i=0; i<6; i++) >X+ mac->byte[i] = lladr[i] & 0xFF; >X+ break; >X+ } >X+ freeifaddrs(ifap); >X+ } else >X+ perror("getifaddrs"); >X+ >X+ return mac; >X+} >X >X int >X mc_net_info_set_mac (net_info_t *net, const mac_t *mac) >X { >X int i; >X+#if defined(HAVE_ETHTOOL) >X+ if (ioctl(net->sock, SIOCGIFHWADDR, &net->dev) < 0) { >X+ perror ("[ERROR] Set ifreq structure"); >X+ return -1; >X+ } >X+#elif defined(HAVE_SOCKADDR_SA_LEN) >X+ net->dev.ifr_addr.sa_family = AF_PACKET; >X+ net->dev.ifr_addr.sa_len = ETHER_ADDR_LEN; >X+#endif >X >X- for (i=0; i<6; i++) { >X+ for (i=0; i<6; i++) >X net->dev.ifr_hwaddr.sa_data[i] = mac->byte[i]; >X- } >X >X if (ioctl(net->sock, SIOCSIFHWADDR, &net->dev) < 0) { >X perror ("[ERROR] Could not change MAC: interface up or insufficient permissions"); >X@@ -98,6 +140,7 @@ >X return 0; >X } >X >X+#if defined(HAVE_ETHTOOL) >X mac_t * >X mc_net_info_get_permanent_mac (const net_info_t *net) >X { >X@@ -126,3 +169,4 @@ >X free(epa); >X return newmac; >X } >X+#endif >6698a3f09c341f61778b29439b1b7d42 >echo x - macchanger/files/patch-src_main.c >sed 's/^X//' >macchanger/files/patch-src_main.c << '3805d61673e2a7a097c57875d5c38ba9' >X--- src/main.c 2014-01-01 11:23:39.000000000 +0200 >X+++ src/main.c 2014-10-17 12:15:02.254848839 +0300 >X@@ -40,9 +40,6 @@ >X #include "maclist.h" >X #include "netinfo.h" >X >X-#define EXIT_OK 0 >X-#define EXIT_ERROR 1 >X- >X static void >X print_help (void) >X { >X@@ -54,7 +51,9 @@ >X " -e, --ending Don't change the vendor bytes\n" >X " -a, --another Set random vendor MAC of the same kind\n" >X " -A Set random vendor MAC of any kind\n" >X+#if defined(HAVE_ETHTOOL) >X " -p, --permanent Reset to original, permanent hardware MAC\n" >X+#endif >X " -r, --random Set fully random MAC\n" >X " -l, --list[=keyword] Print known vendors\n" >X " -b, --bia Pretend to be a burned-in-address\n" >X@@ -116,7 +115,9 @@ >X char ending = 0; >X char another_any = 0; >X char another_same = 0; >X+#if defined(HAVE_ETHTOOL) >X char permanent = 0; >X+#endif >X char print_list = 0; >X char show = 0; >X char set_bia = 0; >X@@ -131,7 +132,9 @@ >X {"ending", no_argument, NULL, 'e'}, >X {"endding", no_argument, NULL, 'e'}, /* kept for backwards compatibility */ >X {"another", no_argument, NULL, 'a'}, >X+#if defined(HAVE_ETHTOOL) >X {"permanent", no_argument, NULL, 'p'}, >X+#endif >X {"show", no_argument, NULL, 's'}, >X {"another_any", no_argument, NULL, 'A'}, >X {"bia", no_argument, NULL, 'b'}, >X@@ -142,7 +145,9 @@ >X >X net_info_t *net; >X mac_t *mac; >X+#if defined(HAVE_ETHTOOL) >X mac_t *mac_permanent; >X+#endif >X mac_t *mac_faked; >X char *device_name; >X int val; >X@@ -158,7 +163,7 @@ >X "This is free software; see the source for copying conditions. There is NO\n" >X "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", >X VERSION); >X- exit (EXIT_OK); >X+ exit (EXIT_SUCCESS); >X break; >X case 'l': >X print_list = 1; >X@@ -182,9 +187,11 @@ >X case 'A': >X another_any = 1; >X break; >X+#if defined(HAVE_ETHTOOL) >X case 'p': >X permanent = 1; >X break; >X+#endif >X case 'm': >X set_mac = optarg; >X break; >X@@ -192,26 +199,26 @@ >X case '?': >X default: >X print_help(); >X- exit (EXIT_OK); >X+ exit (EXIT_SUCCESS); >X break; >X } >X } >X >X /* Read the MAC lists */ >X if (mc_maclist_init() < 0) { >X- exit (EXIT_ERROR); >X+ exit (EXIT_FAILURE); >X } >X >X /* Print list? */ >X if (print_list) { >X mc_maclist_print(search_word); >X- exit (EXIT_OK); >X+ exit (EXIT_SUCCESS); >X } >X >X /* Get device name argument */ >X if (optind >= argc) { >X print_usage(); >X- exit (EXIT_OK); >X+ exit (EXIT_SUCCESS); >X } >X device_name = argv[optind]; >X >X@@ -220,10 +227,12 @@ >X >X /* Read the MAC */ >X if ((net = mc_net_info_new(device_name)) == NULL) { >X- exit (EXIT_ERROR); >X+ exit (EXIT_FAILURE); >X } >X mac = mc_net_info_get_mac(net); >X+#if defined(HAVE_ETHTOOL) >X mac_permanent = mc_net_info_get_permanent_mac(net); >X+#endif >X >X /* --bia can only be used with --random */ >X if (set_bia && !random) { >X@@ -232,16 +241,18 @@ >X >X /* Print the current MAC info */ >X print_mac ("Current MAC: ", mac); >X+#if defined(HAVE_ETHTOOL) >X print_mac ("Permanent MAC: ", mac_permanent); >X+#endif >X >X /* Change the MAC */ >X mac_faked = mc_mac_dup (mac); >X >X if (show) { >X- exit (EXIT_OK); >X+ exit (EXIT_SUCCESS); >X } else if (set_mac) { >X if (mc_mac_read_string (mac_faked, set_mac) < 0) { >X- exit (EXIT_ERROR); >X+ exit (EXIT_FAILURE); >X } >X } else if (random) { >X mc_mac_random (mac_faked, 6, set_bia); >X@@ -254,10 +265,12 @@ >X } else if (another_any) { >X mc_maclist_set_random_vendor(mac_faked, mac_is_anykind); >X mc_mac_random (mac_faked, 3, 1); >X+#if defined(HAVE_ETHTOOL) >X } else if (permanent) { >X mac_faked = mc_mac_dup (mac_permanent); >X+#endif >X } else { >X- exit (EXIT_OK); /* default to show */ >X+ exit (EXIT_SUCCESS); /* default to show */ >X } >X >X /* Set the new MAC */ >X@@ -279,9 +292,11 @@ >X /* Memory free */ >X mc_mac_free (mac); >X mc_mac_free (mac_faked); >X+#if defined(HAVE_ETHTOOL) >X mc_mac_free (mac_permanent); >X+#endif >X mc_net_info_free (net); >X mc_maclist_free(); >X >X- return (ret == 0) ? EXIT_OK : EXIT_ERROR; >X+ return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE; >X } >3805d61673e2a7a097c57875d5c38ba9 >echo x - macchanger/Makefile >sed 's/^X//' >macchanger/Makefile << '3a74b2cc6a0f2b8b8b8e28da5443e260' >X# $FreeBSD$ >X >XPORTNAME= macchanger >XPORTVERSION= 1.7.0 >XCATEGORIES= net >X >XMAINTAINER= clutton@zoho.com >XCOMMENT= GNU MAC Changer >X >XLICENSE= GPLv3 >X >XUSE_GITHUB= true >XGH_ACCOUNT= alobbs >XGH_COMMIT= f4f66e1 >X >XGNU_CONFIGURE= yes >XUSE_AUTOTOOLS= aclocal autoconf automake autoheader >XAUTOMAKE_ARGS= --add-missing >X >XINFO= macchanger >X >XPLIST_FILES= bin/${PORTNAME} man/man1/${PORTNAME}.1.gz \ >X %%DATADIR%%/OUI.list %%DATADIR%%/wireless.list >XPLIST_DIRS= %%DATADIR%% >X >X.include <bsd.port.mk> >3a74b2cc6a0f2b8b8b8e28da5443e260 >echo x - macchanger/distinfo >sed 's/^X//' >macchanger/distinfo << '614a08e9cf0867f64ce5227faaa18894' >XSHA256 (macchanger-1.7.0.tar.gz) = ec916fa592c445c4c48d420ae0ad5adb942b0a6009d96394d0555fcb967965aa >XSIZE (macchanger-1.7.0.tar.gz) = 306369 >614a08e9cf0867f64ce5227faaa18894 >echo x - macchanger/pkg-descr >sed 's/^X//' >macchanger/pkg-descr << '23d5d0fdb10e0c2778a645d256385f23' >XGNU MAC Changer is an utility that makes the maniputation of MAC addresses of >Xnetwork interfaces easier. >X >XWWW: http://www.gnu.org/software/macchanger >23d5d0fdb10e0c2778a645d256385f23 >exit >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 187363
:
140687
|
146493
|
146544
|
146545
| 148455 |
148556
|
148653
|
148654