Skip to contentSkip to conversation

Contribution - L2TPv3 - resubmit

Qemu-devel Anton Ivanov (antivano) 5 participants 6 messages Mar 5, 2014 Networking

lore
Share & tools
lore
#0 lore raw

Hi all,

This is a functional driver which will interoperate versus most L2TPv3 implementations. It cannot be split into smaller patches - this is an entire transport.

It will get one small incremental update at a later date. Some broken l2tpv3 implementations require a counter field but do not process it correctly so for them you need a special workaround - keep the counter field always at zero (this unfortunately includes at least some versions of the l2tpv3 stack in the linux kernel).

I believe I have addressed most comments so far. If I have missed something I apologize. The only one I cannot address is the possible mis-aligned access faults for header checks on platforms that may penalize it. I do not know the right qemu way of doing that.

Best Regards,

A.

net/Makefile.objs +1 -0
index 4854a14..160214e 100644
@@ -2,6 +2,7 @@ common-obj-y = net.o queue.o checksum.o util.o hub.o
 common-obj-y += socket.o
 common-obj-y += dump.o
 common-obj-y += eth.o
+common-obj-$(CONFIG_LINUX) += l2tpv3.o
 common-obj-$(CONFIG_POSIX) += tap.o
 common-obj-$(CONFIG_LINUX) += tap-linux.o
 common-obj-$(CONFIG_WIN32) += tap-win32.o
net/clients.h +2 -0
index 7793294..bbf177c 100644
@@ -47,6 +47,8 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
 int net_init_bridge(const NetClientOptions *opts, const char *name,
                     NetClientState *peer);
 
+int net_init_l2tpv3(const NetClientOptions *opts, const char *name,
+                    NetClientState *peer);
 #ifdef CONFIG_VDE
 int net_init_vde(const NetClientOptions *opts, const char *name,
                  NetClientState *peer);
net/l2tpv3.c new file +554 -0

554 lines not on this page · raw message

net/net.c +40 -0
index 0a88e68..ef40bfe 100644
@@ -132,6 +132,43 @@ int parse_host_port(struct sockaddr_in *saddr, const char *str)
     return 0;
 }
 
