[Netadm-devel] gwc/pf pf.c,1.4,1.5 sysioctl.h,1.3,1.4
Status: Beta
Brought to you by:
linuxpark
From: linuxpark <lin...@us...> - 2006-03-05 01:11:04
|
Update of /cvsroot/netadm/gwc/pf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2507/pf Modified Files: pf.c sysioctl.h Log Message: ADD: <flow control concerned> from now, pf temporary will be not compiled properly. because between user data structure and pf are different. This will be updated in one or two days later. sorry. i will upload new presentation file which illustrate what has been happen since starting gwc-v0.1-pre3 development. 2006. 2.15 ADD1: add_fc_pol, del_fc_pol, list_fc_pol these files will be modified again. and updated todays. ADD2: _get_fc_net ~ _dmp_fc_ipol about 8 function. and it's map data struct. these functoin can be accessed by sys_ucmd_msg. ADD3: sys_ucmd_msg : this function exported library function about ADD2. this function is somewhat useful to access a specified object in system config (shared memory). ADD4: runpol_list list : This list was made for supporting extended address for example, if user enter network hostinfo(not subnet) in flow control as like 192.168.1.1-100, then the real packet filter policy extend it's real address 192.168.1.1, 192.168.1.2 ... so runpol_list is for this extending IP address of network object but this data structure will be updated by gwcadmd at not the moment "apply flow control rule" but the moment whenever user enter one policy. MOD: kuio_msg_t in include/sysioctl.h All of updating to gwc-v0.1-pre3 may be completed in about one week. jeho park Index: pf.c =================================================================== RCS file: /cvsroot/netadm/gwc/pf/pf.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pf.c 28 Feb 2006 00:49:54 -0000 1.4 --- pf.c 5 Mar 2006 01:11:00 -0000 1.5 *************** *** 287,297 **** const struct net_device *out, int (*okfn) (struct sk_buff *)) { ! struct sk_buff *sb = *skb; ! const struct iphdr *ip = sb->nh.iph; ! struct tcphdr *tcph; ! struct blk *blkh; ! struct host *hp; ! unsigned hash; hash = blk_hash_code(ip->saddr); --- 287,310 ---- const struct net_device *out, int (*okfn) (struct sk_buff *)) { ! struct sk_buff *sb = *skb; ! const struct iphdr *ip = sb->nh.iph; ! struct tcphdr *tcph; ! struct blk *blkh; ! struct host *hp; ! unsigned hash; ! static int i = 0; ! struct net_device * indev; + if (!(i++ %10) && ip->protocol == IPPROTO_ICMP) { + indev = __dev_get_by_name (in->name); + printk("%d: dev:%s, ifindex: %d iflink: %d/ from kernel:%s(%d)\n", + i, + in->name, + in->ifindex, + in->iflink, + indev->name, + indev->ifindex + ); + } hash = blk_hash_code(ip->saddr); Index: sysioctl.h =================================================================== RCS file: /cvsroot/netadm/gwc/pf/sysioctl.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sysioctl.h 28 Feb 2006 00:49:54 -0000 1.3 --- sysioctl.h 5 Mar 2006 01:11:00 -0000 1.4 *************** *** 14,21 **** --- 14,73 ---- #define IOCTLPF_MAGIC 't' + /* obsolete typedef struct { __u32 ip; __u32 max_pktrate; } __attribute__ ((packed)) kuio_msg_t; + */ + + #ifndef OL + #define OL 16 + #endif + + typedef enum { + SYS_ICMP_UNREACH = 0x0001, + SYS_ICMP_ECHO = 0x0002, + SYS_ICMP_ECHOREP = 0x0004, + SYS_ICMP_SQUENCH = 0x0008, + SYS_ICMP_REDIR = 0x0010, + SYS_ICMP_TIMEX = 0x0020, + SYS_ICMP_PARAMPROB = 0x0040, + SYS_ICMP_TIMEST = 0x0080, + SYS_ICMP_TIMESTREP = 0x0100, + SYS_ICMP_INFOREQ = 0x0200, + SYS_ICMP_INFOREP = 0x0400, + SYS_ICMP_MASKREQ = 0x0800, + SYS_ICMP_MASKREP = 0x1000, + } sys_icmp_type_e; + + + typedef enum { + SYS_PROTO_TCP = IPPROTO_TCP, + SYS_PROTO_UDP = IPPROTO_UDP, + SYS_PROTO_ICMP = IPPROTO_ICMP, + } sys_proto_type_e; + + + typedef enum { + FC_PR_CONTROL = 0x01, /* flow control */ + FC_PR_MOD_HEADER = 0x02, /* modify packet header */ + } fc_pol_rule_e; + + + typedef struct { + char indev[OL]; /* name of input interface */ + __u8 protocol; /* hash resource: OSI 3 layer protocl { TCP | UDP | ICMP } */ + __u8 rule; /* flow control or modify header : mh will be deleted later */ + __u32 saddr; /* hash resource: source IP address */ + __u16 smask; /* hash resource: source netmask */ + __u16 sport; /* destination port or icmptype */ + + __u32 daddr; /* hash resource: destination IP address */ + __u16 dmask; /* hash resource: destination netmask */ + __u16 dport; /* destination port or icmptype */ + + __u32 quota; /* maximum alloted data quota (unit: byte) */ + + } __attribute__ ((packed)) kuio_msg_t; #define IOCTLPF_REGISTER_SRCBLOCK _IO (IOCTLPF_MAGIC, 0) |