]> git.puffer.fish Git - matthieu/frr.git/commit
bgpd: Use IEEE-754 Floating Point for storing extcommunity bandwidth
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Tue, 24 Aug 2021 07:58:20 +0000 (10:58 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Sun, 29 Aug 2021 18:10:27 +0000 (21:10 +0300)
commit8bcaad3dedcacab1cc7fdf9914d538427d497db8
tree72359452c599cc16aeb280a8738fb87379e41fa6
parent26bf593efba77bebd3c6dbfab2d9ac8542d039be
bgpd: Use IEEE-754 Floating Point for storing extcommunity bandwidth

https://datatracker.ietf.org/doc/html/draft-ietf-idr-link-bandwidth-07 says:

The bandwidth of the link is expressed as 4
   octets in IEEE floating point format, units being bytes (not bits!)
   per second.  It is carried in the Local Administrator subfield of the
   Value Field.

Before:

```
  Extended Community (16), length: 8, Flags [OT]:
    unknown extd community typecode (0x0004), Flags [none]
      0x0000:  0004 fdeb 0001 e848
    0x0000:  0004 fdeb 0001 e848
  Updated routes:
    172.16.16.1/32
```

0001 e848 - means 125000 (1Mbps), which is encoded incorrect.

After:

```
  Extended Community (16), length: 8, Flags [OT]:
    unknown extd community typecode (0x0004), Flags [none]
      0x0000:  0004 fdeb 47f4 2400
    0x0000:  0004 fdeb 47f4 2400
  Updated routes:
    172.16.16.1/32
```

47f4 2400 - means the same, but in floating point format.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
bgpd/bgp_ecommunity.c
bgpd/bgp_ecommunity.h