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

Incorrect type used for zone serial number. #1

Open
bartelsielski opened this issue Jul 16, 2018 · 3 comments
Open

Incorrect type used for zone serial number. #1

bartelsielski opened this issue Jul 16, 2018 · 3 comments

Comments

@bartelsielski
Copy link

The Serial field of the Zone struct is set to the incorrect type (int32, while it should be uint32).

According to RFC1035 section 3.3.13 the serial number of a SOA resource record is a 32 bit unsigned integer.

This causes the following error when the serial number is larger than 2^31-1:

json: cannot unmarshal number 3531147737 into Go struct field Zone.serial of type int32
@ffledgling
Copy link
Owner

Thank for finding and filing this bug. I've looked into it briefly and at first glance it appears that the fix for this is tricky, because the swagger spec (from which this library is generated - https://github.com/PowerDNS/pdns/blob/master/docs/http-api/swagger/authoritative-api-swagger.yaml) does not support the uint family of datatypes (https://swagger.io/docs/specification/data-models/data-types/). I'll try digging in a bit more to see if there's a work around.

@bartelsielski
Copy link
Author

Wouldn't it be possible to use the minimum and maximum keywords to limit it from 0 to 2^32-1?
The content of the swagger definition would then look like this:

serial:
  type: integer
  format: int64
  minimum: 0
  maximum: 4294967295
  description: 'The SOA serial number'
notified_serial:
  type: integer
  format: int64
  minimum: 0
  maximum: 4294967295
  description: 'The SOA serial notifications have been sent out for'

@ottoyiu
Copy link

ottoyiu commented Nov 19, 2018

we're also hitting this in production unfortunately :(

time="2018-11-19T21:45:39Z" level=debug msg="Unable to fetch zones json: cannot unmarshal number 4242695984 into Go struct field Zone.serial of type int32"
time="2018-11-19T21:45:39Z" level=debug msg="Retrying ListZones() ... 0"
time="2018-11-19T21:45:39Z" level=debug msg="Unable to fetch zones json: cannot unmarshal number 4242695984 into Go struct field Zone.serial of type int32"
time="2018-11-19T21:45:39Z" level=debug msg="Retrying ListZones() ... 1"
time="2018-11-19T21:45:40Z" level=debug msg="Unable to fetch zones json: cannot unmarshal number 4242695984 into Go struct field Zone.serial of type int32"
time="2018-11-19T21:45:40Z" level=debug msg="Retrying ListZones() ... 2"
time="2018-11-19T21:45:41Z" level=error msg="Unable to fetch zones. json: cannot unmarshal number 4242695984 into Go struct field Zone.serial of type int32"
time="2018-11-19T21:45:41Z" level=error msg="json: cannot unmarshal number 4242695984 into Go struct field Zone.serial of type int32"

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

3 participants