Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "missing Origin-State-Id" whilst using diam/sm. #42

Closed
micrypt opened this issue Feb 1, 2016 · 8 comments
Closed

Error "missing Origin-State-Id" whilst using diam/sm. #42

micrypt opened this issue Feb 1, 2016 · 8 comments

Comments

@micrypt
Copy link
Contributor

micrypt commented Feb 1, 2016

Attempting to use state machine in a similar fashion as the client.go example, results in an error, missing Origin-State-Id. There's no clear way to update the handshake CER with the AVP in question in the case that it is indeed missing. A snippet from the application is below:

    smcli := &sm.Client{
        Dict:               dict.Default,
        Handler:            mux,
        MaxRetransmits:     3,
        RetransmitInterval: time.Second,
        EnableWatchdog:     true,
        WatchdogInterval:   5 * time.Second,
        AcctApplicationID: []*diam.AVP{diam.NewAVP(avp.AcctApplicationID, avp.Mbit, 0,
            AcctApplicationID),
        },
    }

    // Set message handlers.
    mux.HandleFunc("CCA", cl.ccaHandler)

    // Print error reports.
    go printErrors(mux.ErrorReports())

    connect := func() (diam.Conn, error) {
        c, err := smcli.Dial(serverAddress)
        cl.c = c
        return cl.c, err
    }
@micrypt micrypt changed the title Error missing Origin-State-Id whilst using diam/sm. Error "missing Origin-State-Id" whilst using diam/sm. Feb 1, 2016
@fiorix
Copy link
Owner

fiorix commented Feb 1, 2016

Sounds like the error you get is because the server you're connecting to does not respond with a CEA containing Origin-State-Id. Can you confirm that with a pcap?

@micrypt
Copy link
Contributor Author

micrypt commented Feb 1, 2016

@fiorix You're absolutely correct. It's sending back an error message (3099).

   DIAMETER_INVALID_AVP_BITS          3009
      A request was received that included an AVP whose flag bits are
      set to an unrecognized value, or that is inconsistent with the
      AVP's definition.

Might it be worthwhile to override the CER within the state machine's handshake(), and is there a way to do this?

@micrypt
Copy link
Contributor Author

micrypt commented Feb 2, 2016

@fiorix Curiously, the only way I've managed to get a valid CEA response thus far has been to completely remove the FirmwareRevision AVP.

https://github.com/fiorix/go-diameter/blob/master/diam/sm/client.go#L179

Would you be open to swapping out that line for the following, which also appears to work?
m.NewAVP(avp.FirmwareRevision, 0, 0, cli.Handler.cfg.FirmwareRevision)

@fiorix
Copy link
Owner

fiorix commented Feb 3, 2016

I see, the Firmware-Revision AVP is not mandatory but the state machine will always include it. We have to patch it and make this optional somehow. Not sure how I want this implemented, need to think about it. Can't do for e.g. if revision=0 does not include, but also don't want to add a boolean field to that struct. Ideas are welcome.

@fiorix
Copy link
Owner

fiorix commented Feb 3, 2016

Closing this in favor of #44.

@fiorix fiorix closed this as completed Feb 3, 2016
@micrypt
Copy link
Contributor Author

micrypt commented Feb 4, 2016

@fiorix Would you mind reopening this as it's not quite a fit with #44. It turns out the CEA truly doesn't include the Origin-State-Id AVP even when it is present in the CER. It responds with DIAMETER_SUCCESS but skips returning Origin-State-Id, at which point the state machine freaks outs. I suspect one ought to avoid throwing an error when it's not present in the answer. BTW, it does the same with the DWR/DWA cycle.

@fiorix fiorix reopened this Feb 4, 2016
@fiorix
Copy link
Owner

fiorix commented Feb 4, 2016

Sure

@fiorix
Copy link
Owner

fiorix commented Feb 6, 2016

Could you please try this dev branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants