The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/pc/ethersink.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * An ethernet /dev/null.
    3  * Useful as a bridging target with ethernet-based VPN.
    4  */
    5 #include "u.h"
    6 #include "../port/lib.h"
    7 #include "mem.h"
    8 #include "dat.h"
    9 #include "fns.h"
   10 #include "io.h"
   11 #include "../port/error.h"
   12 #include "../port/netif.h"
   13 #include "etherif.h"
   14 
   15 static long
   16 ctl(Ether *ether, void *buf, long n)
   17 {
   18         uchar ea[Eaddrlen];
   19         Cmdbuf *cb;
   20 
   21         cb = parsecmd(buf, n);
   22         if(cb->nf >= 2
   23         && strcmp(cb->f[0], "ea")==0
   24         && parseether(ea, cb->f[1]) == 0){
   25                 free(cb);
   26                 memmove(ether->ea, ea, Eaddrlen);
   27                 memmove(ether->addr, ether->ea, Eaddrlen);
   28                 return 0;
   29         }
   30         free(cb);
   31         error(Ebadctl);
   32         return -1;      /* not reached */
   33 }
   34 
   35 static void
   36 nop(Ether*)
   37 {
   38 }
   39 
   40 static int
   41 reset(Ether* ether)
   42 {
   43         uchar ea[Eaddrlen];
   44 
   45         if(ether->type==nil)
   46                 return -1;
   47         memset(ea, 0, sizeof ea);
   48         ether->mbps = 1000;
   49         ether->attach = nop;
   50         ether->transmit = nop;
   51         ether->irq = -1;
   52         ether->interrupt = nil;
   53         ether->ifstat = nil;
   54         ether->ctl = ctl;
   55         ether->promiscuous = nil;
   56         ether->multicast = nil;
   57         ether->arg = ether;
   58         return 0;
   59 }
   60 
   61 void
   62 ethersinklink(void)
   63 {
   64         addethercard("sink", reset);
   65 }

Cache object: 2c3ca2b055254e4117f379d0024e8bef


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.