function return type for enum roa

James lbz at rivensbane.com
Fri Oct 18 05:54:23 CEST 2024


Hello,


I tried to create a function that returns enum roa. However, I'm 
encountering difficulties specifying its return type.

```

function check_clearnet_roa() {
     case net.type {
         NET_IP4: return roa_check(clearnet_roa_v4, net, bgp_path.last);
         NET_IP6: return roa_check(clearnet_roa_v6, net, bgp_path.last);
         else: print "is_roa_invalid: ", "unexpected net.type ", 
net.type, " ", net; return ROA_UNKNOWN;
     }
}

```

If I use "-> enum roa" as return type, birdcl co ch will return 
"clearnet.conf:143:34 syntax error, unexpected CF_SYM_UNDEFINED".

If I use "-> 'enum roa'" as return type, birdcl co ch will return 
"clearnet.conf:143:39 Invalid character in apostrophed symbol".

If I don't specify its return type, bird issues the warning 
"clearnet.conf:145:71: Inferring function check_clearnet_roa return type 
from its return value: enum roa".


How should I correctly specify its return type?


Regards,

James

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3562 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20241018/944251a8/attachment.p7s>


More information about the Bird-users mailing list