T
The Dark Free Soul
Moin everybody.
I'm writing a little application to take confidence with socket raw and
tcp protocol over ipv4.
According to tcp protocol sequence number must be a 32bit log number.
I do this (code follows) to read the sequence number as argument of the
main and to assign the value to the tcp.seq:
/* i get argv[5] from main(argc, argv[]) */
unsigned long seqn;
seqn = atoi(argv[5]);
/* in tcp header tcp.seq is a u_int32_t
* then i use htonl() to transform it to u_int32_t */
tcp.seq = htonl(seqn);
Then i build the tcp/ip packet and send it to my localhost. Sniffing
the packet with a network sniffer (ethereal or tcpdump) i see my
packet, everything is ok but the sequence number is completly wrong
(and terribly big, value "1" become comes around 36000000 or more).
I can't figure out where i'm wrong.
Many many thanks in advance to everybody will reply me.
I'm writing a little application to take confidence with socket raw and
tcp protocol over ipv4.
According to tcp protocol sequence number must be a 32bit log number.
I do this (code follows) to read the sequence number as argument of the
main and to assign the value to the tcp.seq:
/* i get argv[5] from main(argc, argv[]) */
unsigned long seqn;
seqn = atoi(argv[5]);
/* in tcp header tcp.seq is a u_int32_t
* then i use htonl() to transform it to u_int32_t */
tcp.seq = htonl(seqn);
Then i build the tcp/ip packet and send it to my localhost. Sniffing
the packet with a network sniffer (ethereal or tcpdump) i see my
packet, everything is ok but the sequence number is completly wrong
(and terribly big, value "1" become comes around 36000000 or more).
I can't figure out where i'm wrong.
Many many thanks in advance to everybody will reply me.