Skip to content

networkd: Introduce geneve GEneric NEtwork Virtualization Encapsulation#5752

Merged
poettering merged 3 commits intosystemd:masterfrom
ssahani:geneve
Apr 25, 2017
Merged

networkd: Introduce geneve GEneric NEtwork Virtualization Encapsulation#5752
poettering merged 3 commits intosystemd:masterfrom
ssahani:geneve

Conversation

@ssahani
Copy link
Copy Markdown
Contributor

@ssahani ssahani commented Apr 18, 2017

This work enables cration of geneve tunnel.

Copy link
Copy Markdown
Member

@poettering poettering left a comment

Choose a reason for hiding this comment

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

I don't really know what GENEVE is, hence I only did a superficial code review, and found a number of type issues. Please be more careful with the types: always use the right type the kernel expects, and define parsers that refuse anything outside of the allowed range.

I really hope you tested all of this...

GENEVE.Id, config_parse_uint32, 0, offsetof(Geneve, id)
GENEVE.Remote, config_parse_geneve_address, 0, offsetof(Geneve, remote)
GENEVE.TOS, config_parse_unsigned, 0, offsetof(Geneve, tos)
GENEVE.TTL, config_parse_unsigned, 0, offsetof(Geneve, ttl)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the man page you added says the range for this is 1-155 (is that true, isn't that a typo? should that be 255?). If so, then please add config_parse_geneve_ttl() or so, which ensures the value passed is in the right range.


v->dest_port = port;

return 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should really generalize this into a generic config_parse_ip_port() or so which is added to conf-parser.h, and then used wherever we parse IP ports, which I figure is a non-zero number of places already. Any chance you can make this happen and rework the users of parse_ip_port()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I am thinking of making it a separate patch.

struct Geneve {
NetDev meta;

uint64_t id;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hu? is this 32bit or 64bit? You aprse this with config_parse_uint32(), but define the type to be uint64_t... that looks very wrong..

union in_addr_union remote;

unsigned tos;
unsigned ttl;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the kernel accepts this as u8, hence this should have the type uint8_t here, too

</varlistentry>
<varlistentry>
<term><varname>TOS=</varname></term>
<listitem>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is this an integer? if so, say so. what's the valid range for it?

VXLAN.FlowLabel, config_parse_flow_label, 0, 0
GENEVE.Id, config_parse_uint32, 0, offsetof(Geneve, id)
GENEVE.Remote, config_parse_geneve_address, 0, offsetof(Geneve, remote)
GENEVE.TOS, config_parse_unsigned, 0, offsetof(Geneve, tos)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please use a proper parser function for this, and generate a parsing error log msg for invalid values


unsigned tos;
unsigned ttl;
unsigned flow_label;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the kernel wants this as uint32_t... please use the right type here too


union in_addr_union remote;

unsigned tos;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please use uint8_t here, if that's what the kernel expects

@poettering poettering added network reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks labels Apr 24, 2017
This work enables cration of geneve tunnel
return 0;
}

v->tos = f;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm, this function is entirely generic, and accepts all kinds of uint8_t, hence I think we should just introduce config_parse_uint8() or so as part of conf-parser.[ch], similar in style to the existing config_parse_uint16(), config_parse_uint32() and we have and use that.

@poettering
Copy link
Copy Markdown
Member

OK, looks good to me. But I'd really appreciate a follow-up commit that adds generic config_parse_uint8() and config_prase_ip_port() functions and uses then for this stuff and elsewhere, see comments.

@poettering poettering merged commit c6c6078 into systemd:master Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

network reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks

Development

Successfully merging this pull request may close these issues.

2 participants