Skip to content

Commit e277de5

Browse files
jessegrossdavem330
authored andcommitted
tunnels: Don't require remote endpoint or ID during creation.
Before lightweight tunnels existed, it really didn't make sense to create a tunnel that was not fully specified, such as without a destination IP address - the resulting packets would go nowhere. However, with lightweight tunnels, the opposite is true - it doesn't make sense to require this information when it will be provided later on by the route. This loosens the requirements for this information. An alternative would be to allow the relaxed version only when COLLECT_METADATA is enabled. However, since there are several variations on this theme (such as NBMA tunnels in GRE), just dropping the restrictions seems the most consistent across tunnels and with the existing configuration. CC: John Linville <linville@tuxdriver.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 740dbc2 commit e277de5

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

drivers/net/geneve.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -870,14 +870,14 @@ static int geneve_newlink(struct net *net, struct net_device *dev,
870870
__be16 dst_port = htons(GENEVE_UDP_PORT);
871871
__u8 ttl = 0, tos = 0;
872872
bool metadata = false;
873-
__be32 rem_addr;
874-
__u32 vni;
873+
__be32 rem_addr = 0;
874+
__u32 vni = 0;
875875

876-
if (!data[IFLA_GENEVE_ID] || !data[IFLA_GENEVE_REMOTE])
877-
return -EINVAL;
876+
if (data[IFLA_GENEVE_ID])
877+
vni = nla_get_u32(data[IFLA_GENEVE_ID]);
878878

879-
vni = nla_get_u32(data[IFLA_GENEVE_ID]);
880-
rem_addr = nla_get_in_addr(data[IFLA_GENEVE_REMOTE]);
879+
if (data[IFLA_GENEVE_REMOTE])
880+
rem_addr = nla_get_in_addr(data[IFLA_GENEVE_REMOTE]);
881881

882882
if (data[IFLA_GENEVE_TTL])
883883
ttl = nla_get_u8(data[IFLA_GENEVE_TTL]);

drivers/net/vxlan.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2745,11 +2745,10 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev,
27452745
struct vxlan_config conf;
27462746
int err;
27472747

2748-
if (!data[IFLA_VXLAN_ID])
2749-
return -EINVAL;
2750-
27512748
memset(&conf, 0, sizeof(conf));
2752-
conf.vni = nla_get_u32(data[IFLA_VXLAN_ID]);
2749+
2750+
if (data[IFLA_VXLAN_ID])
2751+
conf.vni = nla_get_u32(data[IFLA_VXLAN_ID]);
27532752

27542753
if (data[IFLA_VXLAN_GROUP]) {
27552754
conf.remote_ip.sin.sin_addr.s_addr = nla_get_in_addr(data[IFLA_VXLAN_GROUP]);

0 commit comments

Comments
 (0)