RFC 2132 defines both subnet mask and broadcast address option. Why there is a Broadcast Address Option (28) in dhcp protocol, when it can be calculated by a client, using subnet mask and ip address?
2 Answers
Because in days long forgotten, one could use the all-zeros address or the all-ones address for broadcast, so you had to tell systems which way each network leans. Today (and for about 30 years), everything uses the all-ones address.
You may be confusing modern IPv4 standards with older standards.
RFC 2132 "DHCP Options and BOOTP Vendor Extensions" section 5.3": Broadcast Address Option" says:
This option specifies the broadcast address in use on the client's subnet. Legal values for broadcast addresses are specified in section 3.2.1.3 of [4].
In this case, "[4]" refers to the document's fourth cited resource, STD 3, RFC 1122.
If we look at STD 3 RFC 1122 "Requirements for Internet Hosts - Communication Layers", page 66, we find:
Section 3.2.1.3 defined the four standard IP broadcast address forms:
Limited Broadcast: {-1, -1}
Directed Broadcast: {<Network-number>,-1}
Subnet Directed Broadcast: {,,-1}
All-Subnets Directed Broadcast: {<Network-number>,-1,-1}
A host MUST recognize any of these forms in the destination
address of an incoming datagram.
There is a class of hosts* that use non-standard broadcast
address forms, substituting 0 for -1. All hosts SHOULD
recognize and accept any of these non-standard broadcast
addresses as the destination address of an incoming datagram.
A host MAY optionally have a configuration option to choose the
0 or the -1 form of broadcast address, for each physical
interface, but this option SHOULD default to the standard (-1)
form.
*4.2BSD Unix and its derivatives, but not 4.3BSD.
(Quote slightly re-formatted from the RFC for easier reading, to remove the page break.)
The term "-1" refers to having all bits set to one, which is probably what you're used to from a Broadcast address. However, what this is saying is that 4.2 BSD systems used to use all zeroes as a broadcast address. Compatibility with this older standard is the most compelling technical reason I've found why we ban "network ID" addresses from being viewed as "usable" in IPv4.
The last (parenthesized) sentence of RFC 894 "A Standard for the Transmission of IP Datagrams over Ethernet Networks", page 2 says:
Unix 4.2bsd also uses a non-standard Internet broadcast address with a host part of all zeroes, this may also be changed in the future.
If we look at a newer RFC, from December 2000 (RFC 3021, which is newer than the older quoted RFC documents with lower RFC numbers) RFC 3021 "Using 31-Bit Prefixes on IPv4 Point-to-Point Links" says:
Broadcast and Network Addresses
There are several historically recognized broadcast addresses [RFC1812] on IP segments:
(a) the directed broadcast
{<Network-number>, -1}
{<Network-number>, 0}
The network address itself {<Network-number>, 0} is an
obsolete form of directed broadcast, but it may still be used
by older hosts.
So, while you might think that you can figure out the proper broadcast address based on the subnet size, that is likely because you were taught using newer standards. However, the older standards, recognized by December 2000 RFC 3021 and so certainly still recognized (by at least some people) in March 1997 (the publication date for RFC 2132, which is the RFC you asked about) specified multiple possible broadcast addresses that could be supported. An argument could be made that the proper broadcast address to use on a network is whatever standard the network has embraced (as specified by the network administrator). So, the authors of the "DHCP Options..." RFC were probably trying to make it so that their proposed protocol specifications could be effectively used, without problem, on such networks.