2002-02-18 10:55:04

by Xinwen Fu

[permalink] [raw]
Subject: weird ip sequence number

Hi,
Really weird!

I have two linux machines with kernel 2.4.17. When I ping one
machine from the other machine, all the ping request ip packets have the
same sequnce number 0. The ping reply packets have different ip
sequence numbers. Moreover, when I send udp packets using general
socket programming, all the udp packets have the same sequence number 0.

I use ethereal to check the packets.

What's the problem?

Thanks!



Xinwen Fu



2002-02-18 19:42:29

by Xinwen Fu

[permalink] [raw]
Subject: want ip identification enabled

Hi,
Now I get that on some OS, for UDP and ICMP packets, the ip
identification fields are not set.

But I want that every packet has an id. Is there any emthod to get
the current system glocal variable "ip_id" and change it or
enable UDP and ICMP ip identification number somewhere?

Thanks!

Xinwen Fu


On Mon, 18 Feb 2002, Xinwen - Fu wrote:

> Hi,
> Really weird!
>
> I have two linux machines with kernel 2.4.17. When I ping one
> machine from the other machine, all the ping request ip packets have the
> same sequnce number 0. The ping reply packets have different ip
> sequence numbers. Moreover, when I send udp packets using general
> socket programming, all the udp packets have the same sequence number 0.
>
> I use ethereal to check the packets.
>
> What's the problem?
>
> Thanks!
>
>
>
> Xinwen Fu
>
>
>

2002-02-18 19:47:29

by Alan

[permalink] [raw]
Subject: Re: want ip identification enabled

> Now I get that on some OS, for UDP and ICMP packets, the ip
> identification fields are not set.
>
> But I want that every packet has an id. Is there any emthod to get
> the current system glocal variable "ip_id" and change it or
> enable UDP and ICMP ip identification number somewhere?

IP id is only required on packets that do not have the dont fragment flag
set. Don't rely on it for anything else.


Alan

2002-02-18 20:06:00

by Richard B. Johnson

[permalink] [raw]
Subject: Re: weird ip sequence number

On Mon, 18 Feb 2002, Xinwen - Fu wrote:

> Hi,
> Really weird!
>
> I have two linux machines with kernel 2.4.17. When I ping one
> machine from the other machine, all the ping request ip packets have the
> same sequnce number 0. The ping reply packets have different ip
> sequence numbers. Moreover, when I send udp packets using general
> socket programming, all the udp packets have the same sequence number 0.
>
> I use ethereal to check the packets.
>
> What's the problem?
>
> Thanks!
>

The sequence numbers for 'ping' come from ping. They are not generated
by the kernel.

`strace` [snipped]
sendto(3, "\10\0\335\360\360T\0\0@^q<\202\34\v\0\10\t\n\v\f\r\16\17"...,
|________ sequence NR

sendto(3, "\10\0\237\v\360T\1\0A^q<\277\1\v\0\10\t\n\v\f\r\16\17\20"...,
|___________ sequence NR


Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (797.90 BogoMips).

I was going to compile a list of innovations that could be
attributed to Microsoft. Once I realized that Ctrl-Alt-Del
was handled in the BIOS, I found that there aren't any.


2002-02-18 20:25:11

by Xinwen Fu

[permalink] [raw]
Subject: Re: weird ip sequence number

Richard,

>
> The sequence numbers for 'ping' come from ping. They are not generated
> by the kernel.
>
> `strace` [snipped]
> sendto(3, "\10\0\335\360\360T\0\0@^q<\202\34\v\0\10\t\n\v\f\r\16\17"...,
> |________ sequence NR
>
> sendto(3, "\10\0\237\v\360T\1\0A^q<\277\1\v\0\10\t\n\v\f\r\16\17\20"...,
> |___________ sequence NR

I want a true ip_id from the kernel and this id will not be used by
any other packet.

Although there are few chances that our randomly chosen ip_id collides
with the other packet's ip_id generated by kernel, I don't want this
possibility to happen.

So is there any method to get a true ip_id from the kernel?

I want this ip_id to do my own fragmentation on a packet.

Thanks!

Xinwen

2002-02-18 20:29:01

by Alan

[permalink] [raw]
Subject: Re: weird ip sequence number

> Although there are few chances that our randomly chosen ip_id collides
> with the other packet's ip_id generated by kernel, I don't want this
> possibility to happen.

So pick one at random. However its a pretty strange way to abuse IP.

> So is there any method to get a true ip_id from the kernel?
> I want this ip_id to do my own fragmentation on a packet.

Linux does not generate ip idents on DF frames. You can't fragment a DF
frame anyway so the problem does not arrive. Frames without DF get assigned
ip ids

2002-02-18 22:47:18

by Markus Schaber

[permalink] [raw]
Subject: Re: weird ip sequence number

Hi,

Alan Cox wrote:

> > Although there are few chances that our randomly chosen ip_id
> > collides with the other packet's ip_id generated by kernel, I don't
> > want this possibility to happen.
>
> So pick one at random. However its a pretty strange way to abuse IP.

And be shure that - according to the standards - the ID/protocol pair should be unique, that means every IP protocol (udp/tcp/icmp/etc...) can have his own, independent ID generation.

> > So is there any method to get a true ip_id from the kernel?
> > I want this ip_id to do my own fragmentation on a packet.
> Linux does not generate ip idents on DF frames. You can't fragment a
> DF frame anyway so the problem does not arrive. Frames without DF get
> assigned ip ids

I think the OP has some conceptual misunderstanding here. The IP IDs are considered "internal", this means not visible to upper layer protocols.

As soon as an user of IP wants to do his own fragmentation for user data, he/she/it should use his own packet or data ID numbers (as e. G. TCP does with the sequence number, or the ping with the included sequence number).

Markus

--
"GPL software is not free - the cost is cooperation"