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

sys/linux: add NDISC packet formats to vnet.txt #992

Merged
merged 1 commit into from
Feb 11, 2019

Conversation

dlrobertson
Copy link
Contributor

Add the basic NDISC (RFC 4861) packet formats to sys/linux/vnet.txt.

@dvyukov
Copy link
Collaborator

dvyukov commented Feb 11, 2019

Hi Dan,

While I am looking at the actual descriptions, you also need to generate *.const files, please see:
https://github.com/google/syzkaller/blob/master/docs/syscall_descriptions.md
In short:

make install_prerequisites
make extract SOURCEDIR=~/linux-next/checkout
make generate

and then add all changed files to this PR.

# https://tools.ietf.org/html/rfc4861#section-4.6
icmpv6_ndisc_option {
option_type flags[icmpv6_ndisc_option_types, int8]
length int8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look auto-formatted.
make generate will take care of formatting, or make format_sys will do it separately.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should be bytesize[data, int8]?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or bytesize[parent, int8]?

Copy link
Contributor Author

@dlrobertson dlrobertson Feb 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think bytesize8[data, int8bytesize8[parent, int8] is what we want. The length calculation for NDISC options is similar to that of the Hop-by-Hop options.

EDIT: s/data/parent/

type const[NDISC_NEIGHBOR_SOLICITATION, int8]
code const[0, int8]
csum csum[parent, pseudo, IPPROTO_ICMPV6, int16be]
unused int32
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's unused we could use const[0, int32]. Not that it's super important, but will fuzzer to not spend time mutating this a lot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 makes sense.

@dlrobertson dlrobertson force-pushed the add_ndisc_to_vnet branch 2 times, most recently from 7a2afb9 to 2c051f6 Compare February 11, 2019 15:28
@dlrobertson
Copy link
Contributor Author

@dvyukov thanks! Formatting etc now

Add the basic NDISC (RFC 4861) packet formats to sys/linux/vnet.txt.
@@ -339,6 +339,21 @@ NEXTHDR_ICMP = 58
NEXTHDR_MOBILITY = 135
NEXTHDR_NONE = 59
NEXTHDR_ROUTING = 43
ND_OPT_SOURCE_LL_ADDR = 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These constants are all just a single byte, so they'll be the same for all architectures regardless of endianness. Might be nice to add a vnet_any.const for constants like these?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files are all auto-generated, so there is no cost in that duplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dvyukov dvyukov merged commit 13f1d00 into google:master Feb 11, 2019
@dvyukov
Copy link
Collaborator

dvyukov commented Feb 11, 2019

There is a problem with go fmt -- it changed format in between 1.10 and 1.11 (golang/go#25161) which creates problems.
We currently use format as produced by Go 1.9 and 1.10. You seems to use 1.11. I will reformat it now, but please use version 1.10 next time, for details see:
https://github.com/google/syzkaller/blob/master/docs/contributing.md#how-to-create-a-pull-request

@dlrobertson
Copy link
Contributor Author

👍 yeah Gentoo uses 1.11.5.

@dlrobertson dlrobertson deleted the add_ndisc_to_vnet branch February 11, 2019 17:29
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

Successfully merging this pull request may close these issues.

2 participants