Re: Packet interception / Mangling
[EMAIL PROTECTED] wrote: Hi I wanted to know if there are any libraries similar to pcap to intercept packets/mangle packets. how about pcap? :-) There are also two other mechinisms.. "divert sockets" (man divert) which is used in conjuction with teh ipfw packet fileter and netgraph (man 4 netgraph, man ngctl, man ng_socket, man ng_ether) which can do a lot of interesting thins. What im trying to do specifically is like link compression, and I would then need to check if the packet is then compressed and decompress, and so forth and so on. I would like to avoid having to use a ipfw divert to a port, and specifically check all traffic to the box using a library function or some kind of hook into the kernel. The FreeBSD version I will be using is 4.9 or 4.11, and would like to know if there are any such routines available, and whether it could be a userland daemon, or if i am going to need to write a kernel loadable module? If anyone has any ideas or suggestions, or knows anything about this, it would be a great help. Regards /Cole ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: How to disable at-boot configuration of a network interface but permit manual use of rc.d?
nduja# grep ifconfig_ed1 /etc/rc.conf #ifconfig_ed1="DHCP" nduja# sh /etc/rc.d/dhclient start nduja# setenv ifconfig_ed1 DHCP nduja# sh /etc/rc.d/dhclient start Starting dhclient. ed1: flags=108843 mtu 1500 inet6 fe80::250:baff:fe7a:a9bd%ed1 prefixlen 64 scopeid 0x3 inet 37.0.203.130 netmask 0xff00 broadcast 37.0.203.255 ether 00:50:ba:7a:a9:bd media: Ethernet 10baseT/UTP status: active nduja# Regards, Dario -- Dario Freni ([EMAIL PROTECTED]) FreeSBIE developer (http://www.freesbie.org) GPG Public key at http://www.saturnero.net/saturnero.asc pgpZkgFf17ZuZ.pgp Description: PGP signature
Accurate/Fine-grained timing of latency in atheros drivers
Hey guys, In a current project, I need to find out exactly how long it takes to send a 802.11 packet and how much time is spent in the following stages: send time - time spent constructing message, including context switches and other delays and the time it takes to transfer the message to the network card. access time - delay which we experience waiting to access the transmitting channel. Normally this would include the RTS and CTS queuing signals, but for this application, I have to disable them. Is it possible that no time is spent waiting here, if I have disabled the whole CSMA scheme on the hardware level? propagation time - how long it takes to get to the receiver, once it has left our card receive time - how long it takes for the receiving network card to get the message and notify the host that it has something to read. Am I going to have to put in hardware interrupts to time these events or are such tools already available? -Sam ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
RE: How to disable at-boot configuration of a network interface but permit manual use of rc.d?
On Mon, 27 Jun 2005, Darren Pilgrim wrote: From: Niki Denev [mailto:[EMAIL PROTECTED] Darren Pilgrim wrote: There are some conditions to the task given by the subject: 1: The interface must be present at boot. 2: Use of /etc/rc.d scripts to start and stop the interface is desirable. The first condition poses no problem, just don't include the relevant ifconfig_ifn line in /etc/rc.conf and the interface won't be configured. But rc.d/dhclient and rc.d/netif won't work without an ifconfig line for the interface. Adding the ifconfig line and then listing every interface but the one I want configured in network_interfaces does prevent it from being configured at boot while having an ifconfig line in rc.conf, but if I try to use rc.d/netif to start the interface, rc.d/netif does nothing because it tests the interface against the contents of network_interfaces and cloned_interfaces, so the interface I left out will be excluded. Have I overlooked an option somewhere? What happens if you configure the interface in 'down' state, like : ifconfig_fxp0="inet 192.168.0.10 netmask 0xff00 down" Then rc.d/dhclient won't work. The "DHCP" keyword must be present in the ifconfig line in order for dhcpif to test true. A similar logic is in place for wpaif based on the "WPA" keyword. I am not sure it will help, but have you tried playing with /etc/start_if.DEVICE scripts? I do not know where they are documented, but you can configure a network device this way. I used it in the past to change the MAC address on a NIC at boot before the card was configured in rc.conf. Seán -- [EMAIL PROTECTED]___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
RE: How to disable at-boot configuration of a network interface but permit manual use of rc.d?
From: Niki Denev [mailto:[EMAIL PROTECTED] > Darren Pilgrim wrote: > > There are some conditions to the task given by the subject: > > > > 1: The interface must be present at boot. > > 2: Use of /etc/rc.d scripts to start and stop the interface > > is desirable. > > > > The first condition poses no problem, just don't include the > > relevant ifconfig_ifn line in /etc/rc.conf and the interface won't > > be configured. But rc.d/dhclient and rc.d/netif won't work without > > an ifconfig line for the interface. > > > > Adding the ifconfig line and then listing every interface but the > > one I want configured in network_interfaces does prevent it from > > being configured at boot while having an ifconfig line in rc.conf, > > but if I try to use rc.d/netif to start the interface, rc.d/netif > > does nothing because it tests the interface against the contents > > of network_interfaces and cloned_interfaces, so the interface I > > left out will be excluded. > > > > Have I overlooked an option somewhere? > > What happens if you configure the interface in 'down' state, like : > > ifconfig_fxp0="inet 192.168.0.10 netmask 0xff00 down" Then rc.d/dhclient won't work. The "DHCP" keyword must be present in the ifconfig line in order for dhcpif to test true. A similar logic is in place for wpaif based on the "WPA" keyword. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: How to disable at-boot configuration of a network interface but permit manual use of rc.d?
Darren Pilgrim wrote: There are some conditions to the task given by the subject: 1: The interface must be present at boot. 2: Use of /etc/rc.d scripts to start and stop the interface is desirable. The first condition poses no problem, just don't include the relevant ifconfig_ifn line in /etc/rc.conf and the interface won't be configured. But rc.d/dhclient and rc.d/netif won't work without an ifconfig line for the interface. Adding the ifconfig line and then listing every interface but the one I want configured in network_interfaces does prevent it from being configured at boot while having an ifconfig line in rc.conf, but if I try to use rc.d/netif to start the interface, rc.d/netif does nothing because it tests the interface against the contents of network_interfaces and cloned_interfaces, so the interface I left out will be excluded. Have I overlooked an option somewhere? Hi, What happens if you configure the interface in 'down' state, like : ifconfig_fxp0="inet 192.168.0.10 netmask 0xff00 down" P.S.: Just an idea, never tried it :) --niki ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: problem handling POSIX thread on FreeBSD
On Monday 27 June 2005 01:32 am, Pablo Mora wrote: > /* file: test.c */ > #include > #include > #include > #include > #include > > char buffer[512]; > pthread_mutex_t mutex, mutex2; > pthread_t hilo1, hilo2; > > void f1(void* ptr) > { > int i,n=10; > int valor=0; > char*p=(char*)ptr; > > for(i=0;i { > pthread_mutex_lock(&mutex); > sscanf(p,"%d",&valor); > printf("\thilo1: puntero contiene %d\n", valor); > valor=i*3; > sprintf(p, "%d",valor); > > pthread_mutex_unlock(&mutex2); > } > valor=(int)pthread_self(); > printf("finaliza hilo1 con id %d\n", valor); > pthread_exit(&valor); > } > void f2(void* ptr) > { > int i,n=10; > int valor=0; > char*p=(char*)ptr; > for(i=0;i { > pthread_mutex_lock(&mutex2); > sscanf(p,"%d",&valor); > printf("hilo2: puntero contiene %d\n", valor); > valor=i*2; > > sprintf(p, "%d",valor); > pthread_mutex_unlock(&mutex); > } > valor=(int)pthread_self(); > printf("finaliza hilo2 con id %d\n", valor); > pthread_exit(&valor); > } This code is nuts. You can't unlock a mutex that you don't own. You probably want to be using semaphores I think. However, even then that doesn't really make sense. Replace 'mutex2' with 'mutex' in the f1() and f2() functions and get rid of mutex2 and try it again. However, with that change, f1() is free to run to completion before f2() will start. If you want to enforce ping ponging, you need to use a condition variable to synchronize. Something like: pthread_cond_t condvar; f1() { ... pthread_mutex_lock(&mutex); for (i = 0; i < n; i++) { sscanf(...) printf(...) valor = i * 3; sprintf(...) pthread_cond_wait(&condvar, &mutex); } pthread_mutex_unlock(&mutex); valor = (int)pthread_self(); ... } and f2() is similar except s/3/2/. This will cause the threads to ping pong where one thread waits for the other to run after each cycle. You might also want to read up on how synchronization with multiple threads works. "Programming with POSIX Threads" is a decent book, and Tannebaum's "Modern Operating Systems" has a decent section on various synchronization primitives such as mutexes, semaphores, etc. Also, if you have thread specific questions, there is a freebsd-threads@ mailing list that is probably a better place to ask them on. > int main() > { > pthread_attr_t atributos; > //pthread_mutexattr_t mutexattr; - solaris > > memset(buffer, '\0', sizeof(buffer)); > /* > > if(pthread_mutexattr_setpshared(&mutexattr,PTHREAD_PROCESS_PRIVATE)!=0) > //solaris > { > perror("pthread_mutexattr_setpshared"); > exit(-12); > } > */ > > pthread_mutex_init(&mutex, NULL); //linux > pthread_mutex_init(&mutex2, NULL); //linux > > pthread_mutex_lock(&mutex2); / > > /*if(pthread_mutex_init(&mutex, &mutexattr)!=0) //solaris > { > perror("pthread_mutex_init"); > exit(-2); > }*/ > > if(pthread_attr_init(&atributos) < 0) > { > perror("pthread_attr_init"); > exit(-1); > } > if(pthread_attr_setscope(&atributos,PTHREAD_SCOPE_PROCESS) < 0) > { > perror("pthread_attr_setscope"); > exit(-2); > } > if(pthread_create (&hilo1, &atributos, (void*)&f1, (void*)buffer)<0) > { > perror("pthread_create hilo1"); > exit(-2); > } > if(pthread_create(&hilo2, &atributos, (void*)&f2, (void*)buffer)<0) > { > perror("pthread_create hilo2"); > exit(-2); > } > > > if(pthread_join(hilo2, NULL)<0) > { > perror("pthread_join hilo1 "); > exit(-3); > } > puts("fin hilo 2"); > /*if(pthread_join(hilo1, NULL)<0) > { > perror("pthread_join hilo2 "); > exit(-3); > }*/ > > > pthread_mutex_destroy(&mutex); > exit(0); > } > > output in solaris and linux: (gcc test.c -lpthread) > > hilo1: puntero contiene 0 >hilo2: puntero contiene 0 >hilo1: puntero contiene 0 >hilo2: puntero contiene 3 >hilo1: puntero contiene 2 >hilo2: puntero contiene 6 >hilo1: puntero contiene 4 > hilo2: puntero contiene 9 > hilo1: puntero contiene 6 > hilo2: puntero contiene 12 > hilo1: puntero contiene 8 > hilo2: puntero contiene 15 > hilo1: puntero contiene 10 > hilo2: puntero contiene 18 > hilo1: puntero contiene 12 > hilo2: pu
How to disable at-boot configuration of a network interface but permit manual use of rc.d?
There are some conditions to the task given by the subject: 1: The interface must be present at boot. 2: Use of /etc/rc.d scripts to start and stop the interface is desirable. The first condition poses no problem, just don't include the relevant ifconfig_ifn line in /etc/rc.conf and the interface won't be configured. But rc.d/dhclient and rc.d/netif won't work without an ifconfig line for the interface. Adding the ifconfig line and then listing every interface but the one I want configured in network_interfaces does prevent it from being configured at boot while having an ifconfig line in rc.conf, but if I try to use rc.d/netif to start the interface, rc.d/netif does nothing because it tests the interface against the contents of network_interfaces and cloned_interfaces, so the interface I left out will be excluded. Have I overlooked an option somewhere? ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
RE: Wireless CDMA cards for Verizon
Hi Don't know why attachment couldn't go through. So I put it in body: Append to FILE: src/sys/dev/usb/usbdevs vendor AIRPRIME 0x0f3d AirPrime, Incorporated vendor NOVATEL 0x1410 Novatel /* AirPrime products */ product AIRPRIME PC5220 0x0112 CDMA Wireless PC Card /* Novatel products */ product NOVATEL PC620 0x1110 CDMA Wireless PC Card Append to FILE: /etc/usbd.conf device "Verizon wireless Airprime" devname "ucom0" vendor 0x0f3d product 0x0112 #attach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all;/usr/sbin/ppp -auto 3g" attach "/usr/sbin/ppp -auto 3g" detach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all" device "Verizon wireless Novatel" devname "ucom0" vendor 0x1410 product 0x1110 #attach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all;/usr/sbin/ppp -auto 3g" attach "/usr/sbin/ppp -auto 3g" detach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all" Append to FILE: /etc/ppp/pppd.conf 3g: set device /dev/ucom0 set speed 460800 # SPEED IS GOOD! set phone \#777 # 1 refers to CID # The chat script is a little bit different set dial "ABORT BUSY ABORT NO\sCARRIER TIMEOUT 5 \ \"\" AT OK-AT-OK \ AT OK-AT-OK \\dATD\\T TIMEOUT 40 CONNECT" enable dns set authname wap set authkey wap accept PAP set login add default HISADDR set ifaddr 10.0.0.1/0 10.0.0.2/0 0.0.0.0 0.0.0.0 disable ipv6cp disable mppe set reconnect 3 15 new FILE: src/sys/dev/usb/uveriz.c,v #include __FBSDID("$FreeBSD: src/sys/dev/usb/uveriz.c,v 1.1 2005/06/08 12:44:09 akurilov Exp $"); #include "opt_uvscom.h" #include #include #include #include #include #include #include #include #include #if defined(__FreeBSD__) #include #include #if __FreeBSD_version >= 500014 #include #else #include #endif #else #include #include #endif #include #include #include #include #include #include #include #include #include "usbdevs.h" #include #include /* */ #define uveriz_DEBUG 1 #ifdef uveriz_DEBUG #define DPRINTF(x) if (uverizdebug) printf x #define DPRINTFN(n,x) if (uverizdebug>(n)) printf x int uverizdebug = 0; #else #define DPRINTF(x) #define DPRINTFN(n,x) #endif struct uveriz_softc { struct ucom_softc sc_ucom; u_int16_t sc_flags; }; #define UVERIZ_CONFIG_INDEX 0 #define UVERIZ_IFACE_INDEX 0 #define UVERIZ_MODVER1 #define UVERIZ_BUFSIZE 1024 static const struct usb_devno uveriz_devs[] = { { USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220 }, { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_PC620 }, }; #define uveriz_lookup(v, p) usb_lookup(uveriz_devs, v, p) Static void uveriz_close(void *, int); struct ucom_callback uveriz_callback = { NULL, NULL, NULL, NULL, NULL, uveriz_close, NULL, NULL, }; /*USB_DECLARE_DRIVER(uveriz);*/ Static device_probe_t uveriz_match; Static device_attach_t uveriz_attach; Static device_detach_t uveriz_detach; Static device_method_t uveriz_methods[] = { /* Device interface */ DEVMETHOD(device_probe, uveriz_match), DEVMETHOD(device_attach, uveriz_attach), DEVMETHOD(device_detach, uveriz_detach), { 0, 0 } }; Static driver_t uveriz_driver = { "ucom", uveriz_methods, sizeof (struct uveriz_softc) }; DRIVER_MODULE(uveriz, uhub, uveriz_driver, ucom_devclass, usbd_driver_load, 0); MODULE_DEPEND(uveriz, usb, 1, 1, 1); MODULE_DEPEND(uveriz, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); MODULE_VERSION(uveriz, UVERIZ_MODVER); USB_MATCH(uveriz) { USB_MATCH_START(uveriz, uaa); if (uaa->iface != NULL) return (UMATCH_NONE); DPRINTFN(20,("uveriz: vendor=0x%x, product=0x%x\n", uaa->vendor, uaa->product)); return (uveriz_lookup(uaa->vendor, uaa->product) != NULL ? UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } USB_ATTACH(uveriz) { USB_ATTACH_START(uveriz, sc, uaa); usbd_device_handle dev = uaa->device; usbd_interface_handle iface; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; char *devinfo; const char *devname; int i; usbd_status err; struct ucom_softc *ucom; devinfo = malloc(1024, M_USBDEV, M_WAITOK); ucom = &sc->sc_ucom; bzero(sc, sizeof (struct uveriz_softc)); usbd_devinfo(dev, 0, devinfo); /*USB_ATTACH_SETUP;*/ ucom->sc_dev = self; device_set_desc_copy(self, devinfo); ucom->sc_udev = dev; ucom->
Packet interception / Mangling
Hi I wanted to know if there are any libraries similar to pcap to intercept packets/mangle packets. What im trying to do specifically is like link compression, and I would then need to check if the packet is then compressed and decompress, and so forth and so on. I would like to avoid having to use a ipfw divert to a port, and specifically check all traffic to the box using a library function or some kind of hook into the kernel. The FreeBSD version I will be using is 4.9 or 4.11, and would like to know if there are any such routines available, and whether it could be a userland daemon, or if i am going to need to write a kernel loadable module? If anyone has any ideas or suggestions, or knows anything about this, it would be a great help. Regards /Cole ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
IPv6 Extension Headers
Hello All, I am working on IPv6 Extension Headers Implementation. I am confused with freeBSD implementation and RFC2460 specification for Destination Options. My interpretation from RFC2460 is that, If a packet consists of hop-by-hop and destination extension headers, destination header should be inserted inside AH. i.e., hop + AH + dst. But freeBSD implementation is the other way, i.e., hop + dst + AH. which is correct way of implementation according to RFC2460? Please let me know, if my interpretation is wrong. Any help will be appreciated greatly. Thanks, Srinivas. -- Srinivas Goud "Everything is Nicer when shared with a Friend" ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: GmailFS
On Mon, 27 Jun 2005, Jeremie Le Hen wrote: hello guys can not the FUSE http://fuse.sourceforge.net ported to freebsd ? it would be nice to test the gmail fs on freebsd http://richard.jones.name/google-hacks/gmail-filesystem/gmail-filesystem.html AFAIK, this is not available with FreeBSD. There is no user level filesystem support. However, NetBSD announced [1] that one of their project for Google Summer of Code is to implement userspace file system hooks. This may be ported on FreeBSD one day. Arla's XFS code actually does quite a good job of providing a userlevel file system framework on FreeBSD, and the Coda kernel module also lets you implement userlevel file systems. I have a slight preference for the Arla XFS implementation as it's more general-purpose. I've previously used Arla's framework to write part of a user level tertiary file system implementation. Robert N M Watson ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: GmailFS
Hi Julian, Hi Maslan, > is not the portalfs an implementation of a user space filesystem? yes indeed, I never used it and this is not a very familiar subject on these mailing lists. Sorry for giving bad information. Regards, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org > ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"