+int parse_host_port6(struct sockaddr_in6 *saddr, const char *str)
+{
+    char buf[512];
+    char *p, *ip, *port;
+
+    strncpy((char *) &buf, str, 511);
+    ip = (char *) &buf;
+    port = NULL;
+    int portint;
+
+
+    for (p = (char *) &buf; (p < (char *) &buf + strlen(str)) || (p < (char *) &buf + 512); p++){
+      if (*p == '[') {
+	 ip = p + 1;
+      }
+      if (*p == ']') {
+	 *p = '\0';
+        if (*(p + 1) == ':') {
+	    port = p + 2;
+	}
+	break;
+      }
+    } 
+
+    saddr->sin6_family = AF_INET6;
+    if (!inet_pton(AF_INET6, ip, &saddr->sin6_addr)) {
+         return -1;
+    } 
+    if (port) {
+      sscanf(port, "%i", &portint);
+      saddr->sin6_port = htons(portint);
+    }
+    return 0;
+}
+
+
+
 void qemu_format_nic_info_str(NetClientState *nc, uint8_t macaddr[6])
 {
     snprintf(nc->info_str, sizeof(nc->info_str),
@@ -731,6 +768,9 @@ static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
         [NET_CLIENT_OPTIONS_KIND_BRIDGE]    = net_init_bridge,
 #endif
         [NET_CLIENT_OPTIONS_KIND_HUBPORT]   = net_init_hubport,
+#ifdef CONFIG_LINUX
+        [NET_CLIENT_OPTIONS_KIND_L2TPV3]    = net_init_l2tpv3,
+#endif
 };
 
 
qapi-schema.json +55 -1

74 lines not on this page · raw message

#1 lore raw

Hi,

Am 05.03.2014 12:20, schrieb Anton Ivanov (antivano):

Quoted 3 lines

This is a functional driver which will interoperate versus most L2TPv3 implementations. It cannot be split into smaller patches - this is an entire transport.

[snip]

Please see http://wiki.qemu.org/Contribute/SubmitAPatch - in particular the patch should be sent as inline text rather than as attachment (so that we can comment inline on it), also it is missing a Signed-off-by (without it patches cannot get accepted) and the commit message should be suitable for committing. Any other text can go into a cover letter 0/1 or below --- line. You also forgot to CC the net maintainer.

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
Quoted 6 lines · Andreas Färber

Hi,

Am 05.03.2014 12:20, schrieb Anton Ivanov (antivano):

Quoted 3 lines

This is a functional driver which will interoperate versus most L2TPv3 implementations. It cannot be split into smaller patches - this is an entire transport.

Quoted 8 lines

[snip]

Please see http://wiki.qemu.org/Contribute/SubmitAPatch - in particular the patch should be sent as inline text rather than as attachment (so that we can comment inline on it), also it is missing a Signed-off-by (without it patches cannot get accepted) and the commit message should be suitable for committing. Any other text can go into a cover letter 0/1 or below --- line. You also forgot to CC the net maintainer.

Besides the guidelines on the wiki a quick tip:

Dry run git-send-email(1) by sending to your own email address first. Pick patch at random on the QEMU mailing list and compare whether the structure/style matches yours.

Once you're ready, send to [email protected] and CC [email protected], [email protected], [email protected], [email protected].

If you get stuck, feel free to hop on #qemu on irc.oftc.net and we can chat about how to configure git-send-email(1).

Stefan

#3 lore raw

ire transport.

Quoted 8 lines
Quoted 8 lines

[snip]

Please see http://wiki.qemu.org/Contribute/SubmitAPatch - in particular the patch should be sent as inline text rather than as attachment (so that we can comment inline on it), also it is missing a Signed-off-by (without it patches cannot get accepted) and the commit message should be suitable for committing. Any other text can go into a cover letter 0/1 or below --- line. You also forgot to CC the net maintainer.

Quoted 5 lines

Besides the guidelines on the wiki a quick tip:

Dry run git-send-email(1) by sending to your own email address first. Pick patch at random on the QEMU mailing list and compare whether the structure/style matches yours.

I tried :) It will not play nicely with a davmail + exchange combo (at least in my config). Throws all kind of weird and wonderful errors. At some point, I will look at it and fix it, but not today - it proved easier to get it to work versus my personal email server.

I just finished re-subscribing from my own address, a patch resubmission will follow shortly.

Quoted 4 lines

Once you're ready, send to [email protected] and CC [email protected], [email protected], [email protected], [email protected].

Thanks, will do shortly.

Quoted 3 lines

If you get stuck, feel free to hop on #qemu on irc.oftc.net and we can chat about how to configure git-send-email(1).

I unstuck myself by choosing not to use corporate infra for the official contribution sponsor which is not ideal. If I have the time I will look through the use of the perl smtp module in git-send and fix it.

A.

#4 lore raw
Quoted 3 lines · Anton Ivanov (antivano)

I unstuck myself by choosing not to use corporate infra for the official contribution sponsor which is not ideal. If I have the time I will look through the use of the perl smtp module in git-send and fix it.

Don't worry, git preserves the @cisco.com authorship even if you send it via a private email address. The important thing is that the git commit was made with your Cisco identity.

In the past I had issues with an SMTP server that used TLS but didn't do authentication. git-send-email(1) couldn't handle that and I had to hack the Perl script to skip the username/password part :(.

Anyway, what's the point of decentralized development if you're tied to centralized corporate infrastructure? :-)

Stefan

#5 lore raw
In reply to Anton Ivanov (antivano)
Quoted 4 lines · Anton Ivanov (antivano)

I tried :) It will not play nicely with a davmail + exchange combo (at least in my config). Throws all kind of weird and wonderful errors. At some point, I will look at it and fix it, but not today - it proved easier to get it to work versus my personal email server.

Yes, sending patchmail through Exchange servers is not recommended; they have a tendency to eat whitespace and otherwise mangle things.

thanks
-- PMM