Skip to contentSkip to conversation

mptcp: fix compilation errors without IPV6

PATCH In review Matthieu Baerts 2 participants 8 messages Oct 17, 2019

Subsystems (2)
lore
Share & tools
lore

Matthieu Baerts

author
#0 lore raw

v2 cover mptcp: fix compilation errors without IPV6

I just checked the compilation without CONFIG_IPV6 and fixed what GCC was complaining about. Nothing fancy.

v2:
- fix coding style as suggested by Paolo
- drop "mptcp:basic: check for v6 family" (Peter)

Matthieu Baerts (4):
mptcp: fix compilation warning without IPV6
mptcp: fix compilation error without IPV6
mptcp:ipv6: fix code style
mptcp:ipv6: fix code style

 net/mptcp/basic.c   |  6 ++++--
 net/mptcp/options.c | 10 +++++++---
 net/mptcp/pm.c      |  4 +++-
 3 files changed, 14 insertions(+), 6 deletions(-)
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH v2 1/4 mptcp: fix compilation warning without IPV6

  net/mptcp/pm.c:228:23: warning: unused variable ‘addr6’ [-Wunused-variable]
    228 |  struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)saddr;
        |                       ^~~~~
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>

---

Notes:
To squash in "mptcp: Add path manager interface"

 net/mptcp/pm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/mptcp/pm.c +3 -1
