<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Packet Sniffer Code in C using Linux Sockets (BSD)</title>
	<atom:link href="http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/</link>
	<description>Socket Programming , Game Programming , PHP , Mysql , Ubuntu etc.</description>
	<lastBuildDate>Thu, 09 Feb 2012 14:29:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Binary Tides</title>
		<link>http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/comment-page-1/#comment-31653</link>
		<dc:creator>Binary Tides</dc:creator>
		<pubDate>Mon, 06 Feb 2012 09:33:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=48#comment-31653</guid>
		<description>it should be struct iphdr*</description>
		<content:encoded><![CDATA[<p>it should be struct iphdr*</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harish</title>
		<link>http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/comment-page-1/#comment-31651</link>
		<dc:creator>Harish</dc:creator>
		<pubDate>Sun, 05 Feb 2012 17:16:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=48#comment-31651</guid>
		<description>Sorry make it
struct iphrd *ip_header = (struct iphrd *)buffer;
	
	int recv_hopcount = (unsigned int)(ip_header-&gt;ttl);</description>
		<content:encoded><![CDATA[<p>Sorry make it<br />
struct iphrd *ip_header = (struct iphrd *)buffer;</p>
<p>	int recv_hopcount = (unsigned int)(ip_header-&gt;ttl);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harish</title>
		<link>http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/comment-page-1/#comment-31650</link>
		<dc:creator>Harish</dc:creator>
		<pubDate>Sun, 05 Feb 2012 17:15:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=48#comment-31650</guid>
		<description>Hi,

    I tried to use the above program to get the ttl value from the ip header. Everything else compiles fine , but i get an error when i try to reference the ttl value 

struct iphrd *ip_header = (struct iphrd *)buffer;
	
	int recv_hopcount = (unsigned int)(ip_header-&gt;totlen);

Error: dereferencing pointer to an incomplete type

Any help.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>    I tried to use the above program to get the ttl value from the ip header. Everything else compiles fine , but i get an error when i try to reference the ttl value </p>
<p>struct iphrd *ip_header = (struct iphrd *)buffer;</p>
<p>	int recv_hopcount = (unsigned int)(ip_header-&gt;totlen);</p>
<p>Error: dereferencing pointer to an incomplete type</p>
<p>Any help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Binary Tides</title>
		<link>http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/comment-page-1/#comment-31621</link>
		<dc:creator>Binary Tides</dc:creator>
		<pubDate>Mon, 23 Jan 2012 13:29:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=48#comment-31621</guid>
		<description>the above code does not process ipv6 packets. in ipv6 the processing has to be different since ip header structure is different.</description>
		<content:encoded><![CDATA[<p>the above code does not process ipv6 packets. in ipv6 the processing has to be different since ip header structure is different.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: samualY</title>
		<link>http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/comment-page-1/#comment-31617</link>
		<dc:creator>samualY</dc:creator>
		<pubDate>Sun, 22 Jan 2012 04:42:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=48#comment-31617</guid>
		<description>How hard would it be to take the code you&#039;ve provided above, rewrite it for ipv6 ?
I have been giving it a try, I feel I just don&#039;t understand enough. The program above compiles and runs great !</description>
		<content:encoded><![CDATA[<p>How hard would it be to take the code you&#8217;ve provided above, rewrite it for ipv6 ?<br />
I have been giving it a try, I feel I just don&#8217;t understand enough. The program above compiles and runs great !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Binary Tides</title>
		<link>http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/comment-page-1/#comment-30384</link>
		<dc:creator>Binary Tides</dc:creator>
		<pubDate>Thu, 01 Dec 2011 13:09:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=48#comment-30384</guid>
		<description>its here :
http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-winsock/</description>
		<content:encoded><![CDATA[<p>its here :<br />
<a href="http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-winsock/"  rel="nofollow">http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-winsock/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Binary Tides</title>
		<link>http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/comment-page-1/#comment-30383</link>
		<dc:creator>Binary Tides</dc:creator>
		<pubDate>Thu, 01 Dec 2011 13:07:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=48#comment-30383</guid>
		<description>to capture icmp packets create socket like this :

sock_raw = socket(AF_INET , SOCK_RAW , IPPROTO_ICMP);</description>
		<content:encoded><![CDATA[<p>to capture icmp packets create socket like this :</p>
<p>sock_raw = socket(AF_INET , SOCK_RAW , IPPROTO_ICMP);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Binary Tides</title>
		<link>http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/comment-page-1/#comment-30378</link>
		<dc:creator>Binary Tides</dc:creator>
		<pubDate>Thu, 01 Dec 2011 10:12:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=48#comment-30378</guid>
		<description>For windows, winsock can be used. Check this :

http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-winsock/

Also check winpcap.</description>
		<content:encoded><![CDATA[<p>For windows, winsock can be used. Check this :</p>
<p><a href="http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-winsock/"  rel="nofollow">http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-winsock/</a></p>
<p>Also check winpcap.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Binary Tides</title>
		<link>http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/comment-page-1/#comment-30377</link>
		<dc:creator>Binary Tides</dc:creator>
		<pubDate>Thu, 01 Dec 2011 09:51:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=48#comment-30377</guid>
		<description>you cannot make a raw socket listen to a port.
The concept of port exists for TCP socket.</description>
		<content:encoded><![CDATA[<p>you cannot make a raw socket listen to a port.<br />
The concept of port exists for TCP socket.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Binary Tides</title>
		<link>http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/comment-page-1/#comment-30376</link>
		<dc:creator>Binary Tides</dc:creator>
		<pubDate>Thu, 01 Dec 2011 09:48:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=48#comment-30376</guid>
		<description>Yes, this will capture only TCP packet because of the socket definition as :
sock_raw = socket(AF_INET , SOCK_RAW , IPPROTO_TCP);

For UDP and ICMP you have to use :
sock_raw = socket(AF_INET , SOCK_RAW , IPPROTO_UDP);
sock_raw = socket(AF_INET , SOCK_RAW , IPPROTO_ICMP);

It is also possible to capture all packets together using linux sockets. Check :

http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd-part-2/

Libpcap can also be used :

http://www.binarytides.com/blog/c-packet-sniffer-code-with-libpcap-and-linux-sockets-bsd/</description>
		<content:encoded><![CDATA[<p>Yes, this will capture only TCP packet because of the socket definition as :<br />
sock_raw = socket(AF_INET , SOCK_RAW , IPPROTO_TCP);</p>
<p>For UDP and ICMP you have to use :<br />
sock_raw = socket(AF_INET , SOCK_RAW , IPPROTO_UDP);<br />
sock_raw = socket(AF_INET , SOCK_RAW , IPPROTO_ICMP);</p>
<p>It is also possible to capture all packets together using linux sockets. Check :</p>
<p><a href="http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd-part-2/"  rel="nofollow">http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd-part-2/</a></p>
<p>Libpcap can also be used :</p>
<p><a href="http://www.binarytides.com/blog/c-packet-sniffer-code-with-libpcap-and-linux-sockets-bsd/"  rel="nofollow">http://www.binarytides.com/blog/c-packet-sniffer-code-with-libpcap-and-linux-sockets-bsd/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

