[pso] Porturi si protocol

Mihai Iancu pso@cursuri.cs.pub.ro
Sun, 30 May 2004 09:44:10 -0700 (PDT)


--0-775355323-1085935450=:88103
Content-Type: text/plain; charset=us-ascii

Asa se obtin porturile 
 
struct iphdr *ip = skb->nh.iph
struct tcphdr *tcp = (struct tcphdr*)((__u32*)(ip+ip->ihl))
... ntohs(tcp->dest))
... ntohs(tcp->source)

 
Enjoy

iana ionel cristian <iana_ionelcristian@yahoo.com> wrote:

--- Ioana Cutcutache wrote:
> In primul rand ar trebui sa folosesti ntohs ca sa
> vezi valoarea reala a unui port. 
> Eu am mai avut o problema ca la pachetele ce intrau
> vedeam numerele porturilor aiurea si asta din cauza
> ca accesam header-ul tcp prin h.th si se pare ca nu
> era bine sa accesez asa. Nu prea am inteles de ce
> aparea aceasta problema, dar daca accesam de la
> nh.iph + nh.iph->ihl (deci daca consideram ca
> header-ul tcp se gasea imediat dupa cel ip) 
> 

treaba e ca mie nu-mi merge asa, si oricum as vrea sa
primesc o explicatie logica la ce se intampla.
deci de unde luam porturile si de ce?





__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 
_______________________________________________
pso mailing list
pso@cursuri.cs.pub.ro
http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/pso
		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger
--0-775355323-1085935450=:88103
Content-Type: text/html; charset=us-ascii

<DIV>Asa se obtin porturile </DIV>
<DIV>&nbsp;</DIV>
<DIV>struct iphdr *ip = skb-&gt;nh.iph<BR>struct tcphdr *tcp = (struct tcphdr*)((__u32*)(ip+ip-&gt;ihl))<BR>... ntohs(tcp-&gt;dest))<BR>... ntohs(tcp-&gt;source)<BR></DIV>
<DIV>&nbsp;</DIV>
<DIV>Enjoy</DIV>
<DIV><BR><B><I>iana ionel cristian &lt;iana_ionelcristian@yahoo.com&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>--- Ioana Cutcutache <IOANA_C@PCNET.RO>wrote:<BR>&gt; In primul rand ar trebui sa folosesti ntohs ca sa<BR>&gt; vezi valoarea reala a unui port. <BR>&gt; Eu am mai avut o problema ca la pachetele ce intrau<BR>&gt; vedeam numerele porturilor aiurea si asta din cauza<BR>&gt; ca accesam header-ul tcp prin h.th si se pare ca nu<BR>&gt; era bine sa accesez asa. Nu prea am inteles de ce<BR>&gt; aparea aceasta problema, dar daca accesam de la<BR>&gt; nh.iph + nh.iph-&gt;ihl (deci daca consideram ca<BR>&gt; header-ul tcp se gasea imediat dupa cel ip) <BR>&gt; <BR><BR>treaba e ca mie nu-mi merge asa, si oricum as vrea sa<BR>primesc o explicatie logica la ce se intampla.<BR>deci de unde luam porturile si de ce?<BR><BR><BR><BR><BR><BR>__________________________________<BR>Do you Yahoo!?<BR>Friends. Fun. Try the all-new Yahoo! Messenger.<BR>http://messenger.yahoo.com/
 <BR>_______________________________________________<BR>pso mailing list<BR>pso@cursuri.cs.pub.ro<BR>http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/pso</BLOCKQUOTE><p>
		<hr size=1><font face=arial size=-1>Do you Yahoo!?<br>Friends.  Fun. <a href="http://messenger.yahoo.com/">Try the all-new Yahoo! Messenger</a>
--0-775355323-1085935450=:88103--