index b14308ad11a3..f521bf0c5f69 100644
@@ -224,8 +224,10 @@ void mptcp_pm_add_addr6(struct mptcp_sock *msk, const struct in6_addr *addr,
 int mptcp_pm_addr_signal(struct mptcp_sock *msk, u8 *id,
 			 struct sockaddr_storage *saddr)
 {
-	struct sockaddr_in *addr = (struct sockaddr_in *)saddr;
+#if IS_ENABLED(CONFIG_IPV6)
 	struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)saddr;
+#endif
+	struct sockaddr_in *addr = (struct sockaddr_in *)saddr;
 
 	if (!msk->pm.local_valid)
 		return -1;
Signature · 1 line
2.20.1
author
#2 lore raw

PATCH v2 2/4 mptcp: fix compilation error without IPV6

In reply to Matthieu Baerts

net/mptcp/options.c: In function ‘mptcp_established_options_addr’:
net/mptcp/options.c:478:9: error: ‘struct mptcp_out_options’ has no member named ‘addr6’; did you mean ‘addr’?

    478 |   opts->addr6 = ((struct sockaddr_in6 *)&saddr)->sin6_addr;
        |         ^~~~~
        |         addr
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>

---

Notes:
To squash in "mptcp: Add ADD_ADDR handling"

 net/mptcp/options.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/mptcp/options.c +4 -1
index c948951509e1..0b5fd3985e86 100644
@@ -470,7 +470,9 @@ static bool mptcp_established_options_addr(struct sock *sk,
 		opts->addr_id = id;
 		opts->addr = ((struct sockaddr_in *)&saddr)->sin_addr;
 		*size = TCPOLEN_MPTCP_ADD_ADDR;
-	} else if (saddr.ss_family == AF_INET6) {
+	}
+#if IS_ENABLED(CONFIG_IPV6)
+	else if (saddr.ss_family == AF_INET6) {
 		if (remaining < TCPOLEN_MPTCP_ADD_ADDR6)
 			return false;
 		opts->suboptions |= OPTION_MPTCP_ADD_ADDR6;
@@ -478,6 +480,7 @@ static bool mptcp_established_options_addr(struct sock *sk,
 		opts->addr6 = ((struct sockaddr_in6 *)&saddr)->sin6_addr;
 		*size = TCPOLEN_MPTCP_ADD_ADDR6;
 	}
+#endif
 
 	msk->addr_signal = 0;
 
Signature · 1 line
2.20.1
author
#3 lore raw

PATCH v2 3/4 mptcp:ipv6: fix code style

In reply to Matthieu Baerts
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>

---

Notes:
To squash in "mptcp: Add ADD_ADDR handling"

 net/mptcp/options.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
net/mptcp/options.c +3 -2
index 0b5fd3985e86..a3bf62a6620a 100644
@@ -234,13 +234,14 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,
 			memcpy((u8 *)&mp_opt->addr.s_addr, (u8 *)ptr, 4);
 			pr_debug("ADD_ADDR: addr=%x, id=%d",
 				 mp_opt->addr.s_addr, mp_opt->addr_id);
+		}
 #if IS_ENABLED(CONFIG_IPV6)
-		} else {
+		else {
 			mp_opt->add_addr = 1;
 			memcpy(mp_opt->addr6.s6_addr, (u8 *)ptr, 16);
 			pr_debug("ADD_ADDR: addr6=, id=%d", mp_opt->addr_id);
-#endif
 		}
+#endif
 		break;
 
 	/* MPTCPOPT_RM_ADDR
Signature · 1 line
2.20.1
#4 lore raw

[MPTCP] Re: [PATCH v2 3/4] mptcp:ipv6: fix code style

Quoted 21 lines · Matthieu Baerts
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>

---

Notes:
To squash in "mptcp: Add ADD_ADDR handling"

 net/mptcp/options.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
net/mptcp/options.c +1 -1
index 0b5fd3985e86..a3bf62a6620a 100644
@@ -234,13 +234,14 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,
 			memcpy((u8 *)&mp_opt->addr.s_addr, (u8 *)ptr, 4);
 			pr_debug("ADD_ADDR: addr=%x, id=%d",
 				 mp_opt->addr.s_addr, mp_opt->addr_id);
+		}
 #if IS_ENABLED(CONFIG_IPV6)
-		} else {

net/mptcp/options.c void mptcp_parse_option(const unsigned char *ptr, int opsize, · line 247

Quoted 10 lines
net/mptcp/options.c +2 -1
+		else {
 			mp_opt->add_addr = 1;
 			memcpy(mp_opt->addr6.s6_addr, (u8 *)ptr, 16);
 			pr_debug("ADD_ADDR: addr6=, id=%d", mp_opt->addr_id);
-#endif
 		}
+#endif
 		break;
 
 	/* MPTCPOPT_RM_ADDR

I referred to this one, sorry for providing the wrong reference in the previous email. LGTM, thanks

/P

author
#5 lore raw

[MPTCP] Re: [PATCH v2 3/4] mptcp:ipv6: fix code style

Hi Paolo,

Quoted 31 lines · Paolo Abeni
Quoted 30 lines · Matthieu Baerts
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>

---

Notes:
To squash in "mptcp: Add ADD_ADDR handling"

  net/mptcp/options.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
net/mptcp/options.c +3 -2
index 0b5fd3985e86..a3bf62a6620a 100644
@@ -234,13 +234,14 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,
  			memcpy((u8 *)&mp_opt->addr.s_addr, (u8 *)ptr, 4);
  			pr_debug("ADD_ADDR: addr=%x, id=%d",
  				 mp_opt->addr.s_addr, mp_opt->addr_id);
+		}
  #if IS_ENABLED(CONFIG_IPV6)
-		} else {
+		else {
  			mp_opt->add_addr = 1;
  			memcpy(mp_opt->addr6.s6_addr, (u8 *)ptr, 16);
  			pr_debug("ADD_ADDR: addr6=, id=%d", mp_opt->addr_id);
-#endif
  		}
+#endif
  		break;
 
Quoted 4 lines

net/mptcp/options.c void mptcp_parse_option(const unsigned char *ptr, int opsize, · line 247

Quoted 1 line
net/mptcp/options.c +0 -0
  	/* MPTCPOPT_RM_ADDR

I referred to this one, sorry for providing the wrong reference in the previous email. LGTM, thanks

Thank you for the review!

- 0dbee5f41001: patch 3/4
- c8c058e39359: patch 4/4
- 54d4db3445c8: fix alignment

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
author
#6 lore raw

PATCH v2 4/4 mptcp:ipv6: fix code style

In reply to Matthieu Baerts
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>

---

Notes:
To squash in "mptcp: Add ADD_ADDR handling"

 net/mptcp/basic.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/mptcp/basic.c +4 -2
index 5520aae3a6e7..d2fd0560c136 100644
@@ -72,13 +72,15 @@ static int proc_parse_addr(struct ctl_table *ctl, int write,
 			snprintf(tmp, INET_ADDRSTRLEN, "%pI4",
 				 &pernet->announce_v4_addr);
 			tbl.data = tmp;
+		}
 #if IS_ENABLED(CONFIG_IPV6)
-		} else if (pernet->has_announce_v6) {
+		else if (pernet->has_announce_v6) {
 			snprintf(tmp, INET6_ADDRSTRLEN, "%pI6c",
 				 &pernet->announce_v6_addr);
 			tbl.data = tmp;
+		}
 #endif
-		} else {
+		else {
 			tbl.data = none;
 		}
 		tbl.maxlen = strlen(tbl.data);
Signature · 1 line
2.20.1
author
#7 lore raw
In reply to Matthieu Baerts

Hi Paolo,

Quoted 13 lines · Matthieu Baerts

I just checked the compilation without CONFIG_IPV6 and fixed what GCC was complaining about. Nothing fancy.

v2:
- fix coding style as suggested by Paolo
- drop "mptcp:basic: check for v6 family" (Peter)

Matthieu Baerts (4):
mptcp: fix compilation warning without IPV6
mptcp: fix compilation error without IPV6
mptcp:ipv6: fix code style
mptcp:ipv6: fix code style

Quoted 4 lines
  net/mptcp/basic.c   |  6 ++++--
  net/mptcp/options.c | 10 +++++++---
  net/mptcp/pm.c      |  4 +++-
  3 files changed, 14 insertions(+), 6 deletions(-)

I already applied the two first ones:

- 023e3e279137: "squashed" patch 1/4 in "mptcp: Add path manager interface"
- 93c165a10b9b: "squashed" patch 2/4 in "mptcp: Add ADD_ADDR handling"
- f3397e47be58..4f62a71b1a5c: results

Tests are in progress.

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium