Skip to content

Commit

Permalink
add MPTCP backup capabilities
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Detal <[email protected]>
Signed-off-by: Christoph Paasch <[email protected]>
Signed-off-by: Matthieu Baerts <[email protected]>
  • Loading branch information
Gregory Detal authored and matttbe committed Jan 13, 2015
1 parent 2e0e139 commit 79e0b20
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/linux/if.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#define IFF_ECHO 0x40000 /* echo sent packets */

#define IFF_NOMULTIPATH 0x80000 /* Disable for MPTCP */
#define IFF_MPBACKUP 0x100000 /* Use as backup path for MPTCP */

#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
Expand Down
1 change: 1 addition & 0 deletions ip/ipaddress.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ void print_link_flags(FILE *fp, unsigned flags, unsigned mdown)
_PF(POINTOPOINT);
_PF(MULTICAST);
_PF(NOMULTIPATH);
_PF(MPBACKUP);
_PF(NOARP);
_PF(ALLMULTI);
_PF(PROMISC);
Expand Down
8 changes: 7 additions & 1 deletion ip/iplink.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void iplink_usage(void)
fprintf(stderr, " [ dynamic { on | off } ]\n");
fprintf(stderr, " [ multicast { on | off } ]\n");
fprintf(stderr, " [ allmulticast { on | off } ]\n");
fprintf(stderr, " [ multipath { on | off } ]\n");
fprintf(stderr, " [ multipath { on | off | backup } ]\n");
fprintf(stderr, " [ promisc { on | off } ]\n");
fprintf(stderr, " [ trailers { on | off } ]\n");
fprintf(stderr, " [ txqueuelen PACKETS ]\n");
Expand Down Expand Up @@ -357,10 +357,13 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
} else if (strcmp(*argv, "multipath") == 0) {
NEXT_ARG();
req->i.ifi_change |= IFF_NOMULTIPATH;
req->i.ifi_change |= IFF_MPBACKUP;
if (strcmp(*argv, "on") == 0) {
req->i.ifi_flags &= ~IFF_NOMULTIPATH;
} else if (strcmp(*argv, "off") == 0) {
req->i.ifi_flags |= IFF_NOMULTIPATH;
} else if (strcmp(*argv, "backup") == 0) {
req->i.ifi_flags |= IFF_MPBACKUP;
} else
return on_off("multipath");
} else if (strcmp(*argv, "promisc") == 0) {
Expand Down Expand Up @@ -854,10 +857,13 @@ static int do_set(int argc, char **argv)
} else if (strcmp(*argv, "multipath") == 0) {
NEXT_ARG();
mask |= IFF_NOMULTIPATH;
mask |= IFF_MPBACKUP;
if (strcmp(*argv, "on") == 0) {
flags &= ~IFF_NOMULTIPATH;
} else if (strcmp(*argv, "off") == 0) {
flags |= IFF_NOMULTIPATH;
} else if (strcmp(*argv, "backup") == 0) {
flags |= IFF_MPBACKUP;
} else
return on_off("multipath");
} else if (strcmp(*argv, "promisc") == 0) {
Expand Down
4 changes: 2 additions & 2 deletions man/man8/ip-link.8
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ip-link \- network device configuration
.br
.BR multicast " { " on " | " off " } |"
.br
.BR multipath " { " on " | " off " } |"
.BR multipath " { " on " | " off " | " backup " } |"
.br
.B txqueuelen
.IR PACKETS " |"
Expand Down Expand Up @@ -214,7 +214,7 @@ flag on the device.
.BR "multipath on " or " multipath off"
change the
.B MULTIPATH
flag on the device, to enable or disable MPTCP.
flag on the device, to enable/disable MPTCP or use the device as backup.

.TP
.BR "dynamic on " or " dynamic off"
Expand Down

0 comments on commit 79e0b20

Please sign in to comment.