]> git.ozlabs.org Git - ppp.git/blob - sunos4/if_ppp_vdcmd.c
sifdefaultroute now gets both local and remote addresses;
[ppp.git] / sunos4 / if_ppp_vdcmd.c
1 #include <sys/types.h>
2 #include <sys/errno.h>
3 #include <sys/conf.h>
4 #include <sun/vddrv.h>
5
6 extern struct streamtab if_pppinfo;
7
8 static struct vdldrv vd = {
9     VDMAGIC_USER,
10     "if_ppp"
11 };
12
13 static int fmodsw_index = -1;
14
15 int
16 if_ppp_vdcmd(fun, vdp, vdi, vds)
17     unsigned int fun;
18     struct vddrv *vdp;
19     addr_t vdi;
20     struct vdstat *vds;
21 {
22     int n, error;
23
24     switch (fun) {
25     case VDLOAD:
26         vdp->vdd_vdtab = (struct vdlinkage *) &vd;
27         if (fmodsw_index >= 0)
28             return EBUSY;
29         for (n = 0; n < fmodcnt; ++n)
30             if (fmodsw[n].f_str == 0)
31                 break;
32         if (n >= fmodcnt)
33             return ENODEV;
34         strncpy(fmodsw[n].f_name, vd.Drv_name, FMNAMESZ+1);
35         fmodsw[n].f_str = &if_pppinfo;
36         fmodsw_index = n;
37         break;
38
39     case VDUNLOAD:
40         if (fmodsw_index <= 0)
41             return EINVAL;
42         error = if_ppp_unload();
43         if (error != 0)
44             return error;
45         fmodsw[fmodsw_index].f_name[0] = 0;
46         fmodsw[fmodsw_index].f_str = 0;
47         fmodsw_index = -1;
48         break;
49
50     case VDSTAT:
51         break;
52
53     default:
54         return EIO;
55     }
56     return 0;
57 }