[pso] [tema4][linux]citire porturi

Mihaela mikela10000 at gmail.com
Sun May 27 00:45:47 EEST 2007


Prima regula care se adauga testeaza ca se pot adauga reguli si nu se  
trimit pachete pe portul ala,
doar daca se nimereste sa fie printre porturile alese random in testele  
urmatoare.





On Sat, 26 May 2007 21:53:18 +0300, Catalin Morosan  
<cercetasu2003 at yahoo.com> wrote:

> Salut.
>
> In hook-ul de in am asa ceva:
>
> struct sk_buff *sb = *skb;
> struct tcphdr *tcph = (struct tcphdr *) (sb -> data + iph -> ihl * 4);
> unsigned int port_src, port_dst;
> port_src = tcph -> source;
> port_dst = tcph -> dest;
> printk("port_src=%d", ntohs(port_src));
> printk("port_dst=%d", ntohs(port_dst));
>
> Problema e ca niciodata nu imi da la vreun port valoarea 22 care ar  
> trebui.. Adresele ip sunt corecte dar valorile pentru porturi sunt  
> aiurea.
> E ceva gresit cu codul de mai sus? Evident ca inainte verific uc iph ->  
> protocol == IPPROTO_TCP.
>
> Multumesc
>
>
>




More information about the pso mailing list