[Netadm-devel] gwc/gwcadmd main.c,1.5,1.6
Status: Beta
Brought to you by:
linuxpark
From: linuxpark <lin...@us...> - 2006-03-05 01:11:04
|
Update of /cvsroot/netadm/gwc/gwcadmd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2507/gwcadmd Modified Files: main.c Log Message: ADD: <flow control concerned> from now, pf temporary will be not compiled properly. because between user data structure and pf are different. This will be updated in one or two days later. sorry. i will upload new presentation file which illustrate what has been happen since starting gwc-v0.1-pre3 development. 2006. 2.15 ADD1: add_fc_pol, del_fc_pol, list_fc_pol these files will be modified again. and updated todays. ADD2: _get_fc_net ~ _dmp_fc_ipol about 8 function. and it's map data struct. these functoin can be accessed by sys_ucmd_msg. ADD3: sys_ucmd_msg : this function exported library function about ADD2. this function is somewhat useful to access a specified object in system config (shared memory). ADD4: runpol_list list : This list was made for supporting extended address for example, if user enter network hostinfo(not subnet) in flow control as like 192.168.1.1-100, then the real packet filter policy extend it's real address 192.168.1.1, 192.168.1.2 ... so runpol_list is for this extending IP address of network object but this data structure will be updated by gwcadmd at not the moment "apply flow control rule" but the moment whenever user enter one policy. MOD: kuio_msg_t in include/sysioctl.h All of updating to gwc-v0.1-pre3 may be completed in about one week. jeho park Index: main.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwcadmd/main.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** main.c 12 Feb 2006 18:45:11 -0000 1.5 --- main.c 5 Mar 2006 01:10:59 -0000 1.6 *************** *** 49,52 **** --- 49,53 ---- #include "syssnmp.h" #include "systime.h" + #include "linklist.h" extern int errno; *************** *** 56,59 **** --- 57,61 ---- bool bdebug = FALSE; pthread_attr_t attr; + list runpol_list; #define PR() dprintf("") typedef struct { *************** *** 908,911 **** --- 910,941 ---- } + static void + show_runpol (void ) { + fc_umsg_t *p; /* node which include new vals */ + struct listnode *n; + int i = 0; + #if 0 + sm_t *sm; + int smid; + + smid = shmget(APCSHMID, sizeof (sm_t), IPC_EXCL | SHM_R); + if (smid == -1) { + printf("shmget error: %s\n", strerror(errno)); + printf("please check daemon\n"); + return; + } + + sm = shmat(smid, 0, SHM_RDONLY); + if ((int) sm == -1) { + printf("shmat error: %s\n", strerror(errno)); + printf("please check daemon\n"); + return; + } + #endif + LIST_LOOP (csm->fc_ipol_list, p, n) { + out ("%d'th: ipol name: %s\n", i++, p->polname); + } + } + static void * *************** *** 1031,1035 **** char cmd[MINBUF]; ! while ((c = getopt(argc, argv, "dhprf")) != EOF) { switch (c) { --- 1061,1065 ---- char cmd[MINBUF]; ! while ((c = getopt(argc, argv, "dhprfs")) != EOF) { switch (c) { *************** *** 1051,1054 **** --- 1081,1087 ---- show_kversion (); exit (0); + case 's': + show_runpol(); + exit (0); case '?': usage(); *************** *** 1091,1094 **** --- 1124,1134 ---- init_shm(); + runpol_list = list_new(); + if (!runpol_list) { + out ("Failed to alloc runpol_list\n"); + goto EXIT; + } + csm->fc_ipol_list = runpol_list; + if ((loadconf(csm, SZMASTCONF)) != RET_OK) { out("Cannot load configuration\n"); *************** *** 1178,1182 **** FD_SET(fd, &sock_set); ptv = NULL; ! tv.tv_sec = APC_ADMD_TIMEOUT * 60L; tv.tv_usec = 0; ptv = &tv; --- 1218,1223 ---- FD_SET(fd, &sock_set); ptv = NULL; ! //tv.tv_sec = APC_ADMD_TIMEOUT * 60L; ! tv.tv_sec = 30; tv.tv_usec = 0; ptv = &tv; *************** *** 1188,1191 **** --- 1229,1233 ---- } else if (!ret) { out ("timeout continue ...\n"); + show_runpol(); continue; } else { *************** *** 1231,1234 **** --- 1273,1277 ---- pthread_mutex_destroy(&autotest_mutex); pthread_mutex_destroy(&control_mutex); + list_delete_all_node (runpol_list); /* daemon exit */ |