Skip to content

Commit

Permalink
Merge branch 'master' of malu.beraldoleal.com:netsfs
Browse files Browse the repository at this point in the history
Conflicts:
	inode.c
	proto.c
  • Loading branch information
beraldoleal committed Jul 21, 2013
2 parents a437f50 + 6fa8b20 commit ce3e866
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
5 changes: 4 additions & 1 deletion inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 12 additions & 4 deletions proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{

Expand All @@ -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,
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ce3e866

Please sign in to comment.