• Perl on_handshake(): @me contains no valid addresses

    From Oli@2:280/464.47 to All on Wed Sep 8 11:37:42 2021
    HELP! ;)
    I'm trying to use the @me array in on_handshake(), but no matter what I do I always get the error:

    "Perl on_handshake(): @me contains no valid addresses"

    even with this simple sub:

    sub on_handshake
    {
    @me;
    }

    + 08 Sep 09:45:26 [51014] incoming session with unknown
    - 08 Sep 09:45:27 [51014] VER binkd/1.1a-112/Linux binkp/1.1
    + 08 Sep 09:45:27 [51014] addr: 4000:1/1@testnet
    + 08 Sep 09:45:27 [51014] Perl on_handshake(): @me contains no valid addresses - 08 Sep 09:45:27 [51014] hiding aka 2000:1/2@fakenet

    Is this a bug or how do I use @me? The perlhooks documentation says

    5) on_handshake()
    - for server called after receiving remote addresses (before addr is sent)
    - best for hide_aka and present_aka logic :-)
    - return non-empty string to abort session with that reason
    otherwise, if @me is defined present @me as our akas


    The error message is from perlhooks.c

    if ((me = perl_get_av("me", FALSE)) != NULL) {
    FTN_ADDR addr;
    int n = 0, N = av_len(me) + 1;
    if (N > 0) state->pAddr = xalloc(N*sizeof(FTN_ADDR));
    for (i = 0; i < N; i++) {
    svp = av_fetch(me, i, FALSE);
    if (svp == NULL) continue;
    if (!parse_ftnaddress(SvPV(*svp, len), &addr, cfg->pDomains.first)) continue;
    exp_ftnaddress(&addr, cfg->pAddr, cfg->nAddr, cfg->pDomains.first);
    state->pAddr[n++] = addr;
    }
    state->nAddr = n;
    if (n == 0) Log(LL_WARN, "Perl on_handshake(): @me contains no valid addresses");
    }

    ---
    * Origin: 1995| Invention of the Cookie. The End. (2:280/464.47)
  • From Michael Dukelsky@2:5020/1042 to Oli on Wed Sep 8 17:44:36 2021
    Hello Oli,

    Wednesday September 08 2021, Oli wrote to All:

    HELP! ;)
    I'm trying to use the @me array in on_handshake(), but no matter what
    I do I always get the error:

    "Perl on_handshake(): @me contains no valid addresses"

    even with this simple sub:

    sub on_handshake
    {
    @me;
    }

    I've never used this hook but as far as I understand you have to put the AKAs you want to present to the @me array. The array in your sub contains no addresses, so you receive the error message.

    Michael

    ... node (at) f1042 (dot) ru
    --- GoldED+/LNX 1.1.5-b20180707
    * Origin: Moscow, Russia (2:5020/1042)
  • From Oli@2:280/464.47 to Michael Dukelsky on Wed Sep 8 16:43:13 2021
    Michael wrote (2021-09-08):

    HELP! ;)
    I'm trying to use the @me array in on_handshake(), but no matter
    what I do I always get the error:

    "Perl on_handshake(): @me contains no valid addresses"

    even with this simple sub:

    sub on_handshake
    {
    @me;
    }

    I've never used this hook but as far as I understand you have to put the AKAs you want to present to the @me array. The array in your sub contains no addresses, so you receive the error message.

    Hi Michael,

    your right. It does work when I use

    @me = ("5:6/7");

    I was sure I've already tried it like this. Maybe it was a typo, which I didn't see.

    I also thought the variable is pre-filled with the AKAs, like it is with $hosts etc. And then the unusual behavior of Perl confused me. I didn't expect that a variable can be created without explicit declaration or assignment. So Log(3, $me[0]) initialized an empty array @me. Most other languages would complain about an non existent variable.

    Thanks :)

    ---
    * Origin: 1995| Invention of the Cookie. The End. (2:280/464.47)
  • From Oli@2:280/464.47 to Michael Dukelsky on Thu Sep 9 09:00:25 2021
    Michael wrote (2021-09-08):

    Hello Oli,

    Wednesday September 08 2021, Oli wrote to All:

    HELP! ;)
    I'm trying to use the @me array in on_handshake(), but no matter
    what I do I always get the error:

    "Perl on_handshake(): @me contains no valid addresses"

    even with this simple sub:

    sub on_handshake
    {
    @me;
    }

    I've never used this hook but as far as I understand you have to put the AKAs you want to present to the @me array. The array in your sub contains no addresses, so you receive the error message.

    The side effects are a bit confusing:

    sub on_handshake
    {
    Log(3, "<<< on_handshake() >>>");
    }

    sub after_handshake
    {
    Log(3, "<<< after_handshake() >>> @me");
    }


    + 08:43 [1459] outgoing session with 127.0.0.1:24554
    - 08:43 [1459] <<< on_handshake() >>>
    + 08:43 [1459] Perl on_handshake(): @me contains no valid addresses
    - 08:43 [1459] OPT CRAM-MD5-fffdf8c077e8c9b94ce2e83d8da0a8ee
    [...]
    - 08:43 [1459] session in CRYPT mode
    - 08:43 [1459] <<< after_handshake() >>> 2000:1/2@fakenet 4000:1/1@testnet


    I'm not sure if this is considered to be expected behavior or a bug?

    ---
    * Origin: 1995| Invention of the Cookie. The End. (2:280/464.47)
  • From Michael Dukelsky@2:5020/1042 to Oli on Thu Sep 9 11:54:22 2021
    Hello Oli,

    Thursday September 09 2021, Oli wrote to Michael Dukelsky:

    HELP! ;)
    I'm trying to use the @me array in on_handshake(), but no matter
    what I do I always get the error:

    "Perl on_handshake(): @me contains no valid addresses"

    even with this simple sub:

    sub on_handshake
    {
    @me;
    }

    I've never used this hook but as far as I understand you have to
    put the AKAs you want to present to the @me array. The array in
    your sub contains no addresses, so you receive the error message.

    The side effects are a bit confusing:

    sub on_handshake
    {
    Log(3, "<<< on_handshake() >>>");
    }

    sub after_handshake
    {
    Log(3, "<<< after_handshake() >>> @me");
    }


    + 08:43 [1459] outgoing session with 127.0.0.1:24554
    - 08:43 [1459] <<< on_handshake() >>>
    + 08:43 [1459] Perl on_handshake(): @me contains no valid addresses
    - 08:43 [1459] OPT CRAM-MD5-fffdf8c077e8c9b94ce2e83d8da0a8ee
    [...]
    - 08:43 [1459] session in CRYPT mode
    - 08:43 [1459] <<< after_handshake() >>> 2000:1/2@fakenet
    4000:1/1@testnet


    I'm not sure if this is considered to be expected behavior or a bug?

    Well, from my POV the binkd behavior looks logical here. If you specified the values of the @me array, then only the AKA specified in that array would be presented. Since you did not specify any values in @me, binkd presented all of your AKAs during the handshake. In after_handshake() hook, you see the AKAs that were presented during the handshake.

    "Perl on_handshake(): @me contains no valid addresses" is here rather not an error message but a warning.

    Michael

    ... node (at) f1042 (dot) ru
    --- GoldED+/LNX 1.1.5-b20180707
    * Origin: Moscow, Russia (2:5020/1042)
  • From Oli@2:280/464.47 to Michael Dukelsky on Thu Sep 9 10:51:50 2021
    Michael wrote (2021-09-09):

    The side effects are a bit confusing:

    sub on_handshake
    {
    Log(3, "<<< on_handshake() >>>");
    }

    sub after_handshake
    {
    Log(3, "<<< after_handshake() >>> @me");
    }


    + 08:43 [1459] outgoing session with 127.0.0.1:24554
    - 08:43 [1459] <<< on_handshake() >>>
    + 08:43 [1459] Perl on_handshake(): @me contains no valid addresses
    - 08:43 [1459] OPT CRAM-MD5-fffdf8c077e8c9b94ce2e83d8da0a8ee
    [...]
    - 08:43 [1459] session in CRYPT mode
    - 08:43 [1459] <<< after_handshake() >>> 2000:1/2@fakenet
    4000:1/1@testnet


    I'm not sure if this is considered to be expected behavior or a
    bug?

    Well, from my POV the binkd behavior looks logical here. If you specified the values of the @me array, then only the AKA specified in that array would be presented. Since you did not specify any values in @me, binkd presented all of your AKAs during the handshake. In after_handshake() hook, you see the AKAs that were presented during the handshake.

    "Perl on_handshake(): @me contains no valid addresses" is here rather not an error message but a warning.


    What I find strange is that there is a warning message even if I don't use @me in on_handshake() at all. From my POV it would be more logical, if @me would already initialized with my AKAs and @me = () would let binkd send an "M_BSY: No AKAs in common domains or all AKAs are busy".

    Anyway, even if the warning is more confusing than helping, it does work and it can be ignored.

    ---
    * Origin: 1995| Invention of the Cookie. The End. (2:280/464.47)
  • From Björn Felten@2:203/2 to Paul Hayton on Wed Jan 12 09:35:36 2022
    Hey Paul, if your editor supports comment linking, here's the start of an interesting exchange of messages regarding Perl hooks.

    If it does not, you have the date and time, it started, below. Maybe that can help you find the chain, 140 messages ago.

    Oli -> All wrote 2021-09-08 12:37:

    HELP! ;)
    I'm trying to use the @me array in on_handshake(), but no matter what I
    do I always get the error:

    "Perl on_handshake(): @me contains no valid addresses"

    even with this simple sub:

    sub on_handshake
    {
    @me;
    }

    + 08 Sep 09:45:26 [51014] incoming session with unknown
    - 08 Sep 09:45:27 [51014] VER binkd/1.1a-112/Linux binkp/1.1
    + 08 Sep 09:45:27 [51014] addr: 4000:1/1@testnet
    + 08 Sep 09:45:27 [51014] Perl on_handshake(): @me contains no valid addresses
    - 08 Sep 09:45:27 [51014] hiding aka 2000:1/2@fakenet

    Is this a bug or how do I use @me? The perlhooks documentation says

    5) on_handshake()
    - for server called after receiving remote addresses (before addr is sent) - best for hide_aka and present_aka logic :-)
    - return non-empty string to abort session with that reason
    otherwise, if @me is defined present @me as our akas


    The error message is from perlhooks.c

    if ((me = perl_get_av("me", FALSE)) != NULL) {
    FTN_ADDR addr;
    int n = 0, N = av_len(me) + 1;
    if (N > 0) state->pAddr = xalloc(N*sizeof(FTN_ADDR));
    for (i = 0; i < N; i++) {
    svp = av_fetch(me, i, FALSE);
    if (svp == NULL) continue;
    if (!parse_ftnaddress(SvPV(*svp, len), &addr, cfg->pDomains.first)) continue;
    exp_ftnaddress(&addr, cfg->pAddr, cfg->nAddr, cfg->pDomains.first);
    state->> pAddr[n++] = addr;
    }
    state->> nAddr = n;
    if (n == 0) Log(LL_WARN, "Perl on_handshake(): @me contains no valid addresses");
    }

    ---
    * Origin: 1995| Invention of the Cookie. The End. (2:280/464.47)


    --




    ..

    --- Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.9.1.16) Gecko/20101125
    * Origin: news://eljaco.se (2:203/2)
  • From Paul Hayton@3:770/100 to Björn Felten on Thu Jan 13 10:14:35 2022
    On 12 Jan 2022 at 09:35a, Bjrn Felten pondered and said...

    Hey Paul, if your editor supports comment linking, here's the start of an interesting exchange of messages regarding Perl hooks.

    If it does not, you have the date and time, it started, below. Maybe that can help you find the chain, 140 messages ago.

    thank you :)

    --- Mystic BBS v1.12 A47 2021/11/06 (Linux/64)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (3:770/100)