[madwimax] madwimax-0.1.1 patch for FreeBSD 8 (very buggy)

Alexander Samarin sasha.devel at gmail.com
Thu Nov 12 20:08:04 UTC 2009


HOWTO:

yume$ fetch "ftp://ftp.enikasoft.ru/pub/madwimax-freebsd8.patch"
yume$ fetch "http://madwimax.googlecode.com/files/madwimax-0.1.1.tar.gz"
yume$ tar xf madwimax-0.1.1.tar.gz

yume$ cd madwimax-0.1.1
yume$ export libusb1_CFLAGS="-I/usr/include"
yume$ export libusb1_LIBS="-L/usr/lib -lusb"
yume$ ./configure --without-man-pages
yume$ echo '#define MADWIMAX_VERSION_MACRO "madwimax-0.1.1-freebsd"' > \
        include/madwimax_version.h
yume$ cd src
yume$ patch < ../../madwimax-freebsd8.patch
yume$ make

yume$ su
yume# kldload if_tap
yume# ./madwimax
...
Allocated tap interface: tap0
...

On other console:

yume$ su
yume# dhclient tap0
yume# cat /var/db/dhclient.leases.tap
...
  option routers XXX.XXX.XXX.XXX;
  option domain-name-servers YYY.YYY.YYY.YYY;
...
yume# route delete default
yume# route add default XXX.XXX.XXX.XXX
yume# echo "nameserver YYY.YYY.YYY.YYY" > /etc/resolv.conf



Tested on FreeBSD 8.0-RC2 i386; modem Samsung SWC-U200.
Usually works fine (ping normal - less than 1% packet loss; http ok)
Sometimes crashes in libusb:

yume# ./madwimax
...
Allocated tap interface: tap0
zsh: segmentation fault (core dumped)  ./madwimax
yume# gdb ./madwimax madwimax.core
GNU gdb 6.1.1 [FreeBSD]
...
Core was generated by `madwimax'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libthr.so.3...done.
Loaded symbols for /lib/libthr.so.3
Reading symbols from /usr/lib/libusb.so.2...done.
Loaded symbols for /usr/lib/libusb.so.2
Reading symbols from /lib/libc.so.7...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  libusb10_submit_transfer_sub (pdev=0x28209480, endpoint=4 '\004') at
libusb10.c:1116
1116 if (sxfer->rem_len)
[New Thread 28201140 (LWP 100077)]
(gdb) bt
#0  libusb10_submit_transfer_sub (pdev=0x28209480, endpoint=4 '\004') at
libusb10.c:1116
#1  0x280acf23 in libusb_cancel_transfer (uxfer=0x282250c8) at
libusb10.c:1297
#2  0x280ac615 in libusb10_do_transfer (devh=0x28209480,
endpoint=Variable "endpoint" is not available.
) at libusb10_io.c:509
#3  0x280ac757 in libusb_bulk_transfer (devh=0x28209480,
endpoint=Variable "endpoint" is not available.
) at libusb10_io.c:552
#4  0x08049874 in set_data (data=0xbfbfab80 "WC\024", size=26) at
wimax.c:224
#5  0x0804a914 in main (argc=1, argv=0x280ad160) at wimax.c:652
(gdb) print *pxfer0 
$1 = {pdev = 0x28209480, callback = 0x280ad160
<libusb10_bulk_intr_proxy>, priv_sc0 = 0x28209480,
  priv_sc1 = 0x0, ppBuffer = 0x28226094, pLength = 0x28226090,
maxTotalLength = 16384,
  maxFrames = 1, nFrames = 1, aFrames = 1, timeout = 0, timeComplete =
0, trIndex = 16,
  maxPacketLen = 512, flags = 0 '\0', status = 1 '\001', is_opened = 1
'\001',
  is_pending = 1 '\001', is_cancel = 1 '\001', is_draining = 0 '\0',
is_restart = 0 '\0'}
(gdb) print *pxfer1
$2 = {pdev = 0x28209480, callback = 0x280b0380 <dummy_callback>,
priv_sc0 = 0x0,
  priv_sc1 = 0x0, ppBuffer = 0x0, pLength = 0x0, maxTotalLength = 0,
  maxFrames = 0, nFrames = 0, aFrames = 0, timeout = 0, timeComplete =
0, trIndex = 17,
  maxPacketLen = 0, flags = 0 '\0', status = 0 '\0', is_opened = 0 '\0',
  is_pending = 0 '\0', is_cancel = 0 '\0', is_draining = 0 '\0',
is_restart = 0 '\0'}
(gdb) print *sxfer 
Variable "sxfer" is not available.

Near libusb10.c:1116:
1115 sxfer = libusb20_tr_get_priv_sc1(pxfer0);
1116 if (sxfer->rem_len)

Near libusb20.c:258:
257 void   *
258 libusb20_tr_get_priv_sc1(struct libusb20_transfer *xfer)
259 {
260 return (xfer->priv_sc1);
261 }

Because of pxfer0->priv_sc1 is NULL from core dump, I think that it is
a libusb implementation bug.



PS:
Also I've commented this call at wimax.c:847:

847 //libusb_cancel_transfer(req_transfer);

because of segmentation fault when program going to terminate.
(this is inside exit_release_resources() function)


--
Best regards,  Alexander Samarin
    mailto:sasha at enikasoft.ru
    https://www.fsora.ru (waits for FreeBSD 8.0-RELEASE)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: madwimax-freebsd8.patch
Type: text/x-patch
Size: 4657 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-usb/attachments/20091112/8b537071/madwimax-freebsd8.bin


More information about the freebsd-usb mailing list