diff --git a/inode.c b/inode.c index 89af749..40546c4 100644 --- a/inode.c +++ b/inode.c @@ -76,10 +76,13 @@ static ssize_t netsfs_read_stream(struct file *file, char __user *buf, char stream_buf[STREAM_BUF_LEN]; char *mac_string, *network_string; - size_t ret = 0; + size_t ret = 0, size = 0; + +/* if (*ppos != 0) return 0; +*/ spin_lock(&file->f_dentry->d_parent->d_inode->i_lock); d_private = file->f_dentry->d_parent->d_inode->i_private; diff --git a/proto.c b/proto.c index 6dcdbdc..da81c44 100644 --- a/proto.c +++ b/proto.c @@ -178,6 +178,14 @@ char *get_ip_protocol(struct sk_buff *skb) return "unknow1"; } +int get_transport_string(char *str, struct sk_buff *skb) +{ + + sprintf(str, "[TRANSPORT] ************* "); + + return 0; +} + int get_network_string(char *str, struct sk_buff *skb) { @@ -190,13 +198,13 @@ int get_network_string(char *str, struct sk_buff *skb) iphdr = ip_hdr(skb); - src = kmalloc(sizeof(char)*15, GFP_KERNEL); - dst = kmalloc(sizeof(char)*15, GFP_KERNEL); + src = kmalloc(sizeof(char)*35, GFP_KERNEL); + dst = kmalloc(sizeof(char)*35, GFP_KERNEL); get_ip_address(src, skb, SRC_ADDRESS); get_ip_address(dst, skb, DST_ADDRESS); - sprintf(str, "[NETWORK] version: %d, tos: %02x, id: %04x, protocol: %s, %s -> %s", + sprintf(str, "[ NETWORK ] version: %d, tos: %02x, id: %04x, protocol: %s, %s -> %s", iphdr->version, iphdr->tos, iphdr->id, @@ -211,7 +219,7 @@ int get_network_string(char *str, struct sk_buff *skb) int get_mac_string(char *str, struct sk_buff *skb) { - sprintf(str, "[MAC] ts: %llu, dev: %s, len: %d", + sprintf(str, "[ MAC ] ts: %llu, dev: %s, len: %d", skb->tstamp.tv64, skb->dev->name, skb->len); diff --git a/proto.h b/proto.h index 5c229e7..b06405d 100644 --- a/proto.h +++ b/proto.h @@ -18,6 +18,7 @@ extern void netsfs_register_pack(void); int netsfs_packet_handler(struct sk_buff *skb, struct net_device *dev, struct packet_type *pkt, struct net_device *dev2); +int get_transport_string(char *str, struct sk_buff *skb); int get_network_string(char *str, struct sk_buff *skb); int get_mac_string(char *str, struct sk_buff *skb); #endif