Bug 1713449
| Summary: | Quagga computes wrong broadcast for /31 point-to-point RFC 3021 implementation | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Curtis Taylor <cutaylor> | ||||
| Component: | quagga | Assignee: | Michal Ruprich <mruprich> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | Daniel Rusek <drusek> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 7.6 | CC: | drusek, thozza | ||||
| Target Milestone: | rc | Keywords: | Patch, TestCaseProvided | ||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2019-08-06 15:30:28 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 1709724, 1716960 | ||||||
| Attachments: |
|
||||||
Hi.
I tried to reproduce the issue with BGP route not being propagated to the kernel routing table. I can reproduce the warning regarding broadcast address, but even with it, BGP routes are still exchanged just fine and propagated to the kernel routing table. I also tried RIP, which worked as well.
I tried the following scenario:
- two instances of zebra and bgpd running on the same system, but in different network namespaces (netns)
- veth device with each end put into different netns
- point-to-point IPv4 addresses with prefix /31 statically configured on each end of the veth device.
- using RPM quagga-0.99.22.4-5.el7_4.x86_64
"Server side" configuration (netns: "vns")
------------------------------------------
~~~
[root@localhost ~]# ip -n vns a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether 06:cb:ae:64:13:32 brd ff:ff:ff:ff:ff:ff
inet 192.168.155.1/24 scope global dummy1
valid_lft forever preferred_lft forever
inet6 fe80::4cb:aeff:fe64:1332/64 scope link
valid_lft forever preferred_lft forever
4: VNSIF@if3: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 82:f0:be:7f:3c:d8 brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet 192.168.100.240/31 brd 255.255.255.255 scope global VNSIF
valid_lft forever preferred_lft forever
inet6 fe80::80f0:beff:fe7f:3cd8/64 scope link
valid_lft forever preferred_lft forever
~~~
~~~
[root@localhost ~]# ip -n vns route
192.168.100.240/31 dev VNSIF proto kernel scope link src 192.168.100.240
192.168.155.0/24 dev dummy1 proto kernel scope link src 192.168.155.1
~~~
~~~
[root@localhost ~]# cat /etc/quagga/zebra-vns.conf
! -*- zebra -*-
!
! zebra configuration file
!
hostname RouterVNS
password zebra
enable password zebra
!
! Interface's description.
!
interface dummy1
link-detect
interface VNSIF
link-detect
debug zebra events
debug zebra kernel
log file /var/log/quagga/zebra-vns.log debugging
log syslog debugging
~~~
~~~
[root@localhost ~]# cat /etc/quagga/bgpd-vns.conf
! -*- bgp -*-
!
hostname bgpdVNS
password zebra
!
router bgp 7675
bgp router-id 192.168.100.240
network 0.0.0.0/0
network 192.168.155.0/24
neighbor 192.168.100.241 remote-as 7676
!
line vty
!
debug bgp events
debug bgp updates
debug bgp zebra
!
log syslog debugging
log file /var/log/quagga/bgpd-vns.log debugging
~~~
"Client side" configuration (netns: "vnc")
------------------------------------------
~~~
[root@localhost ~]# ip -n vnc a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: VNCIF@if4: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 0a:c0:3d:c3:e1:7d brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.100.241/31 brd 255.255.255.255 scope global VNCIF
valid_lft forever preferred_lft forever
inet6 fe80::8c0:3dff:fec3:e17d/64 scope link
valid_lft forever preferred_lft forever
~~~
~~~ (BEFORE DAEMONS ARE STARTED)
[root@localhost ~]# ip -n vnc route
192.168.100.240/31 dev VNCIF proto kernel scope link src 192.168.100.241
~~~
~~~
[root@localhost ~]# cat /etc/quagga/zebra-vnc.conf
! -*- zebra -*-
!
! zebra configuration file
!
hostname RouterVNC
password zebra
enable password zebra
!
! Interface's description.
!
interface VNCIF
link-detect
debug zebra events
debug zebra kernel
log file /var/log/quagga/zebra-vnc.log debugging
log syslog debugging
~~~
~~~
[root@localhost ~]# cat /etc/quagga/bgpd-vnc.conf
! -*- bgp -*-
!
hostname bgpdVNC
password zebra
!
router bgp 7676
bgp router-id 192.168.100.241
neighbor 192.168.100.240 remote-as 7675
neighbor 192.168.100.240 next-hop-self
!
line vty
!
debug bgp events
debug bgp updates
debug bgp zebra
!
log syslog debugging
log file /var/log/quagga/bgpd-vnc.log debugging
~~~
Scenario #1:
============
- point-to-point address on VNCIF is configured before the bgpd and zebra daemons are started
~~~ ("Client" side log after starting bgpd)
júl 30 12:50:16 localhost.localdomain systemd[1]: Starting GNU Zebra routing manager...
júl 30 12:50:17 localhost.localdomain zebra[2862]: Zebra 0.99.22.4 starting: vty@2601
júl 30 12:50:17 localhost.localdomain systemd[1]: Started GNU Zebra routing manager.
júl 30 12:50:17 localhost.localdomain systemd[1]: Starting BGP routing daemon...
júl 30 12:50:17 localhost.localdomain bgpd[2864]: BGPd 0.99.22.4 starting: vty@2605, bgp@<all>:179
júl 30 12:50:17 localhost.localdomain systemd[1]: Started BGP routing daemon.
júl 30 12:50:17 localhost.localdomain bgpd[2864]: Import timer expired.
júl 30 12:50:17 localhost.localdomain zebra[2862]: zebra message comes from socket [16]
júl 30 12:50:17 localhost.localdomain zebra[2862]: client 16 says hello and bids fair to announce only bgp routes
júl 30 12:50:17 localhost.localdomain zebra[2862]: zebra message comes from socket [16]
júl 30 12:50:17 localhost.localdomain zebra[2862]: zebra message comes from socket [16]
júl 30 12:50:17 localhost.localdomain bgpd[2864]: Zebra rcvd: router id update 192.168.100.241/32
júl 30 12:50:17 localhost.localdomain bgpd[2864]: Zebra rcvd: interface add VNCIF
júl 30 12:50:17 localhost.localdomain bgpd[2864]: Zebra rcvd: interface VNCIF address add 192.168.100.241/31
júl 30 12:50:17 localhost.localdomain bgpd[2864]: Zebra rcvd: interface VNCIF address add fe80::8c0:3dff:fec3:e17d/64
júl 30 12:50:17 localhost.localdomain bgpd[2864]: Zebra rcvd: interface add lo
júl 30 12:50:17 localhost.localdomain bgpd[2864]: Zebra rcvd: interface lo address add 127.0.0.1/8
júl 30 12:50:17 localhost.localdomain bgpd[2864]: Zebra rcvd: interface lo address add ::1/128
júl 30 12:50:24 localhost.localdomain bgpd[2864]: 192.168.100.240 [Event] Connect start to 192.168.100.240 fd 16
júl 30 12:50:25 localhost.localdomain bgpd[2864]: 192.168.100.240 rcvd UPDATE w/ attr: nexthop 192.168.100.240, origin i, metric 0, path 7675
júl 30 12:50:25 localhost.localdomain bgpd[2864]: 192.168.100.240 rcvd 0.0.0.0/0
júl 30 12:50:25 localhost.localdomain bgpd[2864]: 192.168.100.240 rcvd 192.168.155.0/24
júl 30 12:50:25 localhost.localdomain bgpd[2864]: Zebra send: IPv4 route add 0.0.0.0/0 nexthop 192.168.100.240 metric 0 count 1
júl 30 12:50:25 localhost.localdomain bgpd[2864]: Zebra send: IPv4 route add 192.168.155.0/24 nexthop 192.168.100.240 metric 0 count 1
júl 30 12:50:25 localhost.localdomain zebra[2862]: zebra message comes from socket [16]
júl 30 12:50:25 localhost.localdomain zebra[2862]: zebra message comes from socket [16]
júl 30 12:50:25 localhost.localdomain zebra[2862]: netlink_route_multipath() (single hop): RTM_NEWROUTE 0.0.0.0/0, type IPv4 nexthop
júl 30 12:50:25 localhost.localdomain zebra[2862]: netlink_route_multipath() (single hop): nexthop via 192.168.100.240 if 3
júl 30 12:50:25 localhost.localdomain zebra[2862]: netlink_talk: netlink-cmd type RTM_NEWROUTE(24), seq=6
júl 30 12:50:25 localhost.localdomain zebra[2862]: netlink_parse_info: netlink-cmd ACK: type=RTM_NEWROUTE(24), seq=6, pid=0
júl 30 12:50:25 localhost.localdomain zebra[2862]: netlink_route_multipath() (single hop): RTM_NEWROUTE 192.168.155.0/24, type IPv4 nexthop
júl 30 12:50:25 localhost.localdomain zebra[2862]: netlink_route_multipath() (single hop): nexthop via 192.168.100.240 if 3
júl 30 12:50:25 localhost.localdomain zebra[2862]: netlink_talk: netlink-cmd type RTM_NEWROUTE(24), seq=7
júl 30 12:50:25 localhost.localdomain zebra[2862]: netlink_parse_info: netlink-cmd ACK: type=RTM_NEWROUTE(24), seq=7, pid=0
~~~
~~~ ("Client" side after starting bgpd)
[root@localhost ~]# vtysh -c "show ip bgp"
BGP table version is 0, local router ID is 192.168.100.241
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0 192.168.100.240 0 0 7675 i
*> 192.168.155.0 192.168.100.240 0 0 7675 i
Total number of prefixes 2
~~~
~~~ ("Client" side after starting bgpd)
[root@localhost ~]# ip -n vnc route
default via 192.168.100.240 dev VNCIF proto zebra
192.168.100.240/31 dev VNCIF proto kernel scope link src 192.168.100.241
192.168.155.0/24 via 192.168.100.240 dev VNCIF proto zebra
~~~
Scenario #2:
============
- point-to-point address on VNCIF is NOT configured before the bgpd and zebra daemons are started
- once bgpd is running, the point-to-point address on VNCIF is configured
~~~ ("Client" side log after starting bgpd)
júl 30 13:01:54 localhost.localdomain systemd[1]: Starting GNU Zebra routing manager...
júl 30 13:01:54 localhost.localdomain zebra[2925]: Zebra 0.99.22.4 starting: vty@2601
júl 30 13:01:54 localhost.localdomain systemd[1]: Started GNU Zebra routing manager.
júl 30 13:01:54 localhost.localdomain systemd[1]: Starting BGP routing daemon...
júl 30 13:01:54 localhost.localdomain bgpd[2927]: BGPd 0.99.22.4 starting: vty@2605, bgp@<all>:179
júl 30 13:01:54 localhost.localdomain systemd[1]: Started BGP routing daemon.
júl 30 13:01:54 localhost.localdomain bgpd[2927]: Import timer expired.
júl 30 13:01:54 localhost.localdomain zebra[2925]: zebra message comes from socket [16]
júl 30 13:01:54 localhost.localdomain zebra[2925]: client 16 says hello and bids fair to announce only bgp routes
júl 30 13:01:54 localhost.localdomain zebra[2925]: zebra message comes from socket [16]
júl 30 13:01:54 localhost.localdomain zebra[2925]: zebra message comes from socket [16]
júl 30 13:01:54 localhost.localdomain bgpd[2927]: Zebra rcvd: router id update 0.0.0.0/32
júl 30 13:01:54 localhost.localdomain bgpd[2927]: Zebra rcvd: interface add VNCIF
júl 30 13:01:54 localhost.localdomain bgpd[2927]: Zebra rcvd: interface VNCIF address add fe80::8c0:3dff:fec3:e17d/64
júl 30 13:01:54 localhost.localdomain bgpd[2927]: Zebra rcvd: interface add lo
júl 30 13:01:54 localhost.localdomain bgpd[2927]: Zebra rcvd: interface lo address add 127.0.0.1/8
júl 30 13:01:54 localhost.localdomain bgpd[2927]: Zebra rcvd: interface lo address add ::1/128
júl 30 13:01:58 localhost.localdomain bgpd[2927]: 192.168.100.240 [Event] Connect start to 192.168.100.240 fd 16
júl 30 13:01:58 localhost.localdomain bgpd[2927]: can't connect to 192.168.100.240 fd 16 : Network is unreachable
júl 30 13:02:09 localhost.localdomain bgpd[2927]: Import timer expired.
júl 30 13:02:14 localhost.localdomain zebra[2925]: netlink_parse_info: netlink-listen type RTM_NEWADDR(20), seq=1564484535, pid=2928
júl 30 13:02:14 localhost.localdomain zebra[2925]: netlink_interface_addr RTM_NEWADDR VNCIF:
júl 30 13:02:14 localhost.localdomain zebra[2925]: IFA_LOCAL 192.168.100.241/31
júl 30 13:02:14 localhost.localdomain zebra[2925]: IFA_ADDRESS 192.168.100.241/31
júl 30 13:02:14 localhost.localdomain zebra[2925]: IFA_BROADCAST 255.255.255.255/31
júl 30 13:02:14 localhost.localdomain zebra[2925]: IFA_CACHEINFO pref -1, valid -1
júl 30 13:02:14 localhost.localdomain zebra[2925]: warning: interface VNCIF broadcast addr 255.255.255.255/31 != calculated 192.168.100.240, routing protocols may malfunction <--- WARNING
júl 30 13:02:14 localhost.localdomain zebra[2925]: MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD 192.168.100.241/31 on VNCIF
júl 30 13:02:14 localhost.localdomain zebra[2925]: netlink_parse_info: netlink-listen type RTM_NEWROUTE(24), seq=0, pid=0
júl 30 13:02:14 localhost.localdomain zebra[2925]: RTM_NEWROUTE ipv4 multicast proto kernel
júl 30 13:02:14 localhost.localdomain zebra[2925]: netlink_parse_info: netlink-listen type RTM_NEWROUTE(24), seq=0, pid=0
júl 30 13:02:14 localhost.localdomain zebra[2925]: RTM_NEWROUTE ipv4 unicast proto kernel
júl 30 13:02:14 localhost.localdomain bgpd[2927]: Zebra rcvd: router id update 192.168.100.241/32
júl 30 13:02:14 localhost.localdomain bgpd[2927]: Zebra rcvd: interface VNCIF address add 192.168.100.241/31
júl 30 13:02:24 localhost.localdomain bgpd[2927]: Import timer expired.
júl 30 13:02:39 localhost.localdomain bgpd[2927]: Import timer expired.
júl 30 13:02:54 localhost.localdomain bgpd[2927]: Performing BGP general scanning
júl 30 13:02:54 localhost.localdomain bgpd[2927]: scanning IPv4 Unicast routing tables
júl 30 13:02:54 localhost.localdomain bgpd[2927]: scanning IPv6 Unicast routing tables
júl 30 13:02:54 localhost.localdomain bgpd[2927]: Import timer expired.
júl 30 13:03:09 localhost.localdomain bgpd[2927]: Import timer expired.
júl 30 13:03:24 localhost.localdomain bgpd[2927]: Import timer expired.
júl 30 13:03:39 localhost.localdomain bgpd[2927]: Import timer expired.
júl 30 13:03:54 localhost.localdomain bgpd[2927]: Performing BGP general scanning
júl 30 13:03:54 localhost.localdomain bgpd[2927]: scanning IPv4 Unicast routing tables
júl 30 13:03:54 localhost.localdomain bgpd[2927]: scanning IPv6 Unicast routing tables
júl 30 13:03:54 localhost.localdomain bgpd[2927]: Import timer expired.
júl 30 13:03:58 localhost.localdomain bgpd[2927]: 192.168.100.240 [Event] Connect start to 192.168.100.240 fd 16
júl 30 13:03:59 localhost.localdomain bgpd[2927]: 192.168.100.240 rcvd UPDATE w/ attr: nexthop 192.168.100.240, origin i, metric 0, path 7675
júl 30 13:03:59 localhost.localdomain bgpd[2927]: 192.168.100.240 rcvd 0.0.0.0/0
júl 30 13:03:59 localhost.localdomain bgpd[2927]: 192.168.100.240 rcvd 192.168.155.0/24
júl 30 13:03:59 localhost.localdomain bgpd[2927]: Zebra send: IPv4 route add 0.0.0.0/0 nexthop 192.168.100.240 metric 0 count 1
júl 30 13:03:59 localhost.localdomain bgpd[2927]: Zebra send: IPv4 route add 192.168.155.0/24 nexthop 192.168.100.240 metric 0 count 1
júl 30 13:03:59 localhost.localdomain zebra[2925]: zebra message comes from socket [16]
júl 30 13:03:59 localhost.localdomain zebra[2925]: zebra message comes from socket [16]
júl 30 13:03:59 localhost.localdomain zebra[2925]: netlink_route_multipath() (single hop): RTM_NEWROUTE 0.0.0.0/0, type IPv4 nexthop
júl 30 13:03:59 localhost.localdomain zebra[2925]: netlink_route_multipath() (single hop): nexthop via 192.168.100.240 if 3
júl 30 13:03:59 localhost.localdomain zebra[2925]: netlink_talk: netlink-cmd type RTM_NEWROUTE(24), seq=6
júl 30 13:03:59 localhost.localdomain zebra[2925]: netlink_parse_info: netlink-cmd ACK: type=RTM_NEWROUTE(24), seq=6, pid=0
júl 30 13:03:59 localhost.localdomain zebra[2925]: netlink_route_multipath() (single hop): RTM_NEWROUTE 192.168.155.0/24, type IPv4 nexthop
júl 30 13:03:59 localhost.localdomain zebra[2925]: netlink_route_multipath() (single hop): nexthop via 192.168.100.240 if 3
júl 30 13:03:59 localhost.localdomain zebra[2925]: netlink_talk: netlink-cmd type RTM_NEWROUTE(24), seq=7
júl 30 13:03:59 localhost.localdomain zebra[2925]: netlink_parse_info: netlink-cmd ACK: type=RTM_NEWROUTE(24), seq=7, pid=0
júl 30 13:04:10 localhost.localdomain bgpd[2927]: Import timer expired.
~~~
~~~ ("Client" side after starting bgpd and after IP on VNCIF is configured)
[root@localhost ~]# vtysh -c "show ip bgp"
BGP table version is 0, local router ID is 192.168.100.241
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0 192.168.100.240 0 0 7675 i
*> 192.168.155.0 192.168.100.240 0 0 7675 i
Total number of prefixes 2
~~~
~~~ ("Client" side after starting bgpd and after IP on VNCIF is configured)
[root@localhost ~]# ip -n vnc route
default via 192.168.100.240 dev VNCIF proto zebra
192.168.100.240/31 dev VNCIF proto kernel scope link src 192.168.100.241
192.168.155.0/24 via 192.168.100.240 dev VNCIF proto zebra
~~~
Conclusion
==========
- While I acknowledge that the broadcast address in zebra for /31 prefix IPv4 addresses is not calculated according to RFC3021, its impact on BGP and RIP seems to be none, or at least I can not reproduce any issue with BGP or RIP caused by this bug.
- BGP routes are propagated to the kernel routing table without issues and I'm not able to reproduce the issue which is assumed to be caused by the problem with wrong broadcast address calculation for /31 prefix IPv4 addresses.
- While fixing the broadcast address calculation in upstream is definitely desirable, I don't think this is necessary a priority for RHEL-7, unless we can prove that it actually has real impct.
Questions
=========
1) Were we actually able to reproduce the issue (BGP routes not propagated to kernel routing table) internally? If yes, can we please get the description of the setup and configuration files OR access to the environment, where the issue is reproducible?
2) Any idea what may I been doing wrong in my setup and as a result not being able to reproduce the issue?
Created attachment 1595112 [details]
Patch for the calculation of broadcast address for /31 prefixes
Submitted patch to FRR (https://github.com/FRRouting/frr/pull/4773) and Quagga (will provide link later). The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days |
Description of problem: When using /31 bit netmask, quagga computes broadcast to be NETWORK instead of 255.255.255.255 as prescribed in RFC3021 Version-Release number of selected component (if applicable): quagga-0.99.22.4-5.el7 How reproducible: In environment with /31 bit point-to-point address, (i.e. network with 2 addresses, only .0 and .1 for host and router). Steps to Reproduce: 1. Setup system with point-to-point /31 network e.g. 192.168.100.240/31, host at 192.168.100.241, router at 192.168.100.240 2. Setup quagga/zebra/BGP (or RIP or etc) 3. BGP sees default route like: Network Next Hop Metric LocPrf Weight Path *> 0.0.0.0 192.168.122.240 500 0 65009 4771 4648 i Actual results: Default route does not get added to zebra, nor kernel routing table. Zebra.log reports: 2019/05/21 16:46:45 ZEBRA: warning: interface eth0 broadcast addr 255.255.255.255/31 != calculated 192.168.122.240, routing protocols may malfunction Expected results: Route is added to Zebra and kernel routing table. Additional info: Pertinent RFC 3021 excerpt: RFC3021 - Using 31 bit prefixes on ipv4 point-to-point links 2.3. Impact on Current Routing Protocols Networks with 31-bit prefixes have no impact on current routing protocols. Most of the currently deployed routing protocols have been designed to provide classless routing. Furthermore, the communication between peers is done using multicast, limited broadcast or unicast addresses (all on the local network), none of which are affected with the use of 31-bit subnet masks. ... 3.3. "Requirements for IP Version 4 Routers" [RFC1812] Section 4.2.2.11 (d) is replaced with: ... The following text is added to section 4.3.3.9: The 255.255.255.255 IP broadcast address MUST be used for broadcast Address Mask Replies in point-to-point links with 31-bit subnet masks Quagga explicitly makes Broadcast for 31 bit address (hostaddr ^ ~mask.s_addr) 192.168.122.241 ^ ~(255.255.255.255/31) = 192.168.122.240 200 /* Add connected IPv4 route to the interface. */ 201 void 202 connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr, 203 u_char prefixlen, struct in_addr *broad, 204 const char *label) 205 { ... 240 if (broad->s_addr != ipv4_broadcast_addr(addr->s_addr,prefixlen)) 241 { 242 char buf[2][INET_ADDRSTRLEN]; 243 struct in_addr bcalc; 244 bcalc.s_addr = ipv4_broadcast_addr(addr->s_addr,prefixlen); 245 zlog_warn("warning: interface %s broadcast addr %s/%d != " 246 "calculated %s, routing protocols may malfunction", 247 ifp->name, 248 inet_ntop (AF_INET, broad, buf[0], sizeof(buf[0])), 249 prefixlen, 250 inet_ntop (AF_INET, &bcalc, buf[1], sizeof(buf[1]))); 251 } 107 #define IPV4_MAX_PREFIXLEN 32 837 in_addr_t 838 ipv4_broadcast_addr (in_addr_t hostaddr, int masklen) 839 { 840 struct in_addr mask; 841 842 masklen2ip (masklen, &mask); 843 return (masklen != IPV4_MAX_PREFIXLEN-1) ? 844 /* normal case */ 845 (hostaddr | ~mask.s_addr) : 846 /* special case for /31 */ 847 (hostaddr ^ ~mask.s_addr); 848 } ipcalc determines the Broadcast to be 255.255.255.255 following RFC 3021 correctly: $ ipcalc -b -n 192.168.122.241/31 BROADCAST=255.255.255.255 NETWORK=192.168.122.240 initscripts : ipcacl does cacl_broadcast() and explicitly sets 255.255.255.255, as expected per RFC 3021 159 struct in_addr calc_broadcast(struct in_addr addr, int prefix) 160 { 161 struct in_addr mask = prefix2mask(prefix); 162 struct in_addr broadcast; 163 164 memset(&broadcast, 0, sizeof(broadcast)); 165 166 /* if prefix is set to 31 return 255.255.255.255 (RFC3021) */ 167 if (mask.s_addr == htonl(0xFFFFFFFE)) 168 broadcast.s_addr = htonl(0xFFFFFFFF); 169 else ...