functions and data for multiple virtual network devices - vx32 - Local 9vx git repository for patches.
       
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 7792c92a37520a1624fcbc3c715ecc92a8f8859f
 (DIR) parent aff39c5e39f41bf6e06f9674de4741e40212742a
 (HTM) Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
       Date:   Tue, 15 Jun 2010 19:08:25 +0200
       
       functions and data for multiple virtual network devices
       
       Diffstat:
         src/9vx/vether.c                    |      34 +++++++++++++++++++++++++++++++
         src/9vx/vether.h                    |      10 ++++++++++
       
       2 files changed, 44 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/src/9vx/vether.c b/src/9vx/vether.c
       @@ -5,6 +5,9 @@
        #include "fns.h"
        #include "error.h"
        #include "ip/ip.h"
       +#include "netif.h"
       +#include "etherif.h"
       +#include "vether.h"
        #include "sd.h"
        
        extern int nettap;
       @@ -27,6 +30,37 @@ extern void espinit(Fs*);
        extern SDifc sdloopifc;
        extern SDifc sdaoeifc;
        
       +void
       +setea(char *macaddr)
       +{
       +        int i;
       +        char **nc = &macaddr;
       +
       +        if(nve == 0)
       +                return;
       +        for(i = 0; i < Eaddrlen; i++){
       +                ve[nve-1].ea[i] = (uchar)strtoul(macaddr, nc, 16);
       +                macaddr = *nc+1;
       +        }
       +}
       +
       +void
       +addve(char *dev, int tap)
       +{
       +        int i;
       +
       +        static uchar ea[Eaddrlen] = {0x00, 0x00, 0x09, 0x00, 0x00, 0x00};
       +
       +        if(nve == MaxEther)
       +                panic("too many virtual ether cards");
       +        ve[nve].dev = dev;
       +        ve[nve].tap = tap;
       +        /* This ea could conflict with one given by the user */
       +        memcpy(ve[nve].ea, ea, Eaddrlen);
       +        ea[5]++;
       +        nve++;
       +}
       +
        void links(void) {
                ethermediumlink();
                loopbackmediumlink();
 (DIR) diff --git a/src/9vx/vether.h b/src/9vx/vether.h
       @@ -0,0 +1,10 @@
       +ttypedef struct Vether Vether;
       +struct Vether
       +{
       +        int        tap;
       +        char        *dev;
       +        uchar ea[Eaddrlen];
       +};
       +
       +static Vether ve[MaxEther+1];
       +static int nve = 0;