vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

commit 0ce207018eb7537dda4e246cbe26c682474080b2
parent 2557b50f6d2ca591dd23961a3a9567f02bef76b8
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date:   Fri,  4 Jun 2010 19:31:02 +0200

use the macaddr option

Diffstat:
src/9vx/etherve.c | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/9vx/etherve.c b/src/9vx/etherve.c @@ -50,15 +50,19 @@ eafrom(char *ma) static pcap_t * setup(void) { - char *filter = "ether dst 00:48:01:23:45:67"; /* XXX */ - if(macaddr) - *filter = sprintf("ether dst %s", macaddr); /* XXX */ + char filter[30] = "ether dst 00:48:01:23:45:67"; char errbuf[PCAP_ERRBUF_SIZE]; pcap_t *pd; struct bpf_program prog; bpf_u_int32 net; bpf_u_int32 mask; + if(macaddr) + if(strlen(macaddr)>17) + panic("wrong mac address"); + else if(sprintf(filter, "ether dst %s", macaddr) == -1) + panic("cannot create pcap filter"); + if (!netdev && (netdev = pcap_lookupdev(errbuf)) == nil) panic("cannot find network device: %s", errbuf);