diff options
author | laforge <laforge> | 2000-07-31 09:27:18 +0000 |
---|---|---|
committer | laforge <laforge> | 2000-07-31 09:27:18 +0000 |
commit | 42863582d53b5d4753b652f61c76f7a8be961c6a (patch) | |
tree | ec4ffc8ebac73f06bb2e18850e7e43fc6bf2122c | |
parent | 99987584cdfd3c4d52432346b407818547e9e157 (diff) |
*** empty log message ***
-rw-r--r-- | kernel/ipt_ULOG.c | 62 | ||||
-rw-r--r-- | kernel/ipt_ULOG.h | 16 |
2 files changed, 39 insertions, 39 deletions
diff --git a/kernel/ipt_ULOG.c b/kernel/ipt_ULOG.c index 06a3578..0b349c9 100644 --- a/kernel/ipt_ULOG.c +++ b/kernel/ipt_ULOG.c @@ -5,7 +5,7 @@ * * Released under the terms of the GPL * - * $Id$ + * $Id: ipt_ULOG.c,v 1.1 2000/07/31 09:08:10 laforge Exp laforge $ */ #include <linux/module.h> @@ -36,20 +36,18 @@ static void nflog_rcv(struct sock *sk, int len) printk("nflog_rcv: did receive netlink message ?!?\n"); } -static unsigned int ipt_ulog_target( - struct sk_buff **pskb, - unsigned int hooknum, - const struct net_device *in, - const struct net_device *out, - const void *targinfo, - void *userinfo) +static unsigned int ipt_ulog_target(struct sk_buff **pskb, + unsigned int hooknum, + const struct net_device *in, + const struct net_device *out, + const void *targinfo, void *userinfo) { ulog_packet_msg_t *pm; size_t size; struct sk_buff *nlskb; unsigned char *old_tail; struct nlmsghdr *nlh; - struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *)targinfo; + struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *) targinfo; /* calculate the size of the skb needed */ @@ -57,11 +55,11 @@ static unsigned int ipt_ulog_target( nlskb = alloc_skb(size, GFP_ATOMIC); if (!nlskb) goto nlmsg_failure; - + old_tail = nlskb->tail; nlh = NLMSG_PUT(nlskb, 0, 0, ULOG_NL_EVENT, size - sizeof(*nlh)); pm = NLMSG_DATA(nlh); - + /* copy hook, prefix, timestamp, payload, etc. */ pm->data_len = (*pskb)->len; @@ -72,12 +70,11 @@ static unsigned int ipt_ulog_target( if (loginfo->prefix) strcpy(pm->prefix, loginfo->prefix); - if (in && !out) - { - if ((*pskb)->dev && (*pskb)->dev->hard_header_len > 0 - && (*pskb)->dev->hard_header_len <= ULOG_MAC_LEN) - { - memcpy(pm->mac, (*pskb)->mac.raw, (*pskb)->dev->hard_header_len); + if (in && !out) { + if ((*pskb)->dev && (*pskb)->dev->hard_header_len > 0 + && (*pskb)->dev->hard_header_len <= ULOG_MAC_LEN) { + memcpy(pm->mac, (*pskb)->mac.raw, + (*pskb)->dev->hard_header_len); pm->mac_len = (*pskb)->dev->hard_header_len; } @@ -90,33 +87,36 @@ static unsigned int ipt_ulog_target( memcpy(pm->payload, (*pskb)->data, (*pskb)->len); nlh->nlmsg_len = nlskb->tail - old_tail; NETLINK_CB(nlskb).dst_groups = loginfo->nl_group; - DEBUGP("ipt_ULOG: going to throw out a packet to netlink groupmask %u\n", loginfo->nl_group); - netlink_broadcast(nflognl, nlskb, 0, loginfo->nl_group, GFP_ATOMIC); + DEBUGP + ("ipt_ULOG: going to throw out a packet to netlink groupmask %u\n", + loginfo->nl_group); + netlink_broadcast(nflognl, nlskb, 0, loginfo->nl_group, + GFP_ATOMIC); return IPT_CONTINUE; -nlmsg_failure: + nlmsg_failure: if (nlskb) - kfree(nlskb); + kfree(nlskb); printk("ipt_ULOG: Error building netlink message\n"); return IPT_CONTINUE; } -static int ipt_ulog_checkentry( - const char *tablename, - const struct ipt_entry *e, - void *targinfo, - unsigned int targinfosize, - unsigned int hookmask) +static int ipt_ulog_checkentry(const char *tablename, + const struct ipt_entry *e, + void *targinfo, + unsigned int targinfosize, + unsigned int hookmask) { return 1; } - + static struct ipt_target ipt_ulog_reg = - { { NULL, NULL }, "ULOG", ipt_ulog_target, ipt_ulog_checkentry, NULL, - THIS_MODULE }; + { {NULL, NULL}, "ULOG", ipt_ulog_target, ipt_ulog_checkentry, NULL, +THIS_MODULE +}; static int __init init(void) { @@ -129,7 +129,7 @@ static int __init init(void) } static void __exit fini(void) -{ +{ DEBUGP("ipt_ULOG: cleanup_module\n"); ipt_unregister_target(&ipt_ulog_reg); } diff --git a/kernel/ipt_ULOG.h b/kernel/ipt_ULOG.h index 78ff0df..a37801a 100644 --- a/kernel/ipt_ULOG.h +++ b/kernel/ipt_ULOG.h @@ -20,17 +20,17 @@ struct ipt_ulog_info { }; typedef struct ulog_packet_msg { - unsigned long mark; - long timestamp_sec; - long timestamp_usec; - unsigned int hook; - char indev_name[IFNAMSIZ]; - char outdev_name[IFNAMSIZ]; - size_t data_len; + unsigned long mark; + long timestamp_sec; + long timestamp_usec; + unsigned int hook; + char indev_name[IFNAMSIZ]; + char outdev_name[IFNAMSIZ]; + size_t data_len; char prefix[30]; unsigned char mac_len; unsigned char mac[ULOG_MAC_LEN]; - unsigned char payload[0]; + unsigned char payload[0]; } ulog_packet_msg_t; #endif /*_IPT_ULOG_H*/ |