[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mz/0.39-1 FTBFS on kfreebsd


could someone please help me with the FTBFS of mz/0.39-1 on kfreebsd?

The FTBFS can be fixed by attached patch.
It might bring runtimes problems, though.

At least some examples works, like sending garbage to my ethernet card (re0)
mz re0 -c 1000 "ff:ff:ff:ff:ff:ff ff:ff:ff:ff:ff:ff cc:dd 00:00:00:ca:fe:ba:be"

As the previous version builded fine, I suspect problem is due to
"reinventing wheel" (from NEWS):

  If you execute Mausezahn traditionally, specifying all packet parameters as
  arguments on the LINUX/UN*X shell, then MOPS is NOT used (libnet instead).
  MOPS on the other hand does not need libnet anymore but creates all PDUs
  completely by itself.

I expect that missing bits can be stealth from libnet.

--- mz-0.39.orig/src/lookupdev.c
+++ mz-0.39/src/lookupdev.c
@@ -22,7 +22,9 @@
 #include "mz.h"
 #include "mops.h"
+#ifdef __linux__
 #include <netpacket/packet.h>
 #include <netinet/ether.h>
@@ -154,12 +156,12 @@ int lookupdev()
 // Determines ip and mac address of specified interface 'ifname'
 // Caller must provide an unsigned char ip[4], mac[6]
 int get_if_addr (char *ifname, u_int8_t *ip, u_int8_t *mac)
+#ifdef __linux__
    int fd, i;
    struct ifreq ifr;
    struct sockaddr_in saddr;
@@ -183,7 +185,9 @@ int get_if_addr (char *ifname, u_int8_t
    ip[0]=*x; ip[1]=*(x+1); ip[2]=*(x+2); ip[3]=*(x+3);
+#warning get_if_addr unimplemented
  return 0;
@@ -202,6 +206,7 @@ int get_if_addr (char *ifname, u_int8_t
 int get_dev_params (char *name) 
+#ifdef __linux__
 	FILE *fd;
 	char f[10][16], line[256];
@@ -351,6 +356,9 @@ int get_dev_params (char *name)
 	device_list[devind].index = index;
 	device_list[devind].mtu = mtu;
+#warning get_dev_params unimplemented
 	return 0;
--- mz-0.39.orig/src/cli.c
+++ mz-0.39/src/cli.c
@@ -500,6 +500,7 @@ int cli()
    s = socket(AF_INET, SOCK_STREAM, 0);
    setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+#ifdef __linux__
    // Should we bind the CLI session to a specific interface?
    // TODO: This does nothing !?
    for (i=0; i<device_list_entries; i++) {
@@ -508,7 +509,7 @@ int cli()
 		   break; // can only be one interface
    // Listen on port mz_port (default: 25542, towel day)
    memset(&servaddr, 0, sizeof(servaddr));

Reply to: