[pso] [tema4][linux]citire porturi

Catalin Morosan cercetasu2003 at yahoo.com
Sat May 26 21:53:18 EEST 2007


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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cursuri.cs.pub.ro/pipermail/pso/attachments/20070526/6c136738/attachment.html


More information about the pso mailing list