aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/uapi/linux/if_tunnel.h1
-rw-r--r--net/ipv4/ip_tunnel.c13
2 files changed, 14 insertions, 0 deletions
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index 7c832afdfa94..280d9e092283 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -64,6 +64,7 @@ enum {
64enum tunnel_encap_types { 64enum tunnel_encap_types {
65 TUNNEL_ENCAP_NONE, 65 TUNNEL_ENCAP_NONE,
66 TUNNEL_ENCAP_FOU, 66 TUNNEL_ENCAP_FOU,
67 TUNNEL_ENCAP_GUE,
67}; 68};
68 69
69#define TUNNEL_ENCAP_FLAG_CSUM (1<<0) 70#define TUNNEL_ENCAP_FLAG_CSUM (1<<0)
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index d9c9dc4ffeaf..0bb8e141eacc 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -56,6 +56,7 @@
56#include <net/netns/generic.h> 56#include <net/netns/generic.h>
57#include <net/rtnetlink.h> 57#include <net/rtnetlink.h>
58#include <net/udp.h> 58#include <net/udp.h>
59#include <net/gue.h>
59 60
60#if IS_ENABLED(CONFIG_IPV6) 61#if IS_ENABLED(CONFIG_IPV6)
61#include <net/ipv6.h> 62#include <net/ipv6.h>
@@ -495,6 +496,8 @@ static int ip_encap_hlen(struct ip_tunnel_encap *e)
495 return 0; 496 return 0;
496 case TUNNEL_ENCAP_FOU: 497 case TUNNEL_ENCAP_FOU:
497 return sizeof(struct udphdr); 498 return sizeof(struct udphdr);
499 case TUNNEL_ENCAP_GUE:
500 return sizeof(struct udphdr) + sizeof(struct guehdr);
498 default: 501 default:
499 return -EINVAL; 502 return -EINVAL;
500 } 503 }
@@ -546,6 +549,15 @@ static int fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
546 skb_reset_transport_header(skb); 549 skb_reset_transport_header(skb);
547 uh = udp_hdr(skb); 550 uh = udp_hdr(skb);
548 551
552 if (e->type == TUNNEL_ENCAP_GUE) {
553 struct guehdr *guehdr = (struct guehdr *)&uh[1];
554
555 guehdr->version = 0;
556 guehdr->hlen = 0;
557 guehdr->flags = 0;
558 guehdr->next_hdr = *protocol;
559 }
560
549 uh->dest = e->dport; 561 uh->dest = e->dport;
550 uh->source = sport; 562 uh->source = sport;
551 uh->len = htons(skb->len); 563 uh->len = htons(skb->len);
@@ -565,6 +577,7 @@ int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t,
565 case TUNNEL_ENCAP_NONE: 577 case TUNNEL_ENCAP_NONE:
566 return 0; 578 return 0;
567 case TUNNEL_ENCAP_FOU: 579 case TUNNEL_ENCAP_FOU:
580 case TUNNEL_ENCAP_GUE:
568 return fou_build_header(skb, &t->encap, t->encap_hlen, 581 return fou_build_header(skb, &t->encap, t->encap_hlen,
569 protocol, fl4); 582 protocol, fl4);
570 default: 583 default: