IPv4 - no subnet mask information in the IP header
It is interesting to note that when IPv4 is employed on a network, there is actually no need for any subnet mask information to appear within the IP header.
The information provided by the subnet mask is found only as a network parameter configured on the network interface of each device. The subnet mask is used by host devices and routing devices to determine which networks particular IP addresses (such as those configured on the interfaces and those encountered in the headers of IP packets) belong to.
The subnet mask configured on a router’s interfaces allows a router to determine the networks (IP address ranges) that its interfaces are connected to. Using that information, it can correctly build the routing table with its directly connected networks.
Similarly, a host uses its subnet mask to determine if the destination address in the IP header of a packet it is about to send is in its own subnet or in a different subnet. In the former case it sends it directly to the destination host, and in the latter case it will direct the packet to the default gateway.
Subnet information therefore is unnecessary in the header of the IP packet.
Links
https://forum.networklessons.com/t/ipv4-packet-header/1271/65?u=lagapides