netadm-devel Mailing List for netadm (Page 2)
Status: Beta
Brought to you by:
linuxpark
You can subscribe to this list here.
2006 |
Jan
(4) |
Feb
(78) |
Mar
(70) |
Apr
(32) |
May
(28) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: linuxpark <lin...@us...> - 2006-05-08 17:08:37
|
Update of /cvsroot/netadm/gwc/pf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10695/pf Modified Files: pf.c sysklog.c sysktimer.c Log Message: MOD: modify time field of gwc sysklog kernel logger. Index: pf.c =================================================================== RCS file: /cvsroot/netadm/gwc/pf/pf.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pf.c 6 May 2006 18:28:58 -0000 1.12 --- pf.c 8 May 2006 07:05:59 -0000 1.13 *************** *** 168,172 **** --- 168,174 ---- /* TODO : remove me */ + #if 1 gwc_printk (GWC_KSYS_IDX, "This is KSYS test, gwc_ksys.log .. remove this debug code\n"); + #endif for( i = 0; i <= blk_hash_mask; i++){ *************** *** 180,184 **** } /* TODO : remove me */ ! gwc_printk (GWC_PF_IDX, "This is PF test, gwc_pf.log .. remove this debug code\n"); return 1; --- 182,188 ---- } /* TODO : remove me */ ! #if 1 ! gwc_printk (GWC_PF_IDX , "This is PF test, gwc_pf.log .. remove this debug code\n"); ! #endif return 1; Index: sysktimer.c =================================================================== RCS file: /cvsroot/netadm/gwc/pf/sysktimer.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sysktimer.c 6 May 2006 15:21:07 -0000 1.5 --- sysktimer.c 8 May 2006 07:05:59 -0000 1.6 *************** *** 144,148 **** static int __init init_netadm_timer(void) { ! gwc_printk(GWC_KSYS_IDX,"%s: register netadm timer\n", DRIVER_VERSION); return 0; } --- 144,148 ---- static int __init init_netadm_timer(void) { ! gwc_printk(GWC_KSYS_IDX, "%s: Register netadm timer\n", DRIVER_VERSION); return 0; } *************** *** 151,155 **** static void __exit exit_netadm_timer(void) { ! gwc_printk(GWC_KSYS_IDX,"%s: unregister netadm timer\n", DRIVER_VERSION); } --- 151,155 ---- static void __exit exit_netadm_timer(void) { ! gwc_printk(GWC_KSYS_IDX,"%s: Unregister netadm timer\n", DRIVER_VERSION); } Index: sysklog.c =================================================================== RCS file: /cvsroot/netadm/gwc/pf/sysklog.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sysklog.c 6 May 2006 23:43:23 -0000 1.4 --- sysklog.c 8 May 2006 07:05:59 -0000 1.5 *************** *** 411,415 **** nanosec_rem = do_div(t, 1000000000); tlen = sprintf(tbuf, ! "<%c>[sec:%5lu:nanosec:%06lu] ", loglev_char, (unsigned long)t, --- 411,415 ---- nanosec_rem = do_div(t, 1000000000); tlen = sprintf(tbuf, ! "<%c>[%5lu.%06lu] ", loglev_char, (unsigned long)t, |
From: linuxpark <lin...@us...> - 2006-05-08 17:04:01
|
Update of /cvsroot/netadm/gwc/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5677/include Modified Files: global.h Log Message: ADD: register_gwcklog_chrdev (major, devname); unregister_gwcklog_chrdev (major, devname); When you want more chrdevs for any other classified log type. follow these step. [ kernel module ] 1. register character log modules only with calling register_gwcklog_chrdev (major number, device name); [ user layer ] 2. make /dev node with mknod command. note! major number and its name. 3. call open chrdev with RD_ONLY 4. select the event from the device above, and read data. Index: global.h =================================================================== RCS file: /cvsroot/netadm/gwc/include/global.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** global.h 6 May 2006 23:43:23 -0000 1.9 --- global.h 8 May 2006 16:53:26 -0000 1.10 *************** *** 93,96 **** --- 93,100 ---- #define GWC_PF_LOG "gwc_pf.log" #define GWC_KSYS_LOG "gwc_ksys.log" + + #define MINGWCLOG_MAJORNUM 220 + #define MAXGWCLOG_MAJORNUM 240 + #define GWC_PF_MAJORNUM 220 #define GWC_SYS_MAJORNUM 221 |
From: linuxpark <lin...@us...> - 2006-05-08 17:04:01
|
Update of /cvsroot/netadm/gwc/pf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5677/pf Modified Files: sysklog.c sysklog.h Log Message: ADD: register_gwcklog_chrdev (major, devname); unregister_gwcklog_chrdev (major, devname); When you want more chrdevs for any other classified log type. follow these step. [ kernel module ] 1. register character log modules only with calling register_gwcklog_chrdev (major number, device name); [ user layer ] 2. make /dev node with mknod command. note! major number and its name. 3. call open chrdev with RD_ONLY 4. select the event from the device above, and read data. Index: sysklog.c =================================================================== RCS file: /cvsroot/netadm/gwc/pf/sysklog.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sysklog.c 8 May 2006 07:05:59 -0000 1.5 --- sysklog.c 8 May 2006 16:53:27 -0000 1.6 *************** *** 30,33 **** --- 30,34 ---- #include <linux/poll.h> #include <linux/fs.h> + #include <linux/mount.h> #include <asm/io.h> #include <linux/proc_fs.h> *************** *** 36,39 **** --- 37,41 ---- #include "../include/global.h" + static const char gwc_klog_driver_name[] = "gwc-klog"; static const char gwc_klog_driver_string[] = "gwc kernel log module"; *************** *** 55,59 **** * 3. Add proc handlers * ! * --LP */ #ifndef SET_MODULE_OWNER --- 57,61 ---- * 3. Add proc handlers * ! * --LP (LinuxPark, Jeho-Park) */ #ifndef SET_MODULE_OWNER *************** *** 69,91 **** #endif ! static spinlock_t logbuf_lock [MAXSYSIDX]; ! static wait_queue_head_t log_wait [MAXSYSIDX]; ! ! static spinlock_t ratelimit_lock [MAXSYSIDX]; ! static unsigned long last_msg [MAXSYSIDX]; ! ! static unsigned long toks [MAXSYSIDX]; ! static int missed [MAXSYSIDX]; ! /* ! * The indices into log_buf are not constrained to log_buf_len - they ! * must be masked before subscripting ! */ ! static unsigned long log_start [MAXSYSIDX]; ! static unsigned long log_end [MAXSYSIDX]; ! static char __log_buf[MAXSYSIDX][__SYS_LOG_BUFLEN]; ! static char *log_buf [MAXSYSIDX]; ! static int log_buf_len = __SYS_LOG_BUFLEN; ! static unsigned long logged_chars[MAXSYSIDX]; static void init_gwc_logbuf (void ) { --- 71,119 ---- #endif ! static int gwcklog_chrdevtab_slot = 0; ! struct gwcklog_chrdev { ! int idx; ! unsigned int major; ! char *devname; ! }; ! ! static struct gwcklog_chrdev gwcklog_chrdevtab [MAXSYSIDX]; ! ! typedef struct { ! ! unsigned long log_start; ! unsigned long log_end; ! ! char __log_buf [__SYS_LOG_BUFLEN]; ! char *log_buf; ! int log_buf_len; ! unsigned long logged_chars; ! ! spinlock_t logbuf_lock; ! spinlock_t ratelimit_lock; ! ! wait_queue_head_t log_wait; ! ! unsigned long last_msg; ! ! unsigned long toks; ! ! int missed; ! ! } gwcklog_t; ! ! static gwcklog_t gwcklog [MAXSYSIDX]; ! ! ! static inline int get_gwcklog_idx (const char *devname) { ! int i = -1; ! ! for (i = 0; i < gwcklog_chrdevtab_slot; i++) ! if ( !strcmp (gwcklog_chrdevtab [i].devname, devname)) ! break; ! ! return i; ! } static void init_gwc_logbuf (void ) { *************** *** 93,116 **** for (i = 0; i < MAXSYSIDX; i++) { ! logbuf_lock [i] = SPIN_LOCK_UNLOCKED; ! log_buf [i] = __log_buf [i]; ! ratelimit_lock [i] = SPIN_LOCK_UNLOCKED; ! toks [i] = 10 * 5 * HZ; } } #undef LOG_BUF_MASK ! #define LOG_BUF_MASK (log_buf_len-1) #undef LOG_BUF ! #define LOG_BUF(idx, w) (log_buf[idx][(w) & LOG_BUF_MASK]) ! static void init_gwc_wait_queue_heads (wait_queue_head_t *wq, int max) { int i; ! for (i = 0; i < max; i++) { ! wq[i].lock = SPIN_LOCK_UNLOCKED; ! wq[i].task_list.next = wq[i].task_list.prev = &wq[i].task_list; } } /* * Commands to do_gwc_sysklog: --- 121,148 ---- for (i = 0; i < MAXSYSIDX; i++) { ! gwcklog [i].logbuf_lock = SPIN_LOCK_UNLOCKED; ! gwcklog [i].ratelimit_lock = SPIN_LOCK_UNLOCKED; ! gwcklog [i].log_buf_len = __SYS_LOG_BUFLEN; ! gwcklog [i].log_buf = gwcklog [i].__log_buf; ! gwcklog [i].toks = 10 * 5 * HZ; } } #undef LOG_BUF_MASK ! #define LOG_BUF_MASK(idx) (gwcklog [idx].log_buf_len-1) #undef LOG_BUF ! #define LOG_BUF(idx, w) gwcklog [idx].log_buf [(w) & LOG_BUF_MASK (idx)] ! static void init_gwc_wait_queue_heads (void ) { int i; ! for (i = 0; i < MAXSYSIDX; i++) { ! gwcklog [i].log_wait.lock = SPIN_LOCK_UNLOCKED; ! gwcklog [i].log_wait.task_list.next = ! gwcklog [i].log_wait.task_list.prev = ! &gwcklog [i].log_wait.task_list; } } + /* * Commands to do_gwc_sysklog: *************** *** 128,132 **** * 10 -- Return size of the log buffer */ - int do_gwc_sysklog(int idx, int type, char __user * buf, int len) { --- 160,163 ---- *************** *** 174,193 **** goto out; } ! error = wait_event_interruptible(log_wait[idx], (log_start[idx] - log_end[idx])); if (error) goto out; i = 0; ! spin_lock_irq(&logbuf_lock[idx]); ! while (!error && (log_start[idx] != log_end[idx]) && i < len) { ! c = LOG_BUF(idx, log_start[idx]); ! log_start[idx]++; ! spin_unlock_irq(&logbuf_lock[idx]); error = __put_user(c,buf); buf++; i++; cond_resched(); ! spin_lock_irq(&logbuf_lock[idx]); } ! spin_unlock_irq(&logbuf_lock[idx]); if (!error) error = i; --- 205,225 ---- goto out; } ! error = wait_event_interruptible (gwcklog [idx].log_wait, ! (gwcklog [idx].log_start - gwcklog [idx].log_end)); if (error) goto out; i = 0; ! spin_lock_irq(&gwcklog [idx].logbuf_lock); ! while (!error && (gwcklog [idx].log_start != gwcklog [idx].log_end) && i < len) { ! c = LOG_BUF(idx, gwcklog [idx].log_start); ! gwcklog [idx].log_start++; ! spin_unlock_irq(&gwcklog [idx].logbuf_lock); error = __put_user(c,buf); buf++; i++; cond_resched(); ! spin_lock_irq(&gwcklog [idx].logbuf_lock); } ! spin_unlock_irq(&gwcklog [idx].logbuf_lock); if (!error) error = i; *************** *** 208,219 **** } count = len; ! if (count > log_buf_len) ! count = log_buf_len; ! spin_lock_irq(&logbuf_lock[idx]); ! if (count > logged_chars[idx]) ! count = logged_chars[idx]; if (do_clear) ! logged_chars[idx] = 0; ! limit = log_end [idx]; /* * __put_user() could sleep, and while we sleep --- 240,251 ---- } count = len; ! if (count > gwcklog [idx].log_buf_len) ! count = gwcklog [idx].log_buf_len; ! spin_lock_irq(&gwcklog [idx].logbuf_lock); ! if (count > gwcklog [idx].logged_chars) ! count = gwcklog [idx].logged_chars; if (do_clear) ! gwcklog [idx].logged_chars = 0; ! limit = gwcklog [idx].log_end; /* * __put_user() could sleep, and while we sleep *************** *** 224,236 **** for(i = 0; i < count && !error; i++) { j = limit-1-i; ! if (j + log_buf_len < log_end [idx]) break; c = LOG_BUF(idx, j); ! spin_unlock_irq(&logbuf_lock[idx]); error = __put_user(c,&buf[count-1-i]); cond_resched(); ! spin_lock_irq(&logbuf_lock [idx]); } ! spin_unlock_irq(&logbuf_lock[idx]); if (error) break; --- 256,268 ---- for(i = 0; i < count && !error; i++) { j = limit-1-i; ! if (j + gwcklog [idx].log_buf_len < gwcklog [idx].log_end) break; c = LOG_BUF(idx, j); ! spin_unlock_irq(&gwcklog [idx].logbuf_lock); error = __put_user(c,&buf[count-1-i]); cond_resched(); ! spin_lock_irq(&gwcklog [idx].logbuf_lock); } ! spin_unlock_irq(&gwcklog [idx].logbuf_lock); if (error) break; *************** *** 250,261 **** break; case 5: /* Clear ring buffer */ ! logged_chars[idx] = 0; break; case 9: /* Number of chars in the log buffer */ ! error = log_end[idx] - log_start[idx]; break; case 10: /* Size of the log buffer */ ! error = log_buf_len; break; default: --- 282,293 ---- break; case 5: /* Clear ring buffer */ ! gwcklog [idx].logged_chars = 0; break; case 9: /* Number of chars in the log buffer */ ! error = gwcklog[idx].log_end - gwcklog [idx].log_start; break; case 10: /* Size of the log buffer */ ! error = gwcklog [idx].log_buf_len; break; default: *************** *** 269,279 **** static void emit_log_char(int idx, char c) { ! LOG_BUF(idx, log_end[idx]) = c; ! log_end[idx]++; ! if (log_end[idx] - log_start[idx] > log_buf_len) ! log_start[idx] = log_end[idx] - log_buf_len; ! if (logged_chars[idx] < log_buf_len) ! logged_chars[idx]++; } --- 301,311 ---- static void emit_log_char(int idx, char c) { ! LOG_BUF(idx, gwcklog [idx].log_end) = c; ! gwcklog [idx].log_end++; ! if (gwcklog [idx].log_end - gwcklog [idx].log_start > gwcklog [idx].log_buf_len) ! gwcklog[idx].log_start = gwcklog [idx].log_end - gwcklog [idx].log_buf_len; ! if (gwcklog [idx].logged_chars < gwcklog [idx].log_buf_len) ! gwcklog [idx].logged_chars++; } *************** *** 294,298 **** /* If a crash is occurring, make sure we can't deadlock */ ! spin_lock_init(&logbuf_lock [idx]); } --- 326,330 ---- /* If a crash is occurring, make sure we can't deadlock */ ! spin_lock_init(&gwcklog [idx].logbuf_lock); } *************** *** 316,335 **** unsigned long now = jiffies; ! spin_lock_irqsave(&ratelimit_lock[idx], flags); ! toks[idx] += now - last_msg [idx]; ! last_msg [idx] = now; ! if (toks[idx] > (ratelimit_burst * ratelimit_jiffies)) ! toks [idx] = ratelimit_burst * ratelimit_jiffies; ! if (toks [idx] >= ratelimit_jiffies) { ! int lost = missed [idx]; ! missed [idx] = 0; ! toks [idx] -= ratelimit_jiffies; ! spin_unlock_irqrestore(&ratelimit_lock[idx], flags); if (lost) gwc_printk (idx, "gwc_printk: %d messages suppressed.\n", lost); return 1; } ! missed [idx]++; ! spin_unlock_irqrestore(&ratelimit_lock[idx], flags); return 0; } --- 348,367 ---- unsigned long now = jiffies; ! spin_lock_irqsave(&gwcklog [idx].ratelimit_lock, flags); ! gwcklog [idx].toks += now - gwcklog [idx].last_msg; ! gwcklog [idx].last_msg = now; ! if (gwcklog [idx].toks > (ratelimit_burst * ratelimit_jiffies)) ! gwcklog [idx].toks = ratelimit_burst * ratelimit_jiffies; ! if (gwcklog [idx].toks >= ratelimit_jiffies) { ! int lost = gwcklog [idx].missed; ! gwcklog [idx].missed = 0; ! gwcklog [idx].toks -= ratelimit_jiffies; ! spin_unlock_irqrestore(&gwcklog [idx].ratelimit_lock, flags); if (lost) gwc_printk (idx, "gwc_printk: %d messages suppressed.\n", lost); return 1; } ! gwcklog [idx].missed ++; ! spin_unlock_irqrestore(&gwcklog [idx].ratelimit_lock, flags); return 0; } *************** *** 375,379 **** /* This stops the holder of console_sem just where we want him */ ! spin_lock_irqsave(&logbuf_lock[idx], flags); printk_cpu = smp_processor_id(); --- 407,411 ---- /* This stops the holder of console_sem just where we want him */ ! spin_lock_irqsave(&gwcklog [idx].logbuf_lock, flags); printk_cpu = smp_processor_id(); *************** *** 446,455 **** */ printk_cpu = UINT_MAX; ! spin_unlock_irqrestore(&logbuf_lock, flags); goto out; } printk_cpu = UINT_MAX; ! spin_unlock_irqrestore(&logbuf_lock, flags); out: --- 478,487 ---- */ printk_cpu = UINT_MAX; ! spin_unlock_irqrestore(&gwcklog [idx].logbuf_lock, flags); goto out; } printk_cpu = UINT_MAX; ! spin_unlock_irqrestore(&gwcklog [idx].logbuf_lock, flags); out: *************** *** 478,482 **** va_end(args); ! wake_up_interruptible (&log_wait[idx]); return r; } --- 510,514 ---- va_end(args); ! wake_up_interruptible (&gwcklog [idx].log_wait); return r; } *************** *** 484,561 **** /* ! * gwc kctl file handler lists * - * @sys_xxxmsg_{open|release|read|poll|} */ ! static int gwc_pf_open(struct inode * inode, struct file * file) { ! return do_gwc_sysklog(GWC_PF_IDX, 1, NULL, 0); } ! static int gwc_pf_release(struct inode * inode, struct file * file) { ! (void) do_gwc_sysklog(GWC_PF_IDX, 0, NULL, 0); ! return 0; } ! static ssize_t gwc_pf_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { ! if ((file->f_flags & O_NONBLOCK) && !do_gwc_sysklog(GWC_PF_IDX, 9, NULL, 0)) ! return -EAGAIN; ! return do_gwc_sysklog(GWC_PF_IDX, 2, buf, count); } ! static unsigned int gwc_pf_poll(struct file *file, poll_table *wait) { ! poll_wait(file, &log_wait[GWC_PF_IDX], wait); ! if (do_gwc_sysklog(GWC_PF_IDX, 9, NULL, 0)) ! return POLLIN | POLLRDNORM; ! return 0; } ! struct file_operations gwc_pf_operations = { ! .read = gwc_pf_read, ! .poll = gwc_pf_poll, ! .open = gwc_pf_open, ! .release = gwc_pf_release, }; ! static int gwc_sys_open(struct inode * inode, struct file * file) ! { ! return do_gwc_sysklog(GWC_KSYS_IDX, 1, NULL, 0); ! } ! static int gwc_sys_release(struct inode * inode, struct file * file) ! { ! (void) do_gwc_sysklog(GWC_KSYS_IDX, 0, NULL, 0); ! return 0; ! } ! static ssize_t gwc_sys_read(struct file *file, char __user *buf, ! size_t count, loff_t *ppos) ! { ! if ((file->f_flags & O_NONBLOCK) && !do_gwc_sysklog(GWC_KSYS_IDX, 9, NULL, 0)) ! return -EAGAIN; ! return do_gwc_sysklog(GWC_KSYS_IDX, 2, buf, count); } ! static unsigned int gwc_sys_poll(struct file *file, poll_table *wait) ! { ! poll_wait(file, &log_wait[GWC_KSYS_IDX], wait); ! if (do_gwc_sysklog(GWC_KSYS_IDX, 9, NULL, 0)) ! return POLLIN | POLLRDNORM; ! return 0; ! } ! struct file_operations gwc_sys_operations = { ! .read = gwc_sys_read, ! .poll = gwc_sys_poll, ! .open = gwc_sys_open, ! .release = gwc_sys_release, ! }; static void init_gwc_kctl (void) { --- 516,626 ---- /* ! * gwc klog generic file handler lists * */ ! static int gwcklog_generic_open(struct inode * inode, struct file * file) { ! int idx = get_gwcklog_idx ( file->f_dentry->d_iname ); ! if ( idx < 0 ) ! return -ENXIO; ! ! return do_gwc_sysklog(idx, 1, NULL, 0); } ! static int gwcklog_generic_release(struct inode * inode, struct file * file) { ! int idx = get_gwcklog_idx ( file->f_dentry->d_iname ); ! if ( idx < 0 ) ! return -ENXIO; ! ! (void) do_gwc_sysklog(idx, 0, NULL, 0); ! return 0; } ! static ssize_t gwcklog_generic_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { ! int idx = get_gwcklog_idx ( file->f_dentry->d_iname ); ! if ( idx < 0 ) ! return -ENXIO; ! ! if ((file->f_flags & O_NONBLOCK) && !do_gwc_sysklog(idx, 9, NULL, 0)) ! return -EAGAIN; ! ! return do_gwc_sysklog(idx, 2, buf, count); } ! static unsigned int gwcklog_generic_poll(struct file *file, poll_table *wait) { ! int idx = get_gwcklog_idx ( file->f_dentry->d_iname ); ! if ( idx < 0 ) ! return -ENXIO; ! ! poll_wait(file, &gwcklog [idx].log_wait, wait); ! if (do_gwc_sysklog(idx, 9, NULL, 0)) ! return POLLIN | POLLRDNORM; ! ! return 0; } ! struct file_operations gwcklog_generic_operations = { ! .read = gwcklog_generic_read, ! .poll = gwcklog_generic_poll, ! .open = gwcklog_generic_open, ! .release = gwcklog_generic_release, }; + int register_gwcklog_chrdev (unsigned int major, const char *devname) { + int ret; ! if (gwcklog_chrdevtab_slot + MINGWCLOG_MAJORNUM > MAXGWCLOG_MAJORNUM ) { ! printk (KERN_ERR "chrdevtab overflow\n"); ! return -EMFILE; ! } ! gwcklog_chrdevtab[gwcklog_chrdevtab_slot].idx = gwcklog_chrdevtab_slot; ! gwcklog_chrdevtab[gwcklog_chrdevtab_slot].major = major; ! gwcklog_chrdevtab[gwcklog_chrdevtab_slot].devname = ! (char *)kmalloc (strlen (devname), GFP_KERNEL); ! ! if (!gwcklog_chrdevtab [gwcklog_chrdevtab_slot].devname) { ! printk (KERN_ERR "Failed to alloc mem\n"); ! return -ENOMEM; ! } ! strcpy (gwcklog_chrdevtab [gwcklog_chrdevtab_slot].devname, devname); ! ! if ((ret = register_chrdev(gwcklog_chrdevtab [gwcklog_chrdevtab_slot].major, ! gwcklog_chrdevtab [gwcklog_chrdevtab_slot].devname, ! &gwcklog_generic_operations)) < 0 ) { ! printk ("Failed to register gwc chrdev [%s]: %d\n", ! gwcklog_chrdevtab [gwcklog_chrdevtab_slot].devname, ret); ! kfree (gwcklog_chrdevtab [gwcklog_chrdevtab_slot].devname); ! return ret; ! } ! ++gwcklog_chrdevtab_slot; ! return ret; } + EXPORT_SYMBOL_GPL (register_gwcklog_chrdev); ! int unregister_gwcklog_chrdev (unsigned int major, const char *devname) { ! int ret; ! if (gwcklog_chrdevtab_slot - 1 < 0 ) { ! printk (KERN_ERR "gwcklog_chrdevtab underflow\n"); ! return -ENODEV; ! } ! ! if ((ret = unregister_chrdev(major, devname) < 0)) { ! printk(KERN_WARNING "%s: Failed to Unregister %s: %d\n", ! gwc_klog_driver_name, devname, ret); ! return ret; ! } ! kfree (gwcklog_chrdevtab [--gwcklog_chrdevtab_slot].devname); ! return ret; ! } ! EXPORT_SYMBOL_GPL (unregister_gwcklog_chrdev); static void init_gwc_kctl (void) { *************** *** 591,595 **** int i; ! if (register_chrdev(GWC_PF_MAJORNUM, GWC_PF_DNAME, &gwc_pf_operations) < 0) { printk(KERN_WARNING "%s: Failed to Registrate %s\n", gwc_klog_driver_name, GWC_PF_DNAME); --- 656,660 ---- int i; ! if (register_gwcklog_chrdev (GWC_PF_MAJORNUM, GWC_PF_DNAME) < 0 ) { printk(KERN_WARNING "%s: Failed to Registrate %s\n", gwc_klog_driver_name, GWC_PF_DNAME); *************** *** 597,601 **** } ! if (register_chrdev(GWC_SYS_MAJORNUM, GWC_SYS_DNAME, &gwc_sys_operations) < 0) { printk(KERN_WARNING "%s: Failed to Registrate %s\n", gwc_klog_driver_name, GWC_SYS_DNAME); --- 662,666 ---- } ! if (register_gwcklog_chrdev (GWC_SYS_MAJORNUM, GWC_SYS_DNAME) < 0 ) { printk(KERN_WARNING "%s: Failed to Registrate %s\n", gwc_klog_driver_name, GWC_SYS_DNAME); *************** *** 617,631 **** #else ! printk (KERN_INFO "%s: Unloading gwc kctl module ...\n", gwc_klog_driver_name); ! if (unregister_chrdev(GWC_PF_MAJORNUM, GWC_PF_DNAME) < 0) { printk(KERN_WARNING "%s: Failed to Unregister %s\n", gwc_klog_driver_name, GWC_PF_DNAME); } ! if (unregister_chrdev(GWC_SYS_MAJORNUM, GWC_SYS_DNAME) < 0) { printk(KERN_WARNING "%s: Failed to Unregister %s\n", gwc_klog_driver_name, GWC_SYS_DNAME); } - printk (KERN_INFO "%s: Success to unregister gwc kctl module ...\n", gwc_klog_driver_name); #endif --- 682,694 ---- #else ! if ( unregister_gwcklog_chrdev (GWC_PF_MAJORNUM, GWC_PF_DNAME) < 0 ) { printk(KERN_WARNING "%s: Failed to Unregister %s\n", gwc_klog_driver_name, GWC_PF_DNAME); } ! if (unregister_gwcklog_chrdev(GWC_SYS_MAJORNUM, GWC_SYS_DNAME) < 0) { printk(KERN_WARNING "%s: Failed to Unregister %s\n", gwc_klog_driver_name, GWC_SYS_DNAME); } #endif *************** *** 639,643 **** gwc_klog_driver_version); ! init_gwc_wait_queue_heads (log_wait, MAXSYSIDX); init_gwc_logbuf (); init_gwc_kctl (); --- 702,706 ---- gwc_klog_driver_version); ! init_gwc_wait_queue_heads (); init_gwc_logbuf (); init_gwc_kctl (); Index: sysklog.h =================================================================== RCS file: /cvsroot/netadm/gwc/pf/sysklog.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sysklog.h 6 May 2006 15:17:47 -0000 1.1 --- sysklog.h 8 May 2006 16:53:27 -0000 1.2 *************** *** 41,48 **** * 10 -- Return size of the log buffer */ - #if 0 - int do_gwc_sysklog(int idx, int type, char __user * buf, int len); - #endif - #ifdef CONFIG_GWC_SYSLOG_SYSCALL asmlinkage long sys_gwc_syslog(int idx, int type, char __user * buf, int len); --- 41,44 ---- *************** *** 63,66 **** --- 59,78 ---- asmlinkage int gwc_printk(int idx, const char *fmt, ...); + /* + * This is register_gwcklog_chrdev + * + * If you want to use, first mknod your chrdev in user layer then call this + * function with only major number and the name of that device file. + */ + int register_gwcklog_chrdev (unsigned int major, const char *devname); + + /* + * This is unregister_gwcklog_chrdev + * + * when you unload sysklog modules and If you register chrdev with register_gwcklog_chrdev () + * you must call this function. + */ + int unregister_gwcklog_chrdev (unsigned int major, const char *devname); + #if 0 /* TODO: compile error --LP */ static inline int gwc_pflog ( const char *fmt, args...) { |
From: linuxpark <lin...@us...> - 2006-04-30 19:57:21
|
Update of /cvsroot/netadm/gwc/gwcsh In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26359 Modified Files: gwcsh.c Log Message: ADD: print info comment whenver starting gwcsh. Index: gwcsh.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwcsh/gwcsh.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gwcsh.c 30 Apr 2006 18:39:28 -0000 1.1 --- gwcsh.c 30 Apr 2006 19:57:15 -0000 1.2 *************** *** 107,110 **** --- 107,115 ---- } + static void + info () { + return usage(); + } + static int execmd (int argc, char **argv, char *infile, char *outfile) *************** *** 234,237 **** --- 239,243 ---- bufsplit(" \t\n", 0, NULL); + info (); while (!sh_quit) { |
From: linuxpark <lin...@us...> - 2006-04-30 19:34:22
|
Update of /cvsroot/netadm/gwc/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7869/scripts Modified Files: gwc install.sh Log Message: MOD: install.sh, gwc gwc: add reflesh_syslog whenever starting gwc system using gwc script install.sh: remove introduction of pf compiling process because this compiling routine is moved to user compiling time. modify initial install state for {local or remove}, snmp {off|on} state. default is all off. Index: gwc =================================================================== RCS file: /cvsroot/netadm/gwc/scripts/gwc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gwc 30 Apr 2006 18:47:25 -0000 1.6 --- gwc 30 Apr 2006 19:34:18 -0000 1.7 *************** *** 140,143 **** --- 140,158 ---- } + reflesh_syslogd(){ + if [ -f /etc/redhat-release ]; then + /etc/init.d/syslog restart + fi + + if [ -f /etc/fedora-release ]; then + /etc/init.d/syslog restart + fi + + if [ -f /etc/debian_version ]; then + /etc/init.d/sysklogd restart + /etc/init.d/klogd restart + fi + } + start(){ check_usr *************** *** 178,181 **** --- 193,198 ---- case "$1" in 'start') + + reflesh_syslogd init_ipc start gwcadmd Index: install.sh =================================================================== RCS file: /cvsroot/netadm/gwc/scripts/install.sh,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** install.sh 30 Apr 2006 18:47:25 -0000 1.17 --- install.sh 30 Apr 2006 19:34:19 -0000 1.18 *************** *** 228,235 **** if [ -f /etc/debian_version ]; then ! /etc/init.d/sysklogd stop ! /etc/init.d/sysklogd start ! /etc/init.d/klogd stop ! /etc/init.d/klogd start fi } --- 228,233 ---- if [ -f /etc/debian_version ]; then ! /etc/init.d/sysklogd restart ! /etc/init.d/klogd restart fi } *************** *** 406,410 **** get_snmp_info () { ! dialog --title "netadm_gwc Configuration" --radiolist "Select whether target system support SNMP query using SNMPv1.0" 10 75 2 0 "no" "off" 1 "yes" "on" 2>support_snmp.txt if [ $? != 0 ]; then --- 404,408 ---- get_snmp_info () { ! dialog --title "netadm_gwc Configuration" --radiolist "Select whether target system support SNMP query using SNMPv1.0" 10 75 2 0 "no" "on" 1 "yes" "off" 2>support_snmp.txt if [ $? != 0 ]; then *************** *** 457,461 **** get_target_remote () { ! dialog --title "netadm_gwc Configuration" --radiolist "Select where your target system is" 10 75 2 0 "This local system" "off" 1 "Remote" "on" 2>remote.txt if [ $? != 0 ]; then --- 455,459 ---- get_target_remote () { ! dialog --title "netadm_gwc Configuration" --radiolist "Select where your target system is" 10 75 2 0 "This local system" "on" 1 "Remote" "off" 2>remote.txt if [ $? != 0 ]; then *************** *** 575,585 **** file_check ! $DIALOG --infobox "Get kernel release info ..." 5 75 sleep 2 get_kernel_info - $DIALOG --infobox "Compiling pf module ..." 5 75 - sleep 2 - module_check ip_tables.ko module_check iptable_nat.ko --- 573,580 ---- file_check ! $DIALOG --infobox "Checking kernel version ..." 5 75 sleep 2 get_kernel_info module_check ip_tables.ko module_check iptable_nat.ko |
From: linuxpark <lin...@us...> - 2006-04-30 18:47:30
|
Update of /cvsroot/netadm/gwc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6021 Modified Files: AUTHORS CHANGES FILES INSTALL Makefile Makefile.tmpl README.en README.ko Log Message: DEL: gwclib/syscrypto.c: remove LP5 for more good hash value. MOD: Makefile.tmpl: make disable -g flag and disable DEBUG, enable syslog as default. ADD: Makefile: add gwcsh and pf as subdirectories of recursive make. MOD: scripts/gwc: remove gwcguid MOD: scripts/install.sh: add gwcsh install routine and some modifying Index: FILES =================================================================== RCS file: /cvsroot/netadm/gwc/FILES,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FILES 6 Apr 2006 15:15:47 -0000 1.2 --- FILES 30 Apr 2006 18:47:24 -0000 1.3 *************** *** 2,6 **** # # Title : FILES ! # Author : Jeho-Park <lin...@gm...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : the tree infomation of source files --- 2,6 ---- # # Title : FILES ! # Author : Jeho-Park <de...@sk...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : the tree infomation of source files *************** *** 29,34 **** gwclib/confproc.c /* main proc */ gwclib/conftab.c /* proc map */ ! gwcguid/* /* gtk+ GUI code */ gwcadmd/main.c /* daemon for AP or GW communication in real time by period */ /* helper scripts */ --- 29,36 ---- gwclib/confproc.c /* main proc */ gwclib/conftab.c /* proc map */ ! gwcguid/* /* absolete, gtk+ GUI code */ gwcadmd/main.c /* daemon for AP or GW communication in real time by period */ + gwccli/main.c /* cli command */ + gwcsh/*.c /* gwc command shell */ /* helper scripts */ Index: Makefile.tmpl =================================================================== RCS file: /cvsroot/netadm/gwc/Makefile.tmpl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.tmpl 23 Apr 2006 06:53:29 -0000 1.5 --- Makefile.tmpl 30 Apr 2006 18:47:24 -0000 1.6 *************** *** 1,4 **** # - # # Title : Makefile.tmpl # Author : Jeho-Park <lin...@gm...> --- 1,3 ---- *************** *** 21,34 **** #USR_DEBUG_LEVEL += -DUSE_IF_NETMASK #USR_DEBUG_LEVEL += -DHAVE_SOCKADDR_SA_LEN - #USR_DEBUG_LEVEL += -DDEBUG #USR_DEBUG_LEVEL += -DTC_DEBUG USR_DEBUG_LEVEL += -DUSE_SYSLOG # DON'T USE LIMIT CLIENT POWER ! SIGPW_CONTROL += -DCCK_PW_CONTROL ! SIGPW_CONTROL += -DOFDM_PW_CONTROL ! SIGPW_CONTROL += -DCLIENT_PW_CONTROL ! CFLAGS = -g -Wall $(USR_DEBUG_LEVEL) $(SIGPW_CONTROL) GTKLDFLAGS = `pkg-config --libs gtk+-2.0` GTKCFLAGS = `pkg-config --cflags gtk+-2.0` --- 20,33 ---- #USR_DEBUG_LEVEL += -DUSE_IF_NETMASK #USR_DEBUG_LEVEL += -DHAVE_SOCKADDR_SA_LEN #USR_DEBUG_LEVEL += -DTC_DEBUG + #USR_DEBUG_LEVEL += -DDEBUG USR_DEBUG_LEVEL += -DUSE_SYSLOG # DON'T USE LIMIT CLIENT POWER ! #SIGPW_CONTROL += -DCCK_PW_CONTROL ! #SIGPW_CONTROL += -DOFDM_PW_CONTROL ! #SIGPW_CONTROL += -DCLIENT_PW_CONTROL ! CFLAGS = -O -Wall $(USR_DEBUG_LEVEL) $(SIGPW_CONTROL) GTKLDFLAGS = `pkg-config --libs gtk+-2.0` GTKCFLAGS = `pkg-config --cflags gtk+-2.0` *************** *** 40,41 **** --- 39,41 ---- LIBSSL = ../elib/libcrypto.a ../elib/libssl.a LIBSYS = ${LIBAPC} ${LIBSNMP} ${LIBSSL} + Index: README.ko =================================================================== RCS file: /cvsroot/netadm/gwc/README.ko,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README.ko 6 Apr 2006 15:15:47 -0000 1.4 --- README.ko 30 Apr 2006 18:47:24 -0000 1.5 *************** *** 1,7 **** ! gwc IPv4 router Á¦¾î¸ðµâ ¼³Ä¡ ¹× À¯ÀÇ »çÇ× ============================================ ! ! ! 2006. 2. 5, ¹Ú Á¦È£, lin...@gm... --- 1,6 ---- ! gwc IPv4 router Á¦¾î¸ðµâ ¼³Ä¡ ============================================ ! 2006. 05. 01. (¿ù) 03:36:32 KST ! ¹Ú Á¦È£, <de...@sk...> *************** *** 12,17 **** 3. ¼Ò½º ÄÄÆÄÀÏ 4. ¼³Ä¡ ¹× ¼³Á¤ - 5. ¼³Ä¡µÈ ÇÁ·Î±×·¥ ¸ñ·Ï ¼³¸í - 6. À¯ÀÇ »çÇ× --- 11,14 ---- *************** *** 32,38 **** 2. ±âÁ¸ gwc AP Á¦¾î¸ðµâ ÇÁ·Î±×·¥ ¾ðÀνºÅç ------------------------------------------------------ ! ! #cd {gwc ¼Ò½º µð·ºÅ丮} ! #make uninstall --- 29,35 ---- 2. ±âÁ¸ gwc AP Á¦¾î¸ðµâ ÇÁ·Î±×·¥ ¾ðÀνºÅç ------------------------------------------------------ ! ! #cd {gwc ¼Ò½º µð·ºÅ丮} ! #make uninstall *************** *** 41,45 **** ------------------------------------------------------ ! #make clean && make --- 38,42 ---- ------------------------------------------------------ ! #make clean && make *************** *** 48,155 **** ------------------------------------------------------ ! root@apc:~/wrk/gwc# make install ! Checking user's permission... ! Linux Verified ! ! ! ! 4-1. ÇöÀç Ä¿³ÎÀÌ 2.6.x ÀÎ °æ¿ì y ÀÔ·Â ! ! Do your kernel 2.6.x in directory:[ /usr/src/linux ] (y/n)? y ! make[1]: Entering directory `/root/wrk/gwc/pf' ! make -C /lib/modules/2.6.11/build SUBDIRS=/root/wrk/gwc/pf modules ! make[2]: Entering directory `/usr/src/linux-2.6.11' ! Building modules, stage 2. ! MODPOST ! make[2]: Leaving directory `/usr/src/linux-2.6.11' ! make[1]: Leaving directory `/root/wrk/gwc/pf' ! Do you have the 802.1xx supported AP ? (y/n) y ! ! ! 4-2. AP±â¿¡ SNMP community»ý¼ºÇÑ »óÅÂÀÎ °æ¿ì y ÀÔ·Â ! ! We Can not support SNMP v2.0 and above version yet. ! Do you have a valid SNMP(v1.0) community user account ? (y/n) y ! ! /* AP Á¦¾î¸ðµâ (gwc) ¿¡¼ ÇÊ¿ä·Î ÇÏ´Â Ä¿³Î ¸ðµâ È®ÀÎ */ ! /lib/modules/2.6.11/kernel/net/ipv4/netfilter/ip_tables.ko found ... ! /lib/modules/2.6.11/kernel/net/ipv4/netfilter/iptable_nat.ko found ... ! /lib/modules/2.6.11/kernel/net/sched/sch_cbq.ko found ... ! /lib/modules/2.6.11/kernel/net/sched/cls_tcindex.ko found ... ! /lib/modules/2.6.11/kernel/net/sched/cls_u32.ko found ... ! /lib/modules/2.6.11/kernel/net/sched/sch_prio.ko found ... ! /lib/modules/2.6.11/kernel/net/sched/sch_sfq.ko found ... ! ! ! 4-3. community ¸í ÀÔ·Â ! ! What is the SNMP(v1.0) community name of your AP ? public ! is this correct [community name :public] (y/n)? y ! Does this community { called public } have read and write permission in SNMPv1.0 ? (y/n) y ! ! ! 4-4. AP ³×Æ®¿öÅ© Á¤º¸ ÀÔ·Â ! ! What is IP address of your AP ? 192.168.200.199 ! What is netmask of your AP { 0 ~ 32 } ? 24 ! [AP Network :192.168.200.199/24] is this correct ? (y/n) y ! ! ... ! ! Áß°£ »ý·« ! ... ! ! ! ! 5. ¼³Ä¡µÈ ÇÁ·Î±×·¥ ¸ñ·Ï ¼³¸í ! ------------------------------------------------------ ! ! ! The Summary of this installation. ! ------------------------------------ ! The main path of this installation: /usr/local/gwc ! ! Installed Configuration file ! ---------------------------- ! /usr/local/gwc/etc/config ! ! Installed program list ! ---------------------------- ! /usr/local/sbin/gwc { Main start|stop script } ! /usr/local/sbin/gwcadmd { Admin main Daemon } ! /usr/local/sbin/gwcguid { Guid Daemon } ! /usr/local/sbin/gwccli { Cli command being able to replace of gwcguid } ! /usr/local/gwc/modules/pf.ko { Network kernel module for blocking host or modify TCP header ! ! Log ! ---------------------------- ! /usr/local/gwc/log ! ! ! ! 6. À¯ÀÇ »çÇ× ! ------------------------------------------------------ ! ! 6-1. gwc ½ºÅ©¸³À¸·Î gwc ½Ã½ºÅÛ ½ÃÀÛ ½Ã °ü·Ã GUI°¡ ¶ßÁö ¾Ê´Â °æ¿ì ? ! ! gwc ÇÁ·Î±×·¥ÀÌ Á¤»óÀûÀ¸·Î ½ÃÀ۵Ǿú´Ù¸é gwcadmd, gwcguidµÎ°³ÀÇ µ¥¸óÀÌ ¶ç¾îÁ® ÀÖ´Â °ÍÀ» ! È®ÀÎ ÇÒ ¼ö ÀÖÀ¸¸ç, ±× Áß ¾î´À µ¥¸óÀÌ¶óµµ ¶ç¾îÀÖÁö ¾ÊÀº °æ¿ì ¾Æ·¡¿Í °°ÀÌ ½Ã½ºÅÛÀ» Àç ½ÃÀÛÇÑ´Ù. ! #gwc stop ! /* ºñ Á¤»óÀûÀÎ °æ¿ì gwcguid, gwcadmd Áß gwcadmdµ¥¸óÀÌ ! ¿©ÀüÈ÷ ½ÇÇà ÁßÀÏ °æ¿ì kill¸í·ÉÀ¸·Î °Á¦ Á¾·á ½ÃŲ´Ù */ ! #gwc start ! ! ! 6-2. Can't query to AP ¿¡·¯À©µµ¿ì Ãâ·Â ½Ã ? - /usr/local/gwc/etc/config ¼³Á¤ ÈÀÏ »ó¿¡ qry_state, ap_ip, ap_mask, community Ç׸ñÀÌ - ½ÇÁ¦ »óȲ°ú °°Àº Áö È®ÀÎ ÇÏ¸ç ¸¸¾à ¼³Á¤ ÈÀÏ¿¡ ¹®Á¦ÀÏ ½Ã´Â ¾Æ·¡¿Í °°Àº ÇüÅ·ΠÀÔ·ÂÇÑ´Ù. - #********** config ¿¹Á¦ ************ - #SYS - [qry_state] 3 - [ap_ip] 192.168.200.199 - [ap_mask] 24 - [community] public - - ´Ü! À§ÀÇ ³»¿ë¿¡¼ [Ç׸ñ¸í] °ú value´Â tab¹®ÀÚ¸¸ÀÌ µé¾î°¡µµ·Ï ÁÖÀÇÇÑ´Ù. --- 45,50 ---- ------------------------------------------------------ ! # make install Index: README.en =================================================================== RCS file: /cvsroot/netadm/gwc/README.en,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README.en 6 Apr 2006 15:15:47 -0000 1.4 --- README.en 30 Apr 2006 18:47:24 -0000 1.5 *************** *** 1,7 **** README for gwc ============================== ! ! ! 2006. 01. 12. (thu) 03:16:10 KST, lin...@gm... --- 1,6 ---- README for gwc ============================== ! 2006. 05. 01. (mon) 03:36:08 KST ! jeho-park <de...@sk...> *************** *** 10,18 **** 1. Requirements. 2. what is gwc. ! 3. uninstallation of existing gwc [ skip this step if you did not install this program at all ] ! 4. compile ! 5. installation and setup ! 6. program list of installation. ! 7. note --- 9,15 ---- 1. Requirements. 2. what is gwc. ! 3. compile ! 4. installation and setup ! 5. uninstallation *************** *** 61,184 **** ! 3. Uninstallation of existing gwc ! [ skip this step if you did not install this program at all ] ! --------------------------------------------------------------------- ! ! #cd { source directory of the gwc } ! #make uninstall ! ! ! ! 4. compilation. ! --------------------------------------------------------------------- ! ! #make clean && make ! ! ! ! 5. installation and setup. --------------------------------------------------------------------- ! ! root@gwc:~/wrk/gwc# make install ! Checking user's permission... ! Linux Verified ! ! ! ! 5-1. enter 'y' if your vanilla kernel version 2.6.x ! ! Do your kernel 2.6.x in directory:[ /usr/src/linux ] (y/n)? y ! make[1]: Entering directory `/root/wrk/gwc/pf' ! make -C /lib/modules/2.6.11/build SUBDIRS=/root/wrk/gwc/pf modules ! make[2]: Entering directory `/usr/src/linux-2.6.11' ! Building modules, stage 2. ! MODPOST ! make[2]: Leaving directory `/usr/src/linux-2.6.11' ! make[1]: Leaving directory `/root/wrk/gwc/pf' ! Do you have the 802.1xx supported AP ? (y/n) y ! ! ! 5-2. enter 'y' if you make a SNMP community already in target cisco AP. ! if you have not made this comunity yet, first make this. ! ! We Can not support SNMP v2.0 and above version yet. ! Do you have a valid SNMP(v1.0) community user account ? (y/n) y ! ! /* checking needed kernel modules */ ! /lib/modules/2.6.11/kernel/net/ipv4/netfilter/ip_tables.ko found ... ! /lib/modules/2.6.11/kernel/net/ipv4/netfilter/iptable_nat.ko found ... ! /lib/modules/2.6.11/kernel/net/sched/sch_cbq.ko found ... ! /lib/modules/2.6.11/kernel/net/sched/cls_tcindex.ko found ... ! /lib/modules/2.6.11/kernel/net/sched/cls_u32.ko found ... ! /lib/modules/2.6.11/kernel/net/sched/sch_prio.ko found ... ! /lib/modules/2.6.11/kernel/net/sched/sch_sfq.ko found ... ! ! ! 5-3. community ! ! What is the SNMP(v1.0) community name of your AP ? public ! is this correct [community name :public] (y/n)? y ! Does this community { called public } have read and write permission in SNMPv1.0 ? (y/n) y ! ! ! 5-4. Cisco AP infomation. ! ! What is IP address of your AP ? 192.168.200.199 ! What is netmask of your AP { 0 ~ 32 } ? 24 ! [AP Network :192.168.200.199/24] is this correct ? (y/n) y ! ! ... ! snip ! ... ! 6. program list of installation. --------------------------------------------------------------------- ! ! The Summary of this installation. ! ------------------------------------ ! The main path of this installation: /usr/local/gwc ! ! Installed Configuration file ! ---------------------------- ! /usr/local/gwc/etc/config ! ! Installed program list ! ---------------------------- ! /usr/local/sbin/gwc { Main start|stop script } ! /usr/local/sbin/gwcadmd { Admin main Daemon } ! /usr/local/sbin/gwcguid { Guid Daemon } ! /usr/local/sbin/gwccli { Cli command being able to replace of gwcguid } ! /usr/local/gwc/modules/pf.ko { Network kernel module for blocking host or modify TCP header ! ! gwc log ! ---------------------------- ! /usr/local/gwc/log ! ! 7. note. --------------------------------------------------------------------- ! 7-1. start gwc ! #gwc start ! ! 7-2. stop gwc ! #gwc stop ! ! 7-3. why the AP must be cisco's ? ! because this gwc program use cisco enterprise defined mip and above all, the admin daemon called 'gwcadmd' query your cisco AP from start time and this daemon get some specific AP infomations so if your AP is not CISCO we can't not sure perfect operation of this gwc. ! ! 7-4. if you find this window message "Can't query to AP ... ?" ! ! i think you must check whether the infomation of AP is correct. ! this is possible by accessing and modifying configuratioin file like below ! ! #please note content name ! #sample configuration ! #/usr/local/gwc/etc/config ! #SYS ! [qry_state] {tab key} 3 ! [ap_ip] {tab key} 192.168.200.199 ! [ap_mask] {tab key} 24 ! [community] {tab key} public ! --- 58,74 ---- ! 3. compilation. --------------------------------------------------------------------- ! #make clean && make ! 4. installation and setup. --------------------------------------------------------------------- ! root@gwc:~/wrk/gwc# make install ! 5. Uninstallation. --------------------------------------------------------------------- ! #cd { source directory of the gwc } ! #make uninstall Index: Makefile =================================================================== RCS file: /cvsroot/netadm/gwc/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 6 Apr 2006 15:15:47 -0000 1.2 --- Makefile 30 Apr 2006 18:47:24 -0000 1.3 *************** *** 10,16 **** gwclib \ gwccli \ gwcadmd \ gwcguid \ ! sample all: do-all --- 10,18 ---- gwclib \ gwccli \ + gwcsh \ gwcadmd \ gwcguid \ ! sample \ ! pf all: do-all Index: INSTALL =================================================================== RCS file: /cvsroot/netadm/gwc/INSTALL,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** INSTALL 6 Apr 2006 15:15:47 -0000 1.3 --- INSTALL 30 Apr 2006 18:47:24 -0000 1.4 *************** *** 1,6 **** # - # # Title : INSTALL ! # Author : Jeho-Park <lin...@gm...> # Created date : 2006. 02. 08. (wen) 02:21:58 KST # Description : The manual for installation. --- 1,5 ---- # # Title : INSTALL ! # Author : Jeho-Park <de...@sk...> # Created date : 2006. 02. 08. (wen) 02:21:58 KST # Description : The manual for installation. Index: AUTHORS =================================================================== RCS file: /cvsroot/netadm/gwc/AUTHORS,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AUTHORS 6 Apr 2006 15:15:47 -0000 1.2 --- AUTHORS 30 Apr 2006 18:47:24 -0000 1.3 *************** *** 2,6 **** # # Title : AUTHORS ! # Author : Jeho-Park <lin...@gm...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : authors and contributors --- 2,6 ---- # # Title : AUTHORS ! # Author : Jeho-Park <de...@sk...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : authors and contributors *************** *** 8,12 **** #ident "@(#) $Header$" ! Jeho Park : lin...@gm... --- 8,12 ---- #ident "@(#) $Header$" ! Jeho Park <de...@sk...> or <lin...@gm...> Index: CHANGES =================================================================== RCS file: /cvsroot/netadm/gwc/CHANGES,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CHANGES 17 Feb 2006 08:09:18 -0000 1.5 --- CHANGES 30 Apr 2006 18:47:24 -0000 1.6 *************** *** 1,2 **** --- 1,7 ---- + Changes in gwc-v0.1-pre3 + ------------------------ + ADD: gwcsh which is shell, this will replace with gwcguid daemon. + MOD: make disable gwcguid - there is no one to develop GUI + Changes in gwc-v0.1-pre2 *************** *** 6,9 **** --- 11,15 ---- MOD: replace from linkedlist to hashtable in pf for better performance. + Changes in gwc-v0.1-pre1 -------------------------- *************** *** 11,19 **** etc Changes in pre-gwc-v0.1 ----------------------- ! +add remote monitoring ! +add QoS ! +add flow control but it has bug in removing each object. --- 17,26 ---- etc + Changes in pre-gwc-v0.1 ----------------------- ! ADD: remote monitoring ! ADD: QoS ! ADD: flow control but it has bug in removing each object. |
From: linuxpark <lin...@us...> - 2006-04-30 18:47:30
|
Update of /cvsroot/netadm/gwc/gwclib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6021/gwclib Modified Files: conftab.c confutil.c syscrypto.c Log Message: DEL: gwclib/syscrypto.c: remove LP5 for more good hash value. MOD: Makefile.tmpl: make disable -g flag and disable DEBUG, enable syslog as default. ADD: Makefile: add gwcsh and pf as subdirectories of recursive make. MOD: scripts/gwc: remove gwcguid MOD: scripts/install.sh: add gwcsh install routine and some modifying Index: syscrypto.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwclib/syscrypto.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** syscrypto.c 23 Apr 2006 07:57:46 -0000 1.2 --- syscrypto.c 30 Apr 2006 18:47:25 -0000 1.3 *************** *** 85,98 **** ROUND(H, b, c, d, a, in[9] + K3, 15); - /* Round 5 --LP */ - ROUND(H, a, b, c, d, in[13] + K3, 3); - ROUND(H, d, a, b, c, in[19] + K3, 9); - ROUND(H, c, d, a, b, in[26] + K3, 11); - ROUND(H, b, c, d, a, in[19] + K3, 15); - ROUND(H, a, b, c, d, in[21] + K3, 3); - ROUND(H, d, a, b, c, in[24] + K3, 9); - ROUND(H, c, d, a, b, in[31] + K3, 11); - ROUND(H, b, c, d, a, in[7] + K3, 15); - buf[0] += a; buf[1] += b; --- 85,88 ---- Index: conftab.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwclib/conftab.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** conftab.c 6 Apr 2006 15:12:05 -0000 1.10 --- conftab.c 30 Apr 2006 18:47:25 -0000 1.11 *************** *** 49,54 **** --- 49,57 ---- {CMD_LIST_APINFO, "list_apinfo", PR(list_apinfo), INFO_CLI_LISTAPINFO}, {CMD_ADD_APINFO, "add_apinfo", PR(add_apinfo), INFO_CLI_ADDAPINFO}, + {CMD_LIST_SNMPCOMM, "list_snmpcomm", PR(list_snmpcomm), INFO_CLI_LISTSNMPCOMM}, {CMD_ADD_SNMPCOMM, "add_snmpcomm", PR(add_snmpcomm), INFO_CLI_ADDSNMPCOMM}, + + {CMD_LIST_IF, "list_if", PR(list_if), INFO_CLI_LIST_IF}, {CMD_LIST_PHYMACSPEC, "list_phymacspec", PR(list_phymacspec), INFO_CLI_LISTPHYMACSPEC}, {CMD_LIST_SYSINFO, "list_sysinfo", PR(list_sysinfo), INFO_CLI_LISTSYSINFO}, *************** *** 57,65 **** {CMD_LIST_TCPINFO, "list_tcpinfo", PR(list_tcpinfo), INFO_CLI_LISTTCPINFO}, {CMD_LIST_UDPINFO, "list_udpinfo", PR(list_udpinfo), INFO_CLI_LISTUDPINFO}, {CMD_LIST_CCKTPW, "list_ccktpower", PR(list_ccktpower), INFO_CLI_LISTCCKTPOWER}, {CMD_LIST_OFDMTPW, "list_ofdmtpower", PR(list_ofdmtpower), INFO_CLI_LISTOFDMTPOWER}, {CMD_LIST_CLIENTPW, "list_clientpower", PR(list_clientpower), INFO_CLI_LISTCLIENTPOWER}, {CMD_SET_TXPW, "set_txpower", PR(set_txpower), INFO_CLI_SETTXPOWER}, - {CMD_LIST_IF, "list_if", PR(list_if), INFO_CLI_LIST_IF}, {CMD_LIST_QOS_MAXBW, "list_qos_maxbw", PR(list_qos_maxbw), INFO_CLI_LIST_QOS_MAXBW}, --- 60,68 ---- {CMD_LIST_TCPINFO, "list_tcpinfo", PR(list_tcpinfo), INFO_CLI_LISTTCPINFO}, {CMD_LIST_UDPINFO, "list_udpinfo", PR(list_udpinfo), INFO_CLI_LISTUDPINFO}, + {CMD_LIST_CCKTPW, "list_ccktpower", PR(list_ccktpower), INFO_CLI_LISTCCKTPOWER}, {CMD_LIST_OFDMTPW, "list_ofdmtpower", PR(list_ofdmtpower), INFO_CLI_LISTOFDMTPOWER}, {CMD_LIST_CLIENTPW, "list_clientpower", PR(list_clientpower), INFO_CLI_LISTCLIENTPOWER}, {CMD_SET_TXPW, "set_txpower", PR(set_txpower), INFO_CLI_SETTXPOWER}, {CMD_LIST_QOS_MAXBW, "list_qos_maxbw", PR(list_qos_maxbw), INFO_CLI_LIST_QOS_MAXBW}, Index: confutil.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwclib/confutil.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** confutil.c 6 Apr 2006 15:12:05 -0000 1.12 --- confutil.c 30 Apr 2006 18:47:25 -0000 1.13 *************** *** 532,570 **** } #endif - #if 0 - char * - loadfile(char *fn) - { - struct stat st; - char fname[256]; - char *cp; - int ret; - int fd; - - sprintf(fname, "%s", fn); - - if ((fd = open(fname, O_RDONLY)) == -1) { - return NULL; - } - if (fstat(fd, &st) == -1) { - close(fd); - return NULL; - } - if (st.st_size <= 0) - return NULL; - - if ((cp = (char *) malloc(st.st_size + 1)) == NULL) { - close(fd); - return NULL; - } - ret = read(fd, cp, st.st_size); - cp[st.st_size] = '\0'; - close(fd); - if (ret == -1) - return NULL; - else - return cp; - } - #endif void --- 532,535 ---- |
From: linuxpark <lin...@us...> - 2006-04-30 18:47:30
|
Update of /cvsroot/netadm/gwc/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6021/include Modified Files: global.h Log Message: DEL: gwclib/syscrypto.c: remove LP5 for more good hash value. MOD: Makefile.tmpl: make disable -g flag and disable DEBUG, enable syslog as default. ADD: Makefile: add gwcsh and pf as subdirectories of recursive make. MOD: scripts/gwc: remove gwcguid MOD: scripts/install.sh: add gwcsh install routine and some modifying Index: global.h =================================================================== RCS file: /cvsroot/netadm/gwc/include/global.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** global.h 6 Apr 2006 15:09:34 -0000 1.6 --- global.h 30 Apr 2006 18:47:25 -0000 1.7 *************** *** 19,33 **** #endif typedef int BOOL; - #ifndef _CURSES_H - #ifndef CPP - typedef int bool; - #endif #endif ! #define DEFTIMEOUT 3600 /* package naming , version , copyright - start */ #define SZPKGNAME "Netadm network control system" #define SZSYSCOPYRIGHT "GPL v2" #define SZSYSVERSION "gwc-v0.1-pre3" /* package naming , version , copyright - end */ /* exe, config file path - start */ --- 19,36 ---- #endif + #ifndef BOOL typedef int BOOL; #endif ! ! #ifndef bool ! typedef int bool; ! #endif ! ! #define DEFTIMEOUT 3600 /* package naming , version , copyright - start */ #define SZPKGNAME "Netadm network control system" #define SZSYSCOPYRIGHT "GPL v2" #define SZSYSVERSION "gwc-v0.1-pre3" + #define SZPROMPT "gwcsh>" /* package naming , version , copyright - end */ /* exe, config file path - start */ *************** *** 65,70 **** #define AUTOAPPLY_TIMEOUT 50000 #if !defined BUFSIZ ! #define BUFSIZ MAXBUF/2 ! #endif /* SYS Kernel module interface - start */ #define PKG_NAME SZPKGNAME --- 68,74 ---- #define AUTOAPPLY_TIMEOUT 50000 #if !defined BUFSIZ ! #define BUFSIZ MAXBUF/2 ! #endif ! #define MAXSHARG 64 /* SYS Kernel module interface - start */ #define PKG_NAME SZPKGNAME |
From: linuxpark <lin...@us...> - 2006-04-30 18:47:29
|
Update of /cvsroot/netadm/gwc/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6021/scripts Modified Files: gwc install.sh Log Message: DEL: gwclib/syscrypto.c: remove LP5 for more good hash value. MOD: Makefile.tmpl: make disable -g flag and disable DEBUG, enable syslog as default. ADD: Makefile: add gwcsh and pf as subdirectories of recursive make. MOD: scripts/gwc: remove gwcguid MOD: scripts/install.sh: add gwcsh install routine and some modifying Index: gwc =================================================================== RCS file: /cvsroot/netadm/gwc/scripts/gwc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gwc 6 Apr 2006 15:15:48 -0000 1.5 --- gwc 30 Apr 2006 18:47:25 -0000 1.6 *************** *** 180,184 **** init_ipc start gwcadmd ! start gwcguid insmod ${MODDIR}/sysktimer.ko insmod ${MODDIR}/pf.ko debug=0 --- 180,184 ---- init_ipc start gwcadmd ! #start gwcguid insmod ${MODDIR}/sysktimer.ko insmod ${MODDIR}/pf.ko debug=0 *************** *** 199,203 **** exit_ipc stop gwcadmd ! stop gwcguid rmmod pf rmmod sysktimer --- 199,203 ---- exit_ipc stop gwcadmd ! #stop gwcguid rmmod pf rmmod sysktimer Index: install.sh =================================================================== RCS file: /cvsroot/netadm/gwc/scripts/install.sh,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** install.sh 6 Apr 2006 15:15:48 -0000 1.16 --- install.sh 30 Apr 2006 18:47:25 -0000 1.17 *************** *** 139,186 **** get_val() { ! echo -e "$1 \c" ! read $2 } get_kernel_info() { ! kernel_ver=`gwcadmd/gwcadmd -r` ! if [ ${kernel_ver} != "2.6" ]; then ! ERROR="Kernel must above than 2.6.0 but your kernel isn't so abort ..." ! $DIALOG --msgbox "${ERROR}" 20 75 || acex 0 ! abort_install ! log "$ERROR" ! exit 1 ! fi } init_config() { ! #KVER ! #REMOTE ! #TARGET_IP ! #CISCO_AP ! #SUPPORT_SNMP ! #SNMP_COMMUNITY_NAME ! echo -e "#SYS" > ${TMP_CONFIG} ! echo -e "#Last Updated: $(date)" >> ${TMP_CONFIG} ! echo -e "[qry_state]\t3" >> ${TMP_CONFIG} ! if [ ${CISCO_AP} == "" ]; then ! CISCO_AP="0" ! fi ! echo -e "[target_type]\t${CISCO_AP}" >> ${TMP_CONFIG} ! echo -e "[target]\t${TARGET_IP}\t${TARGET_MASK}" >> ${TMP_CONFIG} ! if [ ${SUPPORT_SNMP} == "" ]; then ! SUPPORT_SNMP="0" ! fi ! echo -e "[snmp]\t${SUPPORT_SNMP}" >> ${TMP_CONFIG} ! echo -e "[snmp_community]\t${SNMP_COMMUNITY_NAME}" >> ${TMP_CONFIG} ! echo -e "[fc_svc]\tanyTCP\ttcp\t0" >> ${TMP_CONFIG} ! echo -e "[fc_svc]\tanyUDP\tudp\t0" >> ${TMP_CONFIG} ! echo -e "[fc_svc]\tICMP\ticmp\t0" >> ${TMP_CONFIG} ! return } --- 139,182 ---- get_val() { ! echo -e "$1 \c" ! read $2 } get_kernel_info() { ! kernel_ver=`gwcadmd/gwcadmd -r` ! if [ ${kernel_ver} != "2.6" ]; then ! ERROR="Kernel must above than 2.6.0 but your kernel isn't so abort ..." ! $DIALOG --msgbox "${ERROR}" 20 75 || acex 0 ! abort_install ! log "$ERROR" ! exit 1 ! fi } init_config() { + echo -e "#SYS" > ${TMP_CONFIG} + echo -e "#Last Updated: $(date)" >> ${TMP_CONFIG} + echo -e "[qry_state]\t3" >> ${TMP_CONFIG} + + if [ ${CISCO_AP} == "" ]; then + CISCO_AP="0" + fi ! echo -e "[target_type]\t${CISCO_AP}" >> ${TMP_CONFIG} ! echo -e "[target]\t${TARGET_IP}\t${TARGET_MASK}" >> ${TMP_CONFIG} + if [ ${SUPPORT_SNMP} == "" ]; then + SUPPORT_SNMP="0" + fi + + echo -e "[snmp]\t${SUPPORT_SNMP}" >> ${TMP_CONFIG} + echo -e "[snmp_community]\t${SNMP_COMMUNITY_NAME}" >> ${TMP_CONFIG} + echo -e "[fc_svc]\tanyTCP\ttcp\t0" >> ${TMP_CONFIG} + echo -e "[fc_svc]\tanyUDP\tudp\t0" >> ${TMP_CONFIG} + echo -e "[fc_svc]\tICMP\ticmp\t0" >> ${TMP_CONFIG} + return } *************** *** 200,203 **** --- 196,200 ---- log "Removing binary..." rm -f ${BINDIR}/gwccli + rm -f ${BINDIR}/gwcsh rm -f ${BINDIR}/gwcguid rm -f ${BINDIR}/gwcadmd *************** *** 256,259 **** --- 253,257 ---- backup_files ${INST} -m 700 -o root -g root gwccli/gwccli ${BINDIR} + ${INST} -m 700 -o root -g root gwcsh/gwcsh ${BINDIR} ${INST} -m 700 -o root -g root gwcguid/gwcguid ${BINDIR} ${INST} -m 700 -o root -g root gwcadmd/gwcadmd ${BINDIR} *************** *** 303,306 **** --- 301,313 ---- exit 1 fi + + if [ ! -f gwcsh/gwcsh ]; then + ERROR="gwcsh shell does not exist, compile first! abort install ..." + $DIALOG --infobox "${ERROR}" 5 75 + sleep 2 + abort_install + log "$ERROR" + exit 1 + fi if [ ! -f gwcguid/gwcguid ]; then *************** *** 385,399 **** module_check () { ! FILES=`find ${KERN} -name $1` ! if [ -n "${FILES}" ]; then ! $DIALOG --infobox "${FILES} found ..." 5 80 ! sleep 1 ! else ! ERROR="No ${FILES} found, abort install ..." ! $DIALOG --infobox "${ERROR}" 5 80 ! sleep 2 ! abort_install ! exit 1 ! fi } --- 392,406 ---- module_check () { ! FILES=`find ${KERN} -name $1` ! if [ -n "${FILES}" ]; then ! $DIALOG --infobox "${FILES} found ..." 5 80 ! sleep 1 ! else ! ERROR="No ${FILES} found, abort install ..." ! $DIALOG --infobox "${ERROR}" 5 80 ! sleep 2 ! abort_install ! exit 1 ! fi } *************** *** 513,518 **** %s/%s { Main start|stop script } %s/gwcadmd { Admin main Daemon } - %s/gwcguid { Guid Daemon } %s/gwccli { Cli command being able to replace of gwcguid } %s/pf { kernel module for controlling flow or modifying TCP header } --- 520,525 ---- %s/%s { Main start|stop script } %s/gwcadmd { Admin main Daemon } %s/gwccli { Cli command being able to replace of gwcguid } + %s/gwcsh { gwc shell for interfacing with main admin daemon(gwcadmd) } %s/pf { kernel module for controlling flow or modifying TCP header } *************** *** 533,538 **** fi ! warning ! warning intro trap abort_install 1 2 6 12 15 --- 540,544 ---- fi ! #warning intro trap abort_install 1 2 6 12 15 *************** *** 575,581 **** $DIALOG --infobox "Compiling pf module ..." 5 75 sleep 2 - cd pf - make - cd .. module_check ip_tables.ko --- 581,584 ---- |
From: linuxpark <lin...@us...> - 2006-04-30 18:47:29
|
Update of /cvsroot/netadm/gwc/gwccli In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6021/gwccli Modified Files: main.c Log Message: DEL: gwclib/syscrypto.c: remove LP5 for more good hash value. MOD: Makefile.tmpl: make disable -g flag and disable DEBUG, enable syslog as default. ADD: Makefile: add gwcsh and pf as subdirectories of recursive make. MOD: scripts/gwc: remove gwcguid MOD: scripts/install.sh: add gwcsh install routine and some modifying Index: main.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwccli/main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.c 6 Apr 2006 15:15:48 -0000 1.3 --- main.c 30 Apr 2006 18:47:24 -0000 1.4 *************** *** 124,127 **** --- 124,128 ---- } } + if (!p->key) { prnl(); *************** *** 147,157 **** } } ! #if 0 ! if (msg == CMD_LIST_PHYMACSPEC || msg == CMD_SET_TXPW) ! while (csm->shared_mutex == MUTEX_LOCK) ; ! csm->shared_mutex = MUTEX_LOCK; ! #endif pir = ipc_msg(msg, buf, total, argc - 2); - // csm->shared_mutex = MUTEX_UNLOCK; if (pir->ret != RET_OK) { if (pir->p && strlen(pir->p)) { --- 148,153 ---- } } ! pir = ipc_msg(msg, buf, total, argc - 2); if (pir->ret != RET_OK) { if (pir->p && strlen(pir->p)) { |
From: linuxpark <lin...@us...> - 2006-04-30 18:47:29
|
Update of /cvsroot/netadm/gwc/pf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6021/pf Modified Files: Makefile Log Message: DEL: gwclib/syscrypto.c: remove LP5 for more good hash value. MOD: Makefile.tmpl: make disable -g flag and disable DEBUG, enable syslog as default. ADD: Makefile: add gwcsh and pf as subdirectories of recursive make. MOD: scripts/gwc: remove gwcguid MOD: scripts/install.sh: add gwcsh install routine and some modifying Index: Makefile =================================================================== RCS file: /cvsroot/netadm/gwc/pf/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 30 Apr 2006 14:46:02 -0000 1.4 --- Makefile 30 Apr 2006 18:47:25 -0000 1.5 *************** *** 19,23 **** ctags * clean: ! rm -rf *.ko *.mod.* *.cmd *.o *.tmp_versions depend: $(MAKEDEPEND) -- $(CFLAGS) -- *.c --- 19,23 ---- ctags * clean: ! rm -rf *.ko *.mod.* .*cmd *.o .tmp_versions depend: $(MAKEDEPEND) -- $(CFLAGS) -- *.c |
From: linuxpark <lin...@us...> - 2006-04-30 18:39:33
|
Update of /cvsroot/netadm/gwc/gwcsh In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3483/gwcsh Added Files: Makefile gwcsh.c input.c input.h ipccmd.c ipccmd.h kbhit.c kbhit.h Log Message: Initial check-in : gwcsh: gwc command shell This shell will replace with gwcguid daemon. --- NEW FILE: input.h --- /* Title : input.h Author : Jeho-Park <de...@sk...> Created date : 2006. 05. 01. (mon) 00:24:33 KST Description : header of input.c object */ #ident "@(#) $Header: /cvsroot/netadm/gwc/gwcsh/input.h,v 1.1 2006/04/30 18:39:28 linuxpark Exp $" #ifndef __GWCSH_INPUT_H #define __GWCSH_INPUT_H #define FN_PARAMS(paramlist) paramlist #ifndef NEWLINE #define NEWLINE '\n' #endif #ifndef RETURN #define RETURN CTRL('M') #endif #ifndef RUBOUT #define RUBOUT 0x7f #endif #ifndef TAB #define TAB '\t' #endif #ifdef ABORT_CHAR #undef ABORT_CHAR #endif #define ABORT_CHAR CTRL('G') #ifdef PAGE #undef PAGE #endif #define PAGE CTRL('L') #ifdef SPACE #undef SPACE #endif #define SPACE ' ' /* XXX - was 0x20 */ #ifdef ESC #undef ESC #endif #define ESC CTRL('[') /* Possible state values for rl_readline_state */ #define RL_STATE_NONE 0x00000 /* no state; before first call */ #define RL_STATE_INITIALIZING 0x00001 /* initializing */ #define RL_STATE_INITIALIZED 0x00002 /* initialization done */ #define RL_STATE_TERMPREPPED 0x00004 /* terminal is prepped */ #define RL_STATE_READCMD 0x00008 /* reading a command key */ #define RL_STATE_METANEXT 0x00010 /* reading input after ESC */ #define RL_STATE_DISPATCHING 0x00020 /* dispatching to a command */ #define RL_STATE_MOREINPUT 0x00040 /* reading more input in a command function */ #define RL_STATE_ISEARCH 0x00080 /* doing incremental search */ #define RL_STATE_NSEARCH 0x00100 /* doing non-inc search */ #define RL_STATE_SEARCH 0x00200 /* doing a history search */ #define RL_STATE_NUMERICARG 0x00400 /* reading numeric argument */ #define RL_STATE_MACROINPUT 0x00800 /* getting input from a macro */ #define RL_STATE_MACRODEF 0x01000 /* defining keyboard macro */ #define RL_STATE_OVERWRITE 0x02000 /* overwrite mode */ #define RL_STATE_COMPLETING 0x04000 /* doing completion */ #define RL_STATE_SIGHANDLER 0x08000 /* in readline sighandler */ #define RL_STATE_UNDOING 0x10000 /* doing an undo */ #define RL_STATE_INPUTPENDING 0x20000 /* rl_execute_next called */ #define RL_STATE_TTYCSAVED 0x40000 /* tty special chars saved */ #define RL_STATE_DONE 0x80000 /* done; accepted line */ #define RL_SETSTATE(x) (rl_readline_state |= (x)) #define RL_UNSETSTATE(x) (rl_readline_state &= ~(x)) #define RL_ISSTATE(x) (rl_readline_state & (x)) extern FILE *rl_instream; extern FILE *rl_outstream; #if !defined (PARAMS) # define PARAMS(protos) protos #endif #if !defined (_RL_FUNCTION_TYPEDEF) #define _RL_FUNCTION_TYPEDEF /* Type for input and pre-read hook functions like rl_event_hook */ typedef int rl_hook_func_t PARAMS((void *)); /* Input function type */ typedef int rl_getc_func_t PARAMS((FILE *)); #endif extern rl_hook_func_t *rl_event_hook; extern rl_getc_func_t *rl_getc_function; /* Make this non-zero to return the current input_line. */ extern int rl_done; /* Non-zero makes this the next keystroke to read. */ extern int rl_pending_input; /* The number of characters read in order to type this complete command. */ extern int rl_key_sequence_length; /* Flags word encapsulating the current readline state. */ extern int rl_readline_state; extern int rl_stuff_char (int key); extern int rl_execute_next(int c); extern int rl_clear_pending_input(void); extern int _rl_unget_char (int key); extern int _rl_pushed_input_available (void); extern int rl_set_keyboard_input_timeout(int u); extern int rl_read_key (void); extern int rl_getc (FILE *stream); #endif /* __GWCSH_INPUT_H */ --- NEW FILE: input.c --- /* Title : input.c Author : Jeho-Park <de...@sk...> Created date : 2006. 05. 01. (mon) 00:24:33 KST Description : ported input.c of readline library. */ #ident "@(#) $Header: /cvsroot/netadm/gwc/gwcsh/input.c,v 1.1 2006/04/30 18:39:28 linuxpark Exp $" #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <sys/time.h> #include <sys/select.h> #include <sys/ioctl.h> #include <stdio.h> #include <errno.h> #include "sysnio.h" #include "input.h" /* Non-null means it is a pointer to a function to run while waiting for * character input. */ rl_hook_func_t *rl_event_hook = (rl_hook_func_t *)NULL; rl_getc_func_t *rl_getc_function = rl_getc; /* The names of the streams that we do input and output to. */ FILE *rl_instream = (FILE *)NULL; FILE *rl_outstream = (FILE *)NULL; static int _keyboard_input_timeout = 100000; /* 0.1 seconds; it's in usec */ static int pop_index, push_index; static unsigned char ibuffer[512]; static int ibuffer_len = sizeof (ibuffer) - 1; /* Make this non-zero to return the current input_line. */ int rl_done; /* Non-zero makes this the next keystroke to read. */ int rl_pending_input = 0; /* The number of characters read in order to type this complete command. */ int rl_key_sequence_length = 0; /* Flags word encapsulating the current readline state. */ int rl_readline_state = RL_STATE_NONE; /* Get a key from the buffer of characters to be read. Return the key in KEY. Result is KEY if there was a key, or 0 if there wasn't. */ static int rl_get_char (key) int *key; { if (push_index == pop_index) return (0); *key = ibuffer[pop_index++]; if (pop_index >= ibuffer_len) pop_index = 0; return (1); } /* Return the amount of space available in the buffer for stuffing characters. */ static int ibuffer_space () { if (pop_index > push_index) return (pop_index - push_index - 1); else return (ibuffer_len - (push_index - pop_index)); } /* Add KEY to the buffer of characters to be read. Returns 1 if the character was stuffed correctly; 0 otherwise. */ int rl_stuff_char (key) int key; { if (ibuffer_space () == 0) return 0; if (key == EOF) { key = NEWLINE; rl_pending_input = EOF; RL_SETSTATE (RL_STATE_INPUTPENDING); } if (key == '\t') printf("good\n"); ibuffer[push_index++] = key; if (push_index >= ibuffer_len) push_index = 0; return 1; } /* Make C be the next command to be executed. */ int rl_execute_next (c) int c; { rl_pending_input = c; RL_SETSTATE (RL_STATE_INPUTPENDING); return 0; } /* Clear any pending input pushed with rl_execute_next() */ int rl_clear_pending_input () { rl_pending_input = 0; RL_UNSETSTATE (RL_STATE_INPUTPENDING); return 0; } /* If a character is available to be read, then read it and stuff it into IBUFFER. Otherwise, just return. Returns number of characters read (0 if none available) and -1 on error (EIO). */ static int rl_gather_tyi () { int tty; register int tem, result; int chars_avail, k; char input; fd_set readfds, exceptfds; struct timeval timeout; tty = fileno (rl_instream); FD_ZERO (&readfds); FD_ZERO (&exceptfds); FD_SET (tty, &readfds); FD_SET (tty, &exceptfds); timeout.tv_sec = 0; timeout.tv_usec = _keyboard_input_timeout; result = select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout); if (result <= 0) return 0; /* Nothing to read. */ result = -1; errno = 0; result = ioctl (tty, FIONREAD, &chars_avail); if (result == -1 && errno == EIO) return -1; if (result == -1) { tem = fcntl (tty, F_GETFL, 0); //fcntl (tty, F_SETFL, (tem | O_NDELAY)); fcntl (tty, F_SETFL, (tem )); chars_avail = read (tty, &input, 1); fcntl (tty, F_SETFL, tem); if (chars_avail == -1 && errno == EAGAIN) return 0; if (chars_avail == 0) /* EOF */ { rl_stuff_char (EOF); return (0); } } /* If there's nothing available, don't waste time trying to read something. */ if (chars_avail <= 0) return 0; tem = ibuffer_space (); if (chars_avail > tem) chars_avail = tem; /* One cannot read all of the available input. I can only read a single character at a time, or else programs which require input can be thwarted. If the buffer is larger than one character, I lose. Damn! */ if (tem < ibuffer_len) chars_avail = 0; if (result != -1) { printf ("~~~~\n"); while (chars_avail--) { k = (*rl_getc_function) (rl_instream); rl_stuff_char (k); if ( k == '\t' || k == NEWLINE || k == RETURN) { break; } } } else { if (chars_avail) rl_stuff_char (input); } return 1; } /* Read a key, including pending input. */ int rl_read_key () { int c; rl_key_sequence_length++; if (rl_pending_input) { c = rl_pending_input; rl_clear_pending_input (); } else { #if 0 /* If input is coming from a macro, then use that. */ if (c = _rl_next_macro_key ()) return (c); #endif /* If the user has an event function, then call it periodically. */ if (rl_event_hook) { while (rl_event_hook && rl_get_char (&c) == 0) { (*rl_event_hook) (&c); if (rl_done) /* XXX - experimental */ return ('\n'); if (rl_gather_tyi () < 0) /* XXX - EIO */ { rl_done = 1; return ('\n'); } } } else { if (rl_get_char (&c) == 0) c = (*rl_getc_function) (rl_instream); } } return (c); } int rl_getc (stream) FILE *stream; { int result; unsigned char c; while (1) { result = read (fileno (stream), &c, sizeof (unsigned char)); if (result == sizeof (unsigned char)) return (c); /* If zero characters are returned, then the file that we are reading from is empty! Return EOF in that case. */ if (result == 0) return (EOF); #if defined (__BEOS__) if (errno == EINTR) continue; #endif #if defined (EWOULDBLOCK) # define X_EWOULDBLOCK EWOULDBLOCK #else # define X_EWOULDBLOCK -99 #endif #if defined (EAGAIN) # define X_EAGAIN EAGAIN #else # define X_EAGAIN -99 #endif if (errno == X_EWOULDBLOCK || errno == X_EAGAIN) { if (sys_blockingmode (fileno (stream), 0) < 0) return (EOF); continue; } #undef X_EWOULDBLOCK #undef X_EAGAIN /* If the error that we received was SIGINT, then try again, this is simply an interrupted system call to read (). Otherwise, some error ocurred, also signifying EOF. */ if (errno != EINTR) return (EOF); } } /* Stuff KEY into the *front* of the input buffer. Returns non-zero if successful, zero if there is no space left in the buffer. */ int _rl_unget_char (key) int key; { if (ibuffer_space ()) { pop_index--; if (pop_index < 0) pop_index = ibuffer_len - 1; ibuffer[pop_index] = key; return (1); } return (0); } int _rl_pushed_input_available () { return (push_index != pop_index); } int rl_set_keyboard_input_timeout (u) int u; { int o; o = _keyboard_input_timeout; if (u > 0) _keyboard_input_timeout = u; return (o); } --- NEW FILE: Makefile --- # # Title : Makefile # Author : Jeho-Park <de...@sk...> # Created date : 2006. 04. 30. (sun) 20:55:10 KST # Description : Makefile for gwcsh # #ident "@(#) $Header: /cvsroot/netadm/gwc/gwcsh/Makefile,v 1.1 2006/04/30 18:39:28 linuxpark Exp $" include ../Makefile.tmpl TARGET = gwcsh OBJECTS = input.o \ kbhit.o \ ipccmd.o \ gwcsh.o all: $(TARGET) $(TARGET): $(OBJECTS) $(CC) -o $@ $(OBJECTS) $(LIBSYS) .c.o: $(CC) $(CFLAGS) $(INCLUDE) -c $< tags: ctags *.c *.h clean: rm -f ${TARGET} *.o depend: $(MAKEDEPEND) -- $(CFLAGS) -- *.c rm -f Makefile.bak # DO NOT DELETE THIS LINE -- make depend depends on it. --- NEW FILE: ipccmd.c --- /* Title : ipccmd.c Author : Jeho-Park <de...@sk...> Created date : 2006. 05. 01. (mon) 00:24:33 KST Description : ipc command for gwcsh */ #ident "@(#) $Header: /cvsroot/netadm/gwc/gwcsh/ipccmd.c,v 1.1 2006/04/30 18:39:28 linuxpark Exp $" #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/time.h> #include <string.h> #include <strings.h> #include <errno.h> #include <stdio.h> #include <stdarg.h> #include <arpa/telnet.h> #include <unistd.h> #include <stdlib.h> #include "global.h" #include "sysipc.h" #include "slog.h" #include "sysutil.h" #include "sysshm.h" #include "confutil.h" #define SC_NOSPC 1 #define SC_DIGIT 2 extern sys_cmd_t cmdtab[]; extern sm_t *csm; extern int errno; static void pr(char *fmt, ...) { va_list ap; char buf[8192]; int n; if (fmt && *fmt) { va_start(ap, fmt); n = ssvsnprintf(buf, sizeof (buf) - 2, fmt, ap); va_end(ap); if (n < 0) sprintf(buf, "error: message truncated"); } else { buf[0] = '\0'; } strcat(buf, "\n"); printf(buf); } static void prnl(void) { printf("\n"); } static void help(int argc, char *argv[]) { sys_cmd_t *p; for (p = cmdtab; p->key; p++) { if (!strcmp(p->key, "dump")) continue; pr("\t %s:\t%s", p->key, p->hlp); } pr("\t %s:\t%s", "quit | exit", "exit this shell"); } int ipc_cmd (int argc, char *argv[]) { char buf[8192]; char *cp; char *ident; int remain; int i; sys_cmd_t *p; int msg; int len; int total; fr_t *pir; int col; int file = FALSE; #if 1 dprintf ("argc: %d argv[0]: [%s] argv[1]: [%s]\n", argc, argv[0], argv[1]); /* runtime argument checking and if needed, return help */ if (argc > (MAXARGC)) { printf("Max Argument Cannot Be More Than %d\n", MAXARGC); return FALSE; } if (argc < 1) { prnl(); pr("Usage:"); prnl(); help(argc, argv); return FALSE; } if ((ident = strrchr(argv[0], '/')) != NULL) ident++; else ident = argv[0]; if (strcmp(argv[0], "encconf") && strcmp(argv[0], "dumpconf")) { if (cshmattach(&csm) < 0) { printf("Cannot attach APCADMD SHM '%s'\n", strerror(errno)); return FALSE; } } else { csm = (sm_t *) malloc(sizeof (sm_t)); file = TRUE; } for (p = cmdtab; p->key; p++) { if (!strcasecmp(p->key, argv[0])) { msg = p->cmd; dprintf ("found ~!: [%s]\n", p->key); break; } } #endif if (!p->key) { prnl(); pr("Available Commands are:"); prnl(); help(argc, argv); return FALSE; } buf[0] = '\0'; remain = sizeof (buf) - 1; total = 0; cp = buf; for (i = 1; i < argc; i++) { len = strlen(argv[i]); if (len > (remain - 1)) { printf("Argument Too Long (MAX:%d)\n", sizeof (buf)); return FALSE; } else { strcpy(cp, argv[i]); cp += len + 1; remain -= len + 1; total += len + 1; } } pir = ipc_msg(msg, buf, total, argc - 1); if (pir->ret != RET_OK) { if (pir->p && strlen(pir->p)) { printf("%s", pir->p); if (pir->p[pir->len - 1] != '\n') printf("\n"); } else { /* this cannot happen */ printf("Unknown error(%d) occured\n", pir->ret); } frfree(pir); return FALSE; } if (pir->islist) { printf("Total %d found\n", pir->rows); for (col = 1, i = 0; i < pir->len; i++) { if (pir->p[i] == '\0') { if (col < pir->cols) { pir->p[i] = ','; col++; } else { pir->p[i] = '\n'; col = 1; } } } if (i != 0) { if (pir->p[i]) pir->p[i] = '\0'; } } if (pir->len && pir->p) { printf("%s", pir->p); if (!pir->islist && (pir->len > 1) && (pir->p[pir->len - 1] != '\n') && (pir->p[pir->len - 2] != '\n')) printf("\n"); } frfree(pir); if (file == FALSE) { if (cshmdetach(csm) < 0) printf("Cannot detach APCADMD SHM '%s'\n", strerror(errno)); } else { free(csm); } return TRUE; } --- NEW FILE: kbhit.c --- /* Title : kbhit.c Author : Jeho-Park <de...@sk...> Created date : 2006. 05. 01. (mon) 00:24:33 KST Description : */ #ident "@(#) $Header: /cvsroot/netadm/gwc/gwcsh/kbhit.c,v 1.1 2006/04/30 18:39:28 linuxpark Exp $" #include "kbhit.h" #include <termios.h> #include <unistd.h> static struct termios initial_settings, new_settings; static int peek_character = -1; void init_keyboard() { tcgetattr(0,&initial_settings); new_settings = initial_settings; new_settings.c_lflag &= ~ICANON; new_settings.c_lflag &= ~ECHO; new_settings.c_lflag &= ~ISIG; new_settings.c_cc[VMIN] = 1; new_settings.c_cc[VTIME] = 0; tcsetattr(0, TCSANOW, &new_settings); } void close_keyboard() { tcsetattr(0, TCSANOW, &initial_settings); } int kbhit() { unsigned char ch; int nread; if (peek_character != -1) return 1; new_settings.c_cc[VMIN]=0; tcsetattr(0, TCSANOW, &new_settings); nread = read(0,&ch,1); new_settings.c_cc[VMIN]=1; tcsetattr(0, TCSANOW, &new_settings); if(nread == 1) { peek_character = ch; write (1, &ch, 1); return 1; } return 0; } int readch() { char ch; if(peek_character != -1) { ch = peek_character; peek_character = -1; return ch; } read(0,&ch,1); return ch; } --- NEW FILE: ipccmd.h --- /* Title : ipccmd.h Author : Jeho-Park <de...@sk...> Created date : 2006. 05. 01. (mon) 00:18:18 KST Description : */ #ident "@(#) $Header: /cvsroot/netadm/gwc/gwcsh/ipccmd.h,v 1.1 2006/04/30 18:39:28 linuxpark Exp $" #ifndef __GWCSH_IPCCMD_H #define __GWCSH_IPCCMD_H int ipc_cmd (int argc, char *argv[]); #endif /* __GWCSH_IPCCMD_H */ --- NEW FILE: gwcsh.c --- /* Title : gwcsh.c Author : Jeho-Park <de...@sk...> Created date : 2006. 05. 01. (mon) 00:24:33 KST Description : main of gwcsh */ #ident "@(#) $Header: /cvsroot/netadm/gwc/gwcsh/gwcsh.c,v 1.1 2006/04/30 18:39:28 linuxpark Exp $" #include <sys/types.h> #include <sys/wait.h> #include <libgen.h> #include <signal.h> #include <unistd.h> #include <string.h> #include <curses.h> #include <fcntl.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include "input.h" #include "kbhit.h" #include "ipccmd.h" #include "global.h" #include "slog.h" #include "sysutil.h" int sh_quit = FALSE; static int cmd_depth = 1; bool bdebug = FALSE; int hook_kb (void *p) { return TRUE; } int getchs (char *s) { char c; int loop_quit = FALSE; #ifdef USE_READLINE while ((c = rl_read_key()) != NEWLINE ) { #else while (!loop_quit) { #endif if (kbhit()) { c = readch (); *s++ = c; switch (c) { case TAB: printf ("tab\n"); loop_quit = TRUE; /* TODO: show params */ break; case NEWLINE: loop_quit = TRUE; break; } } usleep (100000); } return TRUE; } static size_t bufsplit(char *buf, size_t n, char **a) { int i; int nsplit; static char *splitch = "\t\n"; if (buf != NULL && n == 0) { splitch = buf; return(1); } nsplit = 0; while (nsplit < n) { a[nsplit++] = buf; if ((buf = strpbrk(buf, splitch)) == NULL) break; *(buf++) = '\0'; if (*buf == '\0') break; } buf = strrchr(a[nsplit-1], '\0'); for (i=nsplit; i < n; i++) a[i] = buf; return(nsplit); } static void usage () { printf ("\n"); printf ("gwcsh: shell program for interfacing with the gwcadmd daemon\n"); printf ("-d: debug\n"); printf ("-h: this option\n"); printf ("\n"); printf ("may. 2. 2006, jeho park <de...@sk...>\n"); printf ("\n"); } static int execmd (int argc, char **argv, char *infile, char *outfile) { int status; pid_t pid = 0; int infd = -1; int outfd = -1; extern int errno; sigset_t mask; sigset_t savemask; struct sigaction ignore; struct sigaction saveint; struct sigaction savequit; if (bdebug != TRUE) { if (infile != NULL) { if ((infd = open(infile, O_RDONLY)) < 0) { perror(infile); return (-1); } } if (outfile != NULL) { if ((outfd = creat(outfile, 0666)) < 0) { perror(outfile); close(infd); return (-1); } } sigemptyset(&ignore.sa_mask); ignore.sa_handler = SIG_IGN; ignore.sa_flags = 0; sigaction(SIGINT, &ignore, &saveint); sigaction(SIGQUIT, &ignore, &savequit); sigemptyset(&mask); sigaddset(&mask, SIGCHLD); sigprocmask(SIG_BLOCK, &mask, &savemask); if ((pid = fork()) < 0) status = -1; } /* * This code executes in the child process. */ if (!pid) { /* * Restore signals to their original dispositions, * and restore the signal mask. */ if (bdebug != TRUE) { sigaction(SIGINT, &saveint, (struct sigaction *) 0); sigaction(SIGQUIT, &savequit, (struct sigaction *) 0); sigprocmask(SIG_SETMASK, &savemask, (sigset_t *) 0); if (infd > 0) dup2(infd, 0); if (outfd > 0) dup2(outfd, 1); close (infd); } if ( ipc_cmd (argc, argv) != TRUE ) fprintf (stderr, "Failed to execute command\n"); _exit(0); } if (bdebug != TRUE) { while (waitpid(pid, &status, 0) < 0) { if (errno != EINTR) { status = -1; break; } } sigaction(SIGINT, &saveint, (struct sigaction *) 0); sigaction(SIGQUIT, &savequit, (struct sigaction *) 0); sigprocmask(SIG_SETMASK, &savemask, (sigset_t *) 0); close(outfd); close(infd); } return (status); } int main(int argc, char **argv) { char **cp; int sargc, status; char *sargv[MAXSHARG]; char command[BUFSIZ]; char *infile, *outfile; int c; while ((c = getopt(argc, argv, "dh")) != EOF) { switch (c) { case 'd': bdebug = TRUE; break; case 'h': usage(); exit(0); default: usage(); exit(0); } } rl_event_hook = hook_kb; rl_instream = stdin; rl_outstream = stdout; init_keyboard(); bufsplit(" \t\n", 0, NULL); while (!sh_quit) { again: printf("%s", SZPROMPT); fflush (rl_outstream); memset (command, 0, sizeof (command)); if ( getchs (command) < 0 ) { putchar('\n'); goto EXIT; } sargc = bufsplit(command, MAXSHARG, sargv); sargv[sargc] = NULL; if (!strcasecmp (command, "quit") || !strcasecmp (command, "exit")) { printf ("exit...\n"); putchar('\n'); goto EXIT; } dprintf ("sargc[%d]\n", sargc); if (**argv == '\0') continue; /* * Find any input and output redirections. */ infile = NULL; outfile = NULL; for (cp = argv; *cp != NULL; cp++) { if (strcmp(*cp, "<") == 0) { if (*(cp+1) == NULL) { fprintf(stderr, "You must specify "); fprintf(stderr, "an input file.\n"); goto again; } *cp++ = NULL; infile = *cp; } else if (strcmp(*cp, ">") == 0) { if (*(cp+1) == NULL) { fprintf(stderr, "You must specify "); fprintf(stderr, "an output file.\n"); goto again; } *cp++ = NULL; outfile = *cp; } } status = execmd (sargc, sargv, infile, outfile); } EXIT: close_keyboard(); exit(1); } --- NEW FILE: kbhit.h --- /* Title : kbhit.h Author : Jeho-Park <de...@sk...> Created date : 2006. 05. 01. (mon) 00:24:33 KST Description : */ #ident "@(#) $Header: /cvsroot/netadm/gwc/gwcsh/kbhit.h,v 1.1 2006/04/30 18:39:28 linuxpark Exp $" #ifndef __GWCSH_KBHIT_H #define __GWCSH_KBHIT_H void init_keyboard(void); void close_keyboard(void); int kbhit(void); int readch(void); #endif /* __GWCSH_KBHIT_H */ |
From: linuxpark <lin...@us...> - 2006-04-30 18:37:41
|
Update of /cvsroot/netadm/gwc/gwcsh In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2697/gwcsh Log Message: Directory /cvsroot/netadm/gwc/gwcsh added to the repository |
From: linuxpark <lin...@us...> - 2006-04-30 14:46:14
|
Update of /cvsroot/netadm/gwc/pf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3664 Modified Files: Makefile Log Message: MOD: modify Makefile for kernel module to make recursive with user Makefile. Index: Makefile =================================================================== RCS file: /cvsroot/netadm/gwc/pf/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 6 Apr 2006 15:15:48 -0000 1.3 --- Makefile 30 Apr 2006 14:46:02 -0000 1.4 *************** *** 12,22 **** KDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) default: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules clean: ! rm -rf *.ko ! rm -rf *.mod.* ! rm -rf .*.cmd ! rm -rf *.o ! rm -rf .tmp_versions --- 12,26 ---- KDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) + all: default default: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules + tags: + ctags * clean: ! rm -rf *.ko *.mod.* *.cmd *.o *.tmp_versions ! depend: ! $(MAKEDEPEND) -- $(CFLAGS) -- *.c ! rm -f Makefile.bak ! ! # DO NOT DELETE |
From: linuxpark <lin...@us...> - 2006-04-23 07:57:49
|
Update of /cvsroot/netadm/gwc/gwclib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30920 Modified Files: syscrypto.c Log Message: DEL: remove standard output from syscrypto.c Index: syscrypto.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwclib/syscrypto.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** syscrypto.c 23 Apr 2006 06:49:16 -0000 1.1 --- syscrypto.c 23 Apr 2006 07:57:46 -0000 1.2 *************** *** 18,23 **** * jeho-park <lin...@ga...> or <de...@sk...> 2006. 4 */ - - #include <stdio.h> #include <string.h> #include <unistd.h> --- 18,21 ---- *************** *** 123,127 **** while (i < max) { - printf("?\n"); if ( i < 4 ) { buf [i] = (int)string[i]; --- 121,124 ---- |
From: linuxpark <lin...@us...> - 2006-04-23 06:53:35
|
Update of /cvsroot/netadm/gwc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24437 Modified Files: Makefile.tmpl Log Message: MOD: rename library from libsys.a to libnetadm.a Index: Makefile.tmpl =================================================================== RCS file: /cvsroot/netadm/gwc/Makefile.tmpl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.tmpl 6 Apr 2006 15:15:47 -0000 1.4 --- Makefile.tmpl 23 Apr 2006 06:53:29 -0000 1.5 *************** *** 36,40 **** # LIB macro LDSOCK = -lsocket ! LIBAPC = ../gwclib/libsys.a LIBSNMP = ../elib/libsnmp.a LIBSSL = ../elib/libcrypto.a ../elib/libssl.a --- 36,40 ---- # LIB macro LDSOCK = -lsocket ! LIBAPC = ../gwclib/libnetadm.a LIBSNMP = ../elib/libsnmp.a LIBSSL = ../elib/libcrypto.a ../elib/libssl.a |
From: linuxpark <lin...@us...> - 2006-04-23 06:52:17
|
Update of /cvsroot/netadm/gwc/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23514 Added Files: syscrypto.h Log Message: Initial-Check in --- NEW FILE: syscrypto.h --- /* Title : syscrypto.h Author : Jeho-Park <lin...@gm...> or <de...@sk...> Created date : 2006. 04. 23. (SUN) 15:45:26 KST Description : netadm crypto library */ #ident "@(#) $Header: /cvsroot/netadm/gwc/include/syscrypto.h,v 1.1 2006/04/23 06:52:15 linuxpark Exp $" #ifndef __SYS_CRYPTO_H #define __SYS_CRYPTO_H int gwc_get32uid_by_md4 (char *s); #endif /* __SYS_CRYPTO_H */ |
From: linuxpark <lin...@us...> - 2006-04-23 06:50:50
|
Update of /cvsroot/netadm/gwc/gwclib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22116 Modified Files: Makefile Log Message: MOD: ADD: add syscrypto.o in Makefile MOD: change the name of library from libsys.a to libnetadm.a Index: Makefile =================================================================== RCS file: /cvsroot/netadm/gwc/gwclib/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 6 Apr 2006 15:12:05 -0000 1.3 --- Makefile 23 Apr 2006 06:50:46 -0000 1.4 *************** *** 23,32 **** systime.o \ naufilter.o \ ! regexp.o ! all: libsys.a ! libsys.a: $(SYSOBJS) rm -rf $@ ar -cr $@ $(SYSOBJS) --- 23,33 ---- systime.o \ naufilter.o \ ! regexp.o \ ! syscrypto.o ! all: libnetadm.a ! libnetadm.a: $(SYSOBJS) rm -rf $@ ar -cr $@ $(SYSOBJS) |
From: linuxpark <lin...@us...> - 2006-04-23 06:49:20
|
Update of /cvsroot/netadm/gwc/gwclib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20772 Added Files: syscrypto.c Log Message: Initial-checkin int gwc_get32uid_by_md4 (char *string) desc: this function return uniqeue 4 byte integer for a given string (max 32byte) @string: any string return: uniqueue integer --- NEW FILE: syscrypto.c --- /* Title : syscrypto.c Author : Jeho-Park <lin...@gm...> or <de...@sk...> Created date : 2006. 04. 23. (SUN) 15:31:33 KST Description : gwc crypto library */ #ident "@(#) $Header: /cvsroot/netadm/gwc/gwclib/syscrypto.c,v 1.1 2006/04/23 06:49:16 linuxpark Exp $" /* * This program is non-GPL but follows the BSD license * so If you want to use this code, you must not cut this comment. * * The half_md4_transform() was ported from linux/lib/halfmd4.c and made for more extensible * to get a unique id with more long string. * * jeho-park <lin...@ga...> or <de...@sk...> 2006. 4 */ #include <stdio.h> #include <string.h> #include <unistd.h> /* F, G and H are basic MD4 functions: selection, majority, parity */ #define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) #define G(x, y, z) (((x) & (y)) + (((x) ^ (y)) & (z))) #define H(x, y, z) ((x) ^ (y) ^ (z)) /* * The generic round function. The application is so specific that * we don't bother protecting all the arguments with parens, as is generally * good macro practice, in favor of extra legibility. * Rotation is separate from addition to prevent recomputation */ #define ROUND(f, a, b, c, d, x, s) \ (a += f(b, c, d) + x, a = (a << s) | (a >> (32 - s))) #define K1 0 #define K2 013240474631UL #define K3 015666365641UL /* * Basic cut-down MD4 transform. Returns only 32 bits of result. */ static int half_md4_transform(int buf[4], int const in[32]) { int a = buf[0], b = buf[1], c = buf[2], d = buf[3]; /* Round 1 */ ROUND(F, a, b, c, d, in[0] + K1, 3); ROUND(F, d, a, b, c, in[1] + K1, 7); ROUND(F, c, d, a, b, in[2] + K1, 11); ROUND(F, b, c, d, a, in[3] + K1, 19); ROUND(F, a, b, c, d, in[4] + K1, 3); ROUND(F, d, a, b, c, in[5] + K1, 7); ROUND(F, c, d, a, b, in[6] + K1, 11); ROUND(F, b, c, d, a, in[7] + K1, 19); /* Round 2 */ ROUND(G, a, b, c, d, in[1] + K2, 3); ROUND(G, d, a, b, c, in[3] + K2, 5); ROUND(G, c, d, a, b, in[5] + K2, 9); ROUND(G, b, c, d, a, in[7] + K2, 13); ROUND(G, a, b, c, d, in[0] + K2, 3); ROUND(G, d, a, b, c, in[2] + K2, 5); ROUND(G, c, d, a, b, in[4] + K2, 9); ROUND(G, b, c, d, a, in[6] + K2, 13); /* Round 3 */ ROUND(H, a, b, c, d, in[3] + K3, 3); ROUND(H, d, a, b, c, in[7] + K3, 9); ROUND(H, c, d, a, b, in[2] + K3, 11); ROUND(H, b, c, d, a, in[6] + K3, 15); ROUND(H, a, b, c, d, in[1] + K3, 3); ROUND(H, d, a, b, c, in[5] + K3, 9); ROUND(H, c, d, a, b, in[0] + K3, 11); ROUND(H, b, c, d, a, in[4] + K3, 15); /* Round 4 --LP */ ROUND(H, a, b, c, d, in[12] + K3, 3); ROUND(H, d, a, b, c, in[19] + K3, 9); ROUND(H, c, d, a, b, in[4] + K3, 11); ROUND(H, b, c, d, a, in[7] + K3, 15); ROUND(H, a, b, c, d, in[29] + K3, 3); ROUND(H, d, a, b, c, in[13] + K3, 9); ROUND(H, c, d, a, b, in[16] + K3, 11); ROUND(H, b, c, d, a, in[9] + K3, 15); /* Round 5 --LP */ ROUND(H, a, b, c, d, in[13] + K3, 3); ROUND(H, d, a, b, c, in[19] + K3, 9); ROUND(H, c, d, a, b, in[26] + K3, 11); ROUND(H, b, c, d, a, in[19] + K3, 15); ROUND(H, a, b, c, d, in[21] + K3, 3); ROUND(H, d, a, b, c, in[24] + K3, 9); ROUND(H, c, d, a, b, in[31] + K3, 11); ROUND(H, b, c, d, a, in[7] + K3, 15); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; return buf[1]; /* "most hashed" word */ } /* * gwc_get32uid_by_md4 * @string: any random string (max 32 byte) * @return: uniqueue 32bit integer ( not fully tested ) */ int gwc_get32uid_by_md4 (char *string) { int i = 0; int max = strlen(string); int buf [4] = { 15733, 337534321, 1369311751, 73951137 }; int in [8 * 4] = { 34243, 454331, 34381, 32332, 34095, 13225, 1241, 3221, 33215, 11231, 3237, 43111, 13425, 97723, 36631, 5467, 45411, 24333, 5307, 28871, 2457, 43261, 34457, 5473, 33321, 45347, 739421, 23227, 3323, 3326, 33311, 33697 }; int md4; while (i < max) { printf("?\n"); if ( i < 4 ) { buf [i] = (int)string[i]; } in [i] = 0x789ABCDE & (int)string[i]; ++i; } md4 = half_md4_transform(buf, in); if (md4 <= 0 ) md4 = 0xFFFFFFFF ^ md4; return md4; } |
From: linuxpark <lin...@us...> - 2006-04-13 14:01:50
|
Update of /cvsroot/netadm/gwc/pf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17265 Modified Files: pf.c Log Message: FIX: fix spelling and add comment about num_physpages. Index: pf.c =================================================================== RCS file: /cvsroot/netadm/gwc/pf/pf.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pf.c 18 Mar 2006 17:45:41 -0000 1.8 --- pf.c 13 Apr 2006 14:01:45 -0000 1.9 *************** *** 269,273 **** return -1; } ! goal = num_physpages >> (26 - PAGE_SHIFT); for(order=0; (1UL<<order)<goal; order++); --- 269,274 ---- return -1; } ! ! /* @num_physpages: system global variable which means real page (4k) number of your ram */ goal = num_physpages >> (26 - PAGE_SHIFT); for(order=0; (1UL<<order)<goal; order++); *************** *** 283,287 **** }while( blk_hash_table==NULL && --order > 0 ); ! printk("%s: num_physpages (%ld) PAGE_SHIFT (%d) goad(%d) blk_hash_mask(%x)\n", DEVICE_NAME, num_physpages, PAGE_SHIFT, goal, blk_hash_mask); --- 284,288 ---- }while( blk_hash_table==NULL && --order > 0 ); ! printk("%s: num_physpages (%ld) PAGE_SHIFT (%d) goal(%d) blk_hash_mask(%x)\n", DEVICE_NAME, num_physpages, PAGE_SHIFT, goal, blk_hash_mask); |
From: jeho-park <lin...@gm...> - 2006-04-12 15:14:55
|
- netfilter internal (not complete) : http://stonelinux.sf.net/netfilter/ - skbuff (not complete) : http://stonelinux.sf.net/prog1_skbuff1.html : http://stonelinux.sf.net/prog1_skbuff2.html - network device driver ( not complete) if you have good document and it is remake by yourself, please upload that file.~ - TODO: benchmarking tool for network product and its usage how to (software tools, iperf or netperf) |
From: jeho-park <lin...@gm...> - 2006-04-06 15:25:13
|
+Initial Check-in of the library for contents filtering. ported C library of dansgardian's oop (www.dansgardian.org). +checked memory leak in BSD 6.0, BSD4.11. +Add sample code in sample directory. later this library will be implemented with the style of this example code. + TODO: checked functionality in BSD 6.0, BSD 4.11 but it will be killed by SEGFAULT sig it is stemed from glibc bug of linux. for more info, refer to regular concerned glibc library of linux. ---------------------------?????????????????-- +TODO: no session cache management in library. + confilter_conf structure is alloc for each session. it is ugly :-) ... later regards jeho -park |
From: linuxpark <lin...@us...> - 2006-04-06 15:16:00
|
Update of /cvsroot/netadm/gwc/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12694/scripts Modified Files: gwc install.sh syslog.conf Log Message: MOD: minor modifying and renaming email address. ADD: sample subdir to Makefile. Index: syslog.conf =================================================================== RCS file: /cvsroot/netadm/gwc/scripts/syslog.conf,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** syslog.conf 28 Feb 2006 23:05:17 -0000 1.3 --- syslog.conf 6 Apr 2006 15:15:48 -0000 1.4 *************** *** 1,7 **** # - # - # # Title : syslog.conf ! # Author : Jeho-Park <ne...@ke...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : --- 1,5 ---- # # Title : syslog.conf ! # Author : Jeho-Park <lin...@gm...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : Index: gwc =================================================================== RCS file: /cvsroot/netadm/gwc/scripts/gwc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gwc 28 Feb 2006 00:52:07 -0000 1.4 --- gwc 6 Apr 2006 15:15:48 -0000 1.5 *************** *** 3,7 **** # # Title : gwc ! # Author : Jeho-Park <ne...@ke...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : main script for daemon start|stop --- 3,7 ---- # # Title : gwc ! # Author : Jeho-Park <lin...@gm...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : main script for daemon start|stop Index: install.sh =================================================================== RCS file: /cvsroot/netadm/gwc/scripts/install.sh,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** install.sh 14 Mar 2006 17:17:10 -0000 1.15 --- install.sh 6 Apr 2006 15:15:48 -0000 1.16 *************** *** 3,7 **** # # Title : install.sh ! # Author : Jeho-Park <ne...@ke...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : --- 3,7 ---- # # Title : install.sh ! # Author : Jeho-Park <lin...@gm...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : |
From: linuxpark <lin...@us...> - 2006-04-06 15:16:00
|
Update of /cvsroot/netadm/gwc/pf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12694/pf Modified Files: Makefile Log Message: MOD: minor modifying and renaming email address. ADD: sample subdir to Makefile. Index: Makefile =================================================================== RCS file: /cvsroot/netadm/gwc/pf/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 28 Feb 2006 00:49:54 -0000 1.2 --- Makefile 6 Apr 2006 15:15:48 -0000 1.3 *************** *** 2,6 **** # # Title : Makefile ! # Author : Jeho-Park <ne...@ke...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : Makefile for pf --- 2,6 ---- # # Title : Makefile ! # Author : Jeho-Park <lin...@gm...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : Makefile for pf |
From: linuxpark <lin...@us...> - 2006-04-06 15:16:00
|
Update of /cvsroot/netadm/gwc/gwcguid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12694/gwcguid Modified Files: Makefile Log Message: MOD: minor modifying and renaming email address. ADD: sample subdir to Makefile. Index: Makefile =================================================================== RCS file: /cvsroot/netadm/gwc/gwcguid/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 30 Jan 2006 17:41:29 -0000 1.1.1.1 --- Makefile 6 Apr 2006 15:15:48 -0000 1.2 *************** *** 2,6 **** # # Title : Makefile ! # Author : Jeho-Park <ne...@ke...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : Makefile for gwcguid --- 2,6 ---- # # Title : Makefile ! # Author : Jeho-Park <lin...@gm...> # Created date : 2006. 01. 31. (thu) 01:40:38 KST # Description : Makefile for gwcguid |