Fix includes for kernel 2.2.x complilation.
This commit is contained in:
parent
5aa455be3f
commit
4828d6cb6d
103
eql_enslave.c
103
eql_enslave.c
@ -11,10 +11,18 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <linux/sockios.h>
|
||||
#include <linux/if.h>
|
||||
|
||||
#include "/usr/src/linux/drivers/net/eql.h"
|
||||
#include "/usr/src/linux/include/linux/if_eql.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void check_running(char *device_name);
|
||||
|
||||
@ -23,86 +31,87 @@ int s;
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
slaving_request_t slaving_request;
|
||||
char master_name[16];
|
||||
int slave_mtu;
|
||||
int master_mtu;
|
||||
struct ifreq ifr;
|
||||
slaving_request_t slaving_request;
|
||||
char master_name[16];
|
||||
int slave_mtu;
|
||||
int master_mtu;
|
||||
|
||||
if (argc != 4)
|
||||
if (argc != 4)
|
||||
{
|
||||
fprintf (stderr, "usage: %s <master> <slave> <priority>\n", argv[0]);
|
||||
exit (1);
|
||||
fprintf (stderr, "usage: %s <master> <slave> <priority>\n", argv[0]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
strcpy (master_name, argv[1]);
|
||||
strcpy (slaving_request.slave_name, argv[2]);
|
||||
slaving_request.priority = atol (argv[3]);
|
||||
strcpy (master_name, argv[1]);
|
||||
strcpy (slaving_request.slave_name, argv[2]);
|
||||
slaving_request.priority = atol (argv[3]);
|
||||
|
||||
s = socket (AF_INET, SOCK_DGRAM, 0);
|
||||
if ( s == -1)
|
||||
s = socket (AF_INET, SOCK_DGRAM, 0);
|
||||
if ( s == -1)
|
||||
{
|
||||
perror ("socket");
|
||||
exit (1);
|
||||
perror ("socket");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
check_running (master_name);
|
||||
check_running (slaving_request.slave_name);
|
||||
check_running (master_name);
|
||||
check_running (slaving_request.slave_name);
|
||||
|
||||
strcpy (ifr.ifr_name, slaving_request.slave_name);
|
||||
if (ioctl (s, SIOCGIFMTU, &ifr) == -1)
|
||||
strcpy (ifr.ifr_name, slaving_request.slave_name);
|
||||
if (ioctl (s, SIOCGIFMTU, &ifr) == -1)
|
||||
{
|
||||
perror("get MTU on slave failed");
|
||||
exit (1);
|
||||
perror("get MTU on slave failed");
|
||||
exit (1);
|
||||
}
|
||||
slave_mtu = ifr.ifr_mtu;
|
||||
slave_mtu = ifr.ifr_mtu;
|
||||
|
||||
strcpy (ifr.ifr_name, master_name);
|
||||
if (ioctl (s, SIOCGIFMTU, &ifr) == -1)
|
||||
strcpy (ifr.ifr_name, master_name);
|
||||
if (ioctl (s, SIOCGIFMTU, &ifr) == -1)
|
||||
{
|
||||
perror("get MTU on master failed");
|
||||
exit (1);
|
||||
perror("get MTU on master failed");
|
||||
exit (1);
|
||||
}
|
||||
master_mtu = ifr.ifr_mtu;
|
||||
master_mtu = ifr.ifr_mtu;
|
||||
|
||||
if ( master_mtu != slave_mtu )
|
||||
if ( master_mtu != slave_mtu )
|
||||
{
|
||||
fprintf (stderr,
|
||||
"master (%d) and slave (%d) MTU settings do not match\n",
|
||||
master_mtu, slave_mtu);
|
||||
exit (1);
|
||||
fprintf (stderr,
|
||||
"master (%d) and slave (%d) MTU settings do not match\n",
|
||||
master_mtu, slave_mtu);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
strcpy (ifr.ifr_name, master_name);
|
||||
ifr.ifr_data = (caddr_t) &slaving_request;
|
||||
strcpy (ifr.ifr_name, master_name);
|
||||
ifr.ifr_data = (caddr_t) &slaving_request;
|
||||
|
||||
if(ioctl (s,EQL_ENSLAVE, &ifr)==-1)
|
||||
if(ioctl (s,EQL_ENSLAVE, &ifr)==-1)
|
||||
{
|
||||
perror("EQL_ENSLAVE failed");
|
||||
exit (1);
|
||||
perror("EQL_ENSLAVE failed");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
check_running(char *name)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
struct ifreq ifr;
|
||||
|
||||
strcpy (ifr.ifr_name, name);
|
||||
if ( ioctl (s, SIOCGIFFLAGS, &ifr) == -1)
|
||||
strcpy (ifr.ifr_name, name);
|
||||
if ( ioctl (s, SIOCGIFFLAGS, &ifr) == -1)
|
||||
{
|
||||
perror (name);
|
||||
exit (1);
|
||||
perror (name);
|
||||
exit (1);
|
||||
}
|
||||
if (ifr.ifr_flags & (IFF_RUNNING | IFF_UP) != (IFF_RUNNING | IFF_UP))
|
||||
{
|
||||
if (ifr.ifr_flags & (IFF_RUNNING | IFF_UP) != (IFF_RUNNING | IFF_UP))
|
||||
{
|
||||
fprintf (stderr, "Device '%s' is not up or running.\n", name);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* compile-command: "gcc -Wall -Wstrict-prototypes -o eql_enslave eql_enslave.c"
|
||||
|
Loading…
Reference in New Issue
Block a user