Unverified Commit 2c07c966 by Christian Brauner Committed by GitHub

Merge pull request #2978 from tomponline/tp-ipvlan-mtu

network: Adds custom mtu support for ipvlan interfaces
parents 19a50320 006e135e
...@@ -478,6 +478,7 @@ static int instantiate_ipvlan(struct lxc_handler *handler, struct lxc_netdev *ne ...@@ -478,6 +478,7 @@ static int instantiate_ipvlan(struct lxc_handler *handler, struct lxc_netdev *ne
{ {
char peerbuf[IFNAMSIZ], *peer; char peerbuf[IFNAMSIZ], *peer;
int err; int err;
unsigned int mtu = 0;
if (netdev->link[0] == '\0') { if (netdev->link[0] == '\0') {
ERROR("No link for ipvlan network device specified"); ERROR("No link for ipvlan network device specified");
...@@ -504,6 +505,22 @@ static int instantiate_ipvlan(struct lxc_handler *handler, struct lxc_netdev *ne ...@@ -504,6 +505,22 @@ static int instantiate_ipvlan(struct lxc_handler *handler, struct lxc_netdev *ne
goto on_error; goto on_error;
} }
if (netdev->mtu) {
err = lxc_safe_uint(netdev->mtu, &mtu);
if (err < 0) {
errno = -err;
SYSERROR("Failed to parse mtu \"%s\" for interface \"%s\"", netdev->mtu, peer);
goto on_error;
}
err = lxc_netdev_set_mtu(peer, mtu);
if (err < 0) {
errno = -err;
SYSERROR("Failed to set mtu \"%s\" for interface \"%s\"", netdev->mtu, peer);
goto on_error;
}
}
if (netdev->upscript) { if (netdev->upscript) {
char *argv[] = { char *argv[] = {
"ipvlan", "ipvlan",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment