diff options
Diffstat (limited to 'net/wmnd/files/patch-src::drivers.c')
-rw-r--r-- | net/wmnd/files/patch-src::drivers.c | 135 |
1 files changed, 17 insertions, 118 deletions
diff --git a/net/wmnd/files/patch-src::drivers.c b/net/wmnd/files/patch-src::drivers.c index e2bf6e9155ec..203181e37f3e 100644 --- a/net/wmnd/files/patch-src::drivers.c +++ b/net/wmnd/files/patch-src::drivers.c @@ -1,120 +1,19 @@ ---- src/drivers.c.orig Tue May 22 11:11:25 2001 -+++ src/drivers.c Thu Nov 29 16:29:44 2001 -@@ -17,6 +17,117 @@ - * *_term: deallocate name, eventually drvdata and close fds - */ +--- src/drivers.c.orig Sat May 18 11:48:47 2002 ++++ src/drivers.c Sat May 18 11:50:28 2002 +@@ -554,7 +554,6 @@ + if(!devname || (devname && !strcmp(devname, tempndata.ifmd_name))) { + ndev = malloc(sizeof(struct Devices)); + ndev->devstart = 0; +- ndev->if_index = i; + ndev->name = strdup(tempndata.ifmd_name); + ndata = malloc(sizeof(struct ifmibdata)); + bcopy (&tempndata, ndata, sizeof(struct ifmibdata)); +@@ -596,7 +595,7 @@ + datamib[4] = 1; /* fill in later */ + datamib[5] = IFDATA_GENERAL; -+#ifdef USE_FREEBSD_SYSCTL -+ -+/* functions prototypes */ -+int freebsd_dev_list(const char *devname, struct Devices *list) { -+ char *devn; -+ struct Devices *ndev; -+ int mib[5], len; -+ int i; -+ struct ifmibdata ifmd; -+ -+ mib[0]=CTL_NET; -+ mib[1]=PF_LINK; -+ mib[2]=NETLINK_GENERIC; -+ mib[3]=IFMIB_SYSTEM; -+ mib[4]=IFMIB_IFCOUNT; -+ -+ len=sizeof(int); -+ -+ if (sysctl(mib, 5, &freebsd_interface_count, &len ,NULL, 0)==-1) {perror("systcl failed");exit(-1);} -+ printf("freebsd_interface_count: %d\n",freebsd_interface_count); -+ -+ printf("devname: %s\n", devname); -+ if (devname != NULL) { -+ // fill in the Devices structure -+ ndev=malloc(sizeof(struct Devices)); -+ list->next=ndev; -+ // name of device -+ devn=strdup(devname); -+ ndev->name=devn; -+ // next Devices field used to create the chain -+ ndev->next=NULL; -+ // internale driver data -+ ndev->drvdata=NULL; -+ // driver number -+ ndev->drvnum=0; -+ // status indicator (0 online, 1 offline) -+ ndev->online=0; -+ // device activity start -+ ndev->devstart=time(NULL); -+ // end of initialization -+ printf("freebsd_dev_list finished ok!!!\n"); -+ return 1; -+ } -+ else { // we don't have a specific interface to monitor, so we must first retrieve the name of all available interfaces -+printf("any interface defined!\n"); -+ -+ len=sizeof(ifmd); -+ -+ for(i=1;i<=freebsd_interface_count;i++) { -+ -+ -+ if (get_ifmib_general(i, &ifmd)==-1) {perror("sysctl2");exit(-1);} -+ -+ // fill in the Devices structure -+ ndev=malloc(sizeof(struct Devices)); -+ list->next=ndev; -+ // name of device -+ devn=strdup(ifmd.ifmd_name); -+ ndev->name=devn; -+ // next Devices field used to create the chain -+ ndev->next=NULL; -+ // internale driver data -+ ndev->drvdata=NULL; -+ // driver number -+ ndev->drvnum=0; -+ // status indicator (0 online, 1 offline) -+ ndev->online=0; -+ // device activity start -+ ndev->devstart=time(NULL); -+ //update the list pointer -+ list=ndev; -+ // end of initialization -+ -+} -+ -+ return 1; -+ } -+} -+ -+int freebsd_dev_init(struct Devices *dev) { -+ printf("nothing to do here!\n"); -+ return 0; -+} -+ -+int freebsd_dev_get(struct Devices *dev, unsigned long *ip, unsigned long *op, unsigned long *ib, unsigned long *ob) { -+ struct ifmibdata ifmd; -+ int i; -+for(i=1;i<=freebsd_interface_count;i++) { -+ if(get_ifmib_general(i, &ifmd)==-1) {perror("systcl3");exit(-1);} -+ //printf("comparing devname: %s with ifmdname: %s\n",dev->name, ifmd.ifmd_name); -+ if(strcmp(dev->name,ifmd.ifmd_name)==0) { -+ //printf("interface name: %s\n",ifmd.ifmd_name); -+ //printf("ipacktes: %ld opackets: %ld\n",ifmd.ifmd_data.ifi_ipackets,ifmd.ifmd_data.ifi_opackets); -+ //printf("ibytes: %ld obytes: %ld\n",ifmd.ifmd_data.ifi_ibytes,ifmd.ifmd_data.ifi_obytes); -+ //printf("\n"); -+ *ip=ifmd.ifmd_data.ifi_ipackets; *op=ifmd.ifmd_data.ifi_opackets; -+ *ib=ifmd.ifmd_data.ifi_ibytes; *ob=ifmd.ifmd_data.ifi_obytes; -+ return 0; -+ } -+} printf("interface %s not found!\n",dev->name); exit(-1); -+ -+ return 0; -+} -+ -+void freebsd_dev_term(struct Devices *dev) { -+ printf("freebsd_dev_term: %s\n",dev->name); -+ //free(dev); -+} -+ -+#endif /*USE_FREESD_SYSCTL*/ -+ - #ifdef USE_SOLARIS_FPPPD +- datamib[4] = dev->if_index; ++ datamib[4] = IFMIB_IFCOUNT; + + len = sizeof(struct ifmibdata); - /* strioclt is a support function, not previously declared */ |