2 #include <sys/socket.h>
6 #include <linux/if_ether.h>
9 #define MAX_BUFSIZE (32*1024*1024)
11 /*------------------------------------------------------------------*/
13 receive_argument(int control_fd, int *rcvbuf, int *sndbuf)
15 if (recv(control_fd, rcvbuf, sizeof(int), 0) != sizeof(int)) {
16 fprintf(stderr, "receiving the first argument failed\n");
19 if (recv(control_fd, sndbuf, sizeof(int), 0) != sizeof(int)) {
20 fprintf(stderr, "receiving the first argument failed\n");
25 /*------------------------------------------------------------------*/
27 main(int argc, char *argv[])
29 int control_channel_fd, magic_socket;
30 int rcvbufsize = 0, sndbufsize = 0;
33 printf("This script is called by vsys.\n");
37 sscanf(argv[2],"%d", &control_channel_fd);
38 magic_socket = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
39 if (magic_socket == -1) {
40 fprintf(stderr, "Error creating socket: %d\n", errno);
43 else fprintf(stderr, "Socket: %d", magic_socket);
45 send_fd(control_channel_fd, magic_socket);