Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] network stability test
HI
Is there anyone who has working network and passes
this test (no crash during 20 min of running of the
script?)
----------- test ------------
#!/bin/sh
dvbnetsetup -p 123
ifconfig dvb0_0 inet 1.2.3.4
IFACE=dvb0_0
while true
do
ifconfig ${IFACE} -promisc
ifconfig ${IFACE} promisc
done
-----------------------------
Emard
/*
* (C) Andrei Darashenka. <adorosh@users.sourceforge.net>
* based on ...
* test_switch.c - Test program for new API
*
* Copyright (C) 2001 Ralph Metzler <ralph@convergence.de>
* & Marcus Metzler <marcus@convergence.de>
for convergence integrated media GmbH
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include "dvb/net.h"
int main(int argc,char **argv)
{
struct dvb_net_if net1={0x200,0};
int fd_net,ret, del = -1;
int adapter = 0;
int pid = -1;
char devname[100];
if(argc < 2)
{
printf("usage: %s [-a <adapter>] [-p <pid>] [-d <interface number>]\n",
argv[0]);
return;
}
for(argv++, argc--; argc > 0; argc--, argv++)
{
if(argv[0][0] == '-')
switch(argv[0][1])
{
case 'd':
if(argc > 0)
{
del = atoi(*(++argv));
argc--;
}
break;
case 'a':
if(argc > 0)
{
adapter = atoi(argv[1]);
argc--;
argv++;
}
break;
case 'p':
if(argc > 0)
{
pid = atoi(argv[1]);
argc--;
argv++;
}
break;
}
}
// printf("ADAPTER=%d PID=%d DELETE=%d\n", adapter, pid, del);
net1.pid = pid;
strcpy(devname, "/dev/dvb/adapter0/net0");
if(adapter >= 0)
sprintf(devname, "/dev/dvb/adapter%d/net0", adapter);
else
{
printf("No such adapter\n");
return 1;
}
fd_net = open(devname, O_RDWR|O_NONBLOCK);
if(fd_net <0)
{
printf("error:%m \ncheck your network device file present as '%s' \nand it have right permissions and driver successfully loaded and found DVB card\n\n",
devname);
return 2;
};
if(del >= 0)
{
ret=ioctl(fd_net, NET_REMOVE_IF, del);
printf("removing interface dvb%d_%d ", adapter, del);
if(ret)
printf("failed\n");
else
printf("done\n");
}
if(adapter >= 0 && pid >= 0)
{
ret=ioctl(fd_net,NET_ADD_IF, &net1);
if(ret)
{
printf("cannot add interface dvb%d_* for pid %d using %s",
adapter, net1.pid, devname);
}
else
printf("device dvb%d_* added with pid %d successfully\n",
adapter, net1.pid);
}
close(fd_net);
}
Home |
Main Index |
Thread Index