Skip to contentSkip to conversation

struct ip vs struct iphdr

DISCUSSION Oleg 3 participants 5 messages May 4, 2017 – May 5, 2017

Subsystems (2)
lore
Share & tools
lore

Oleg

author
#0 lore raw

Hi, all.

It seems struct ip and struct iphdr are similar: struct ip, despite of it name, doesn't contain anything but ip header.

So, my noob question, what is the difference between them?

Thanks.

Signature · 1 line
Олег Неманов (Oleg Nemanov)
#1 lore raw
Quoted 9 lines · Oleg

Hi, all.

It seems struct ip and struct iphdr are similar: struct ip, despite of it name, doesn't contain anything but ip header.

So, my noob question, what is the difference between them?

Thanks.

BSD vs linux?

struct ip is a BSD-ism, intended to be used if you were porting some BSD app.

--Sowmini

author
#2 lore raw
In reply to Sowmini Varadhan
Quoted 4 lines · Sowmini Varadhan

BSD vs linux?

struct ip is a BSD-ism, intended to be used if you were porting some BSD app.

Thanks!

Signature · 1 line
Олег Неманов (Oleg Nemanov)
author
#4 lore raw
In reply to Girish Moodalbail
Quoted 3 lines · Girish Moodalbail

Also, see this:

http://stackoverflow.com/questions/42840636/difference-between-struct-ip-and-struct-iphdr

I saw this. But the answer say that struct ip and struct iphdr defined in
different places. However i see struct iphdr together with struct ip in my netinet/ip.h. So, i thought that this answer may be inexact or incorrect.

Thanks!

Signature · 1 line
Олег Неманов (Oleg Nemanov)