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

Packet.tpSrc dies silently with invalid argument #10

Open
jcollard opened this issue Jan 22, 2015 · 4 comments
Open

Packet.tpSrc dies silently with invalid argument #10

jcollard opened this issue Jan 22, 2015 · 4 comments

Comments

@jcollard
Copy link

While working through the Frenetic tutorial (http://frenetic-lang.github.io/tutorials/OxMonitor/) I wrote the following:

let is_http_packet (pk : Packet.packet) : bool =
  Packet.tpSrc pk = 80 && Packet.nwProto pk = 6

When a packet pk would arrive without a valid port, the controller would exit silently without saying why it was exiting.

@jnfoster
Copy link
Member

Does it work if you add Packet.dlTyp = 0x800?

@jnfoster
Copy link
Member

The packet accessors do fail if certain dependencies are not satisfied. This was an explicit design decision vs. returning optional values.

@jcollard
Copy link
Author

It works if I change the order to the following:

  let is_http_packet (pk : Packet.packet) : bool =
    Packet.dlTyp pk = 0x800 && 
    Packet.nwProto pk = 6 && 
    Packet.tpSrc pk = 80

It is fine that it fails, that makes sense. It is that it fails silently. There is no message as to why it failed.

@jnfoster
Copy link
Member

Yes, that's a bug.

There is an exception thrown by tpSrc:
https://github.com/frenetic-lang/ocaml-packet/blob/master/lib/Packet.ml#L1112

And it should be caught and printed by the top-level Monitor in the Ox controller:
https://github.com/frenetic-lang/ox/blob/master/lib/OxStart.ml#L90

But evidently that's not happening...

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