Where is ip padding insert in ip data-gram format,
after payload?
Best Answer
The only possible padding in an IPv4 packet would be in the header after any options. IPv4 options really are not used any longer, but if there are any options, the header must be padded to be sure that it ends on a 32-bit boundary. There is no payload padding because IPv4 simply doesn't care what is in the payload.
The internet header padding is used to ensure that the internet header
ends on a 32 bit boundary. The padding is zero.
-and-
The options might not end on a 32-bit boundary. The internet header
must be filled out with octets of zeros. The first of these would be
interpreted as the end-of-options option, and the remainder as
internet header padding.
-and-
Padding
The internet header Padding field is used to ensure that the data
begins on 32 bit word boundary. The padding is zero.
AS for point 1. well, maybe you could craft a IP header which check sum result would be 1, looking at the algorithm used (which is described in the RFC you linked), but if you expect somebody to do it for you, good luck...
Regarding point 2. you have to look at RFC2119 where it is said :
MAY This word, or the adjective "OPTIONAL", mean that an item is
truly optional. One vendor may choose to include the item because a
particular marketplace requires it or because the vendor feels that
it enhances the product while another vendor may omit the same item.
An implementation which does not include a particular option MUST be
prepared to interoperate with another implementation which does
include the option, though perhaps with reduced functionality. In the
same vein an implementation which does include a particular option
MUST be prepared to interoperate with another implementation which
does not include the option (except, of course, for the feature the
option provides.)
So it is up to the person that implement its version of an IP stack to decide which errors are reported or not. I have no idea if someone ever wrote an IPv4 stack with checksum error reporting trough ICMP but I doubt it.
My understanding is that if a checksum is bad, the packet should be dropped, and that's all. Re-transmission will be managed by upper layer if needed (generally by TCP).
There is much controversy about which protocols run at which layers in the models. Understand that the models, e.g. OSI Model, are just models, and the real world is often different.
There are people on both sides of ICMP layer placement. Remember that Wikipedia is maintained by everyone, including you. If you disagree with what is in an article, you are free to change it, or add something explaining why it should be a layer-4 protocol.
There are also other sources you should consult. In the end, you make up your own mind about where you think it belongs.
Best Answer
The only possible padding in an IPv4 packet would be in the header after any options. IPv4 options really are not used any longer, but if there are any options, the header must be padded to be sure that it ends on a 32-bit boundary. There is no payload padding because IPv4 simply doesn't care what is in the payload.
This is all explained in RFC 791, Internet Protocol:
-and-
-and-
-and-