But it seems that your problem is not exactly with signedness, but with overflow (instead of saturation). Overflow works also the same for signed and unsigned ones.
I thought about this some time ago and probably the best solution would be to switch BIRD completely to unsigned behavior (as most route properties with 32bit ranage are defined as unsigned) in some major release.
It's good idea.
I tried a workaround below, but it fails to load bird.conf with a syntax error message.
bird> configure Reading configuration from /etc/bird.conf /etc/bird.conf, line 123: Number out of range
What version of BIRD do you use? In the current version, it loads just fine (when i fixed missing '}'). But the code does not do what you expect, even if the numeric operations (comparison) would be unsigned 32bit - in that case the condition 'bgp_med + 100< 4294967295' would be always satisfied.
I am using 1.3.4 on Debian/GNU Linux(64bit).
You can write the function like this:
function TEST() int n; { if (source = RTS_BGP) then { n = bgp_med + 100; if (n>= 0&& n< 100) then bgp_med = n; else bgp_med = 4294967295; }
uum..., It's strange. That fails on my environment. "bgp_med = 4294967295;" statement in line 93 also looks to fail. bird> configure Reading configuration from /etc/bird.conf /etc/bird.conf, line 93: Number out of range However, I've realized this as a workaround. function TEST() int n; { if (source = RTS_BGP ) then { if defined(bgp_med) then { n = bgp_med + 100; if (n >= 0 && n < 100) then bgp_med = 0 - 1; else bgp_med = n; } else { bgp_med = 100; } } return true; } Any comments? Thanks, Eiichiro -- ################################################### Eiichiro Watanabe Internet Multifeed Co.