Compare commits
16 Commits
d3f45d130e
...
e6791b5522
Author | SHA1 | Date |
---|---|---|
Zbigniew Jędrzejewski-Szmek | e6791b5522 | |
Zbigniew Jędrzejewski-Szmek | 7e8279c0a6 | |
Franck Bui | 0ef1adf512 | |
Yu Watanabe | 628f08b66d | |
Zbigniew Jędrzejewski-Szmek | d735e4f2d6 | |
Luca Boccassi | ed4512d009 | |
YmrDtnJu | a9c9b18a95 | |
Yu Watanabe | a8c10331b4 | |
Yu Watanabe | 5eec0a0810 | |
Yu Watanabe | d15818f227 | |
Yu Watanabe | 5ff1ef31f2 | |
Yu Watanabe | 97fdae33df | |
Yu Watanabe | 434a348380 | |
Yu Watanabe | 1498252614 | |
Daan De Meyer | e5f0010659 | |
Daan De Meyer | 172ad053ff |
|
@ -35,4 +35,5 @@ __pycache__/
|
||||||
/.mkosi-*
|
/.mkosi-*
|
||||||
/mkosi.builddir/
|
/mkosi.builddir/
|
||||||
/mkosi.output/
|
/mkosi.output/
|
||||||
|
/mkosi.default
|
||||||
/tags
|
/tags
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# Copyright © 2016 Zeal Jagannatha
|
# Copyright © 2016 Zeal Jagannatha
|
||||||
|
|
||||||
# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi).
|
# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi).
|
||||||
# Simply invoke "mkosi" in the project directory to build an OS image.
|
# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image.
|
||||||
|
|
||||||
[Distribution]
|
[Distribution]
|
||||||
Distribution=arch
|
Distribution=arch
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
|
||||||
# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi).
|
# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi).
|
||||||
# Simply invoke "mkosi" in the project directory to build an OS image.
|
# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image.
|
||||||
|
|
||||||
[Distribution]
|
[Distribution]
|
||||||
Distribution=debian
|
Distribution=debian
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
|
||||||
# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi).
|
# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi).
|
||||||
# Simply invoke "mkosi" in the project directory to build an OS image.
|
# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image.
|
||||||
|
|
||||||
[Distribution]
|
[Distribution]
|
||||||
Distribution=fedora
|
Distribution=fedora
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
|
||||||
# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi).
|
# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi).
|
||||||
# Simply invoke "mkosi" in the project directory to build an OS image.
|
# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image.
|
||||||
|
|
||||||
[Distribution]
|
[Distribution]
|
||||||
Distribution=opensuse
|
Distribution=opensuse
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
|
||||||
# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi).
|
# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi).
|
||||||
# Simply invoke "mkosi" in the project directory to build an OS image.
|
# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image.
|
||||||
|
|
||||||
[Distribution]
|
[Distribution]
|
||||||
Distribution=ubuntu
|
Distribution=ubuntu
|
||||||
|
|
|
@ -36,9 +36,12 @@ building clean OS images from an upstream distribution in combination with a
|
||||||
fresh build of the project in the local working directory. To make use of this,
|
fresh build of the project in the local working directory. To make use of this,
|
||||||
please acquire `mkosi` from https://github.com/systemd/mkosi first, unless your
|
please acquire `mkosi` from https://github.com/systemd/mkosi first, unless your
|
||||||
distribution has packaged it already and you can get it from there. After the
|
distribution has packaged it already and you can get it from there. After the
|
||||||
tool is installed it is sufficient to type `mkosi` in the systemd project
|
tool is installed, symlink the settings file for your distribution of choice from
|
||||||
directory to generate a disk image `image.raw` you can boot either in
|
.mkosi/ to mkosi.default in the project root directory (note that the package
|
||||||
`systemd-nspawn` or in an UEFI-capable VM:
|
manager for this distro needs to be installed on your host system). After doing
|
||||||
|
that, it is sufficient to type `mkosi` in the systemd project directory to
|
||||||
|
generate a disk image `image.raw` you can boot either in `systemd-nspawn` or in
|
||||||
|
an UEFI-capable VM:
|
||||||
|
|
||||||
```
|
```
|
||||||
# systemd-nspawn -bi image.raw
|
# systemd-nspawn -bi image.raw
|
||||||
|
@ -72,22 +75,23 @@ Putting this all together, here's a series of commands for preparing a patch
|
||||||
for systemd (this example is for Fedora):
|
for systemd (this example is for Fedora):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ sudo dnf builddep systemd # install build dependencies
|
$ sudo dnf builddep systemd # install build dependencies
|
||||||
$ sudo dnf install mkosi # install tool to quickly build images
|
$ sudo dnf install mkosi # install tool to quickly build images
|
||||||
$ git clone https://github.com/systemd/systemd.git
|
$ git clone https://github.com/systemd/systemd.git
|
||||||
$ cd systemd
|
$ cd systemd
|
||||||
$ vim src/core/main.c # or wherever you'd like to make your changes
|
$ vim src/core/main.c # or wherever you'd like to make your changes
|
||||||
$ meson build # configure the build
|
$ meson build # configure the build
|
||||||
$ ninja -C build # build it locally, see if everything compiles fine
|
$ ninja -C build # build it locally, see if everything compiles fine
|
||||||
$ ninja -C build test # run some simple regression tests
|
$ ninja -C build test # run some simple regression tests
|
||||||
$ (umask 077; echo 123 > mkosi.rootpw) # set root password used by mkosi
|
$ ln -s .mkosi/mkosi.fedora mkosi.default # Configure mkosi to build a fedora image
|
||||||
$ sudo mkosi # build a test image
|
$ (umask 077; echo 123 > mkosi.rootpw) # set root password used by mkosi
|
||||||
$ sudo systemd-nspawn -bi image.raw # boot up the test image
|
$ sudo mkosi # build a test image
|
||||||
$ git add -p # interactively put together your patch
|
$ sudo systemd-nspawn -bi image.raw # boot up the test image
|
||||||
$ git commit # commit it
|
$ git add -p # interactively put together your patch
|
||||||
|
$ git commit # commit it
|
||||||
$ git push REMOTE HEAD:refs/heads/BRANCH
|
$ git push REMOTE HEAD:refs/heads/BRANCH
|
||||||
# where REMOTE is your "fork" on GitHub
|
# where REMOTE is your "fork" on GitHub
|
||||||
# and BRANCH is a branch name.
|
# and BRANCH is a branch name.
|
||||||
```
|
```
|
||||||
|
|
||||||
And after that, head over to your repo on GitHub and click "Compare & pull request"
|
And after that, head over to your repo on GitHub and click "Compare & pull request"
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
.mkosi/mkosi.fedora
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "sd-netlink.h"
|
#include "sd-netlink.h"
|
||||||
|
|
||||||
|
#include "format-util.h"
|
||||||
#include "memory-util.h"
|
#include "memory-util.h"
|
||||||
#include "netlink-internal.h"
|
#include "netlink-internal.h"
|
||||||
#include "netlink-util.h"
|
#include "netlink-util.h"
|
||||||
|
@ -9,6 +10,8 @@
|
||||||
|
|
||||||
int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
|
int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
|
||||||
|
_cleanup_strv_free_ char **alternative_names = NULL;
|
||||||
|
char old_name[IF_NAMESIZE + 1] = {};
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(rtnl);
|
assert(rtnl);
|
||||||
|
@ -18,10 +21,18 @@ int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
|
||||||
if (!ifname_valid(name))
|
if (!ifname_valid(name))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!*rtnl) {
|
r = rtnl_get_link_alternative_names(rtnl, ifindex, &alternative_names);
|
||||||
r = sd_netlink_open(rtnl);
|
if (r < 0)
|
||||||
|
log_debug_errno(r, "Failed to get alternative names on network interface %i, ignoring: %m",
|
||||||
|
ifindex);
|
||||||
|
|
||||||
|
if (strv_contains(alternative_names, name)) {
|
||||||
|
r = rtnl_delete_link_alternative_names(rtnl, ifindex, STRV_MAKE(name));
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return log_debug_errno(r, "Failed to remove '%s' from alternative names on network interface %i: %m",
|
||||||
|
name, ifindex);
|
||||||
|
|
||||||
|
format_ifname(ifindex, old_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
r = sd_rtnl_message_new_link(*rtnl, &message, RTM_SETLINK, ifindex);
|
r = sd_rtnl_message_new_link(*rtnl, &message, RTM_SETLINK, ifindex);
|
||||||
|
@ -36,6 +47,13 @@ int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
if (!isempty(old_name)) {
|
||||||
|
r = rtnl_set_link_alternative_names(rtnl, ifindex, STRV_MAKE(old_name));
|
||||||
|
if (r < 0)
|
||||||
|
log_debug_errno(r, "Failed to set '%s' as an alternative name on network interface %i, ignoring: %m",
|
||||||
|
old_name, ifindex);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,12 +103,45 @@ int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtnl_set_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const *alternative_names) {
|
int rtnl_get_link_alternative_names(sd_netlink **rtnl, int ifindex, char ***ret) {
|
||||||
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL, *reply = NULL;
|
||||||
|
_cleanup_strv_free_ char **names = NULL;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(rtnl);
|
||||||
|
assert(ifindex > 0);
|
||||||
|
assert(ret);
|
||||||
|
|
||||||
|
if (!*rtnl) {
|
||||||
|
r = sd_netlink_open(rtnl);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = sd_rtnl_message_new_link(*rtnl, &message, RTM_GETLINK, ifindex);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
r = sd_netlink_call(*rtnl, message, 0, &reply);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
r = sd_netlink_message_read_strv(reply, IFLA_PROP_LIST, IFLA_ALT_IFNAME, &names);
|
||||||
|
if (r < 0 && r != -ENODATA)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
*ret = TAKE_PTR(names);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int rtnl_update_link_alternative_names(sd_netlink **rtnl, uint16_t nlmsg_type, int ifindex, char * const *alternative_names) {
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(rtnl);
|
assert(rtnl);
|
||||||
assert(ifindex > 0);
|
assert(ifindex > 0);
|
||||||
|
assert(IN_SET(nlmsg_type, RTM_NEWLINKPROP, RTM_DELLINKPROP));
|
||||||
|
|
||||||
if (strv_isempty(alternative_names))
|
if (strv_isempty(alternative_names))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -101,7 +152,7 @@ int rtnl_set_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = sd_rtnl_message_new_link(*rtnl, &message, RTM_NEWLINKPROP, ifindex);
|
r = sd_rtnl_message_new_link(*rtnl, &message, nlmsg_type, ifindex);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -124,6 +175,14 @@ int rtnl_set_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rtnl_set_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const *alternative_names) {
|
||||||
|
return rtnl_update_link_alternative_names(rtnl, RTM_NEWLINKPROP, ifindex, alternative_names);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rtnl_delete_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const *alternative_names) {
|
||||||
|
return rtnl_update_link_alternative_names(rtnl, RTM_DELLINKPROP, ifindex, alternative_names);
|
||||||
|
}
|
||||||
|
|
||||||
int rtnl_set_link_alternative_names_by_ifname(sd_netlink **rtnl, const char *ifname, char * const *alternative_names) {
|
int rtnl_set_link_alternative_names_by_ifname(sd_netlink **rtnl, const char *ifname, char * const *alternative_names) {
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
@ -236,10 +295,10 @@ int rtnl_message_new_synthetic_error(sd_netlink *rtnl, int error, uint32_t seria
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
rtnl_message_seal(*ret);
|
||||||
(*ret)->hdr->nlmsg_seq = serial;
|
(*ret)->hdr->nlmsg_seq = serial;
|
||||||
|
|
||||||
err = NLMSG_DATA((*ret)->hdr);
|
err = NLMSG_DATA((*ret)->hdr);
|
||||||
|
|
||||||
err->error = error;
|
err->error = error;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -53,8 +53,10 @@ static inline bool rtnl_message_type_is_tclass(uint16_t type) {
|
||||||
|
|
||||||
int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name);
|
int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name);
|
||||||
int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias, const struct ether_addr *mac, uint32_t mtu);
|
int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias, const struct ether_addr *mac, uint32_t mtu);
|
||||||
|
int rtnl_get_link_alternative_names(sd_netlink **rtnl, int ifindex, char ***ret);
|
||||||
int rtnl_set_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const *alternative_names);
|
int rtnl_set_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const *alternative_names);
|
||||||
int rtnl_set_link_alternative_names_by_ifname(sd_netlink **rtnl, const char *ifname, char * const *alternative_names);
|
int rtnl_set_link_alternative_names_by_ifname(sd_netlink **rtnl, const char *ifname, char * const *alternative_names);
|
||||||
|
int rtnl_delete_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const *alternative_names);
|
||||||
int rtnl_resolve_link_alternative_name(sd_netlink **rtnl, const char *name);
|
int rtnl_resolve_link_alternative_name(sd_netlink **rtnl, const char *name);
|
||||||
int rtnl_get_link_iftype(sd_netlink **rtnl, int ifindex, unsigned short *ret);
|
int rtnl_get_link_iftype(sd_netlink **rtnl, int ifindex, unsigned short *ret);
|
||||||
|
|
||||||
|
|
|
@ -431,6 +431,32 @@ int address_get(Link *link,
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool address_exists_internal(Set *addresses, int family, const union in_addr_union *in_addr) {
|
||||||
|
Address *address;
|
||||||
|
Iterator i;
|
||||||
|
|
||||||
|
SET_FOREACH(address, addresses, i) {
|
||||||
|
if (address->family != family)
|
||||||
|
continue;
|
||||||
|
if (in_addr_equal(address->family, &address->in_addr, in_addr))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool address_exists(Link *link, int family, const union in_addr_union *in_addr) {
|
||||||
|
assert(link);
|
||||||
|
assert(IN_SET(family, AF_INET, AF_INET6));
|
||||||
|
assert(in_addr);
|
||||||
|
|
||||||
|
if (address_exists_internal(link->addresses, family, in_addr))
|
||||||
|
return true;
|
||||||
|
if (address_exists_internal(link->addresses_foreign, family, in_addr))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static int address_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
static int address_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ void address_free(Address *address);
|
||||||
int address_add_foreign(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
|
int address_add_foreign(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
|
||||||
int address_add(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
|
int address_add(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
|
||||||
int address_get(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
|
int address_get(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
|
||||||
|
bool address_exists(Link *link, int family, const union in_addr_union *in_addr);
|
||||||
int address_update(Address *address, unsigned char flags, unsigned char scope, const struct ifa_cacheinfo *cinfo);
|
int address_update(Address *address, unsigned char flags, unsigned char scope, const struct ifa_cacheinfo *cinfo);
|
||||||
int address_drop(Address *address);
|
int address_drop(Address *address);
|
||||||
int address_configure(Address *address, Link *link, link_netlink_message_handler_t callback, bool update);
|
int address_configure(Address *address, Link *link, link_netlink_message_handler_t callback, bool update);
|
||||||
|
|
|
@ -4229,7 +4229,7 @@ int link_save(Link *link) {
|
||||||
sd_dhcp6_lease_get_dns,
|
sd_dhcp6_lease_get_dns,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Make sure to flush out old entries before we use the NDISC data */
|
/* Make sure to flush out old entries before we use the NDisc data */
|
||||||
ndisc_vacuum(link);
|
ndisc_vacuum(link);
|
||||||
|
|
||||||
if (link->network->ipv6_accept_ra_use_dns && link->ndisc_rdnss) {
|
if (link->network->ipv6_accept_ra_use_dns && link->ndisc_rdnss) {
|
||||||
|
|
|
@ -505,7 +505,8 @@ int manager_rtnl_process_route(sd_netlink *rtnl, sd_netlink_message *message, vo
|
||||||
|
|
||||||
log_link_debug(link,
|
log_link_debug(link,
|
||||||
"%s route: dst: %s%s, src: %s, gw: %s, prefsrc: %s, scope: %s, table: %s, proto: %s, type: %s",
|
"%s route: dst: %s%s, src: %s, gw: %s, prefsrc: %s, scope: %s, table: %s, proto: %s, type: %s",
|
||||||
(!route && !link->manager->manage_foreign_routes) || type == RTM_DELROUTE ? "Forgetting" :
|
(!route && !link->manager->manage_foreign_routes) ? "Ignoring received foreign" :
|
||||||
|
type == RTM_DELROUTE ? "Forgetting" :
|
||||||
route ? "Received remembered" : "Remembering",
|
route ? "Received remembered" : "Remembering",
|
||||||
strna(buf_dst), strempty(buf_dst_prefixlen),
|
strna(buf_dst), strempty(buf_dst_prefixlen),
|
||||||
strna(buf_src), strna(buf_gw), strna(buf_prefsrc),
|
strna(buf_src), strna(buf_gw), strna(buf_prefsrc),
|
||||||
|
@ -2031,6 +2032,9 @@ int manager_rtnl_enumerate_routes(Manager *m) {
|
||||||
assert(m);
|
assert(m);
|
||||||
assert(m->rtnl);
|
assert(m->rtnl);
|
||||||
|
|
||||||
|
if (!m->manage_foreign_routes)
|
||||||
|
return 0;
|
||||||
|
|
||||||
r = sd_rtnl_message_new_route(m->rtnl, &req, RTM_GETROUTE, 0, 0);
|
r = sd_rtnl_message_new_route(m->rtnl, &req, RTM_GETROUTE, 0, 0);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -148,8 +148,6 @@ static int ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
|
||||||
unsigned preference;
|
unsigned preference;
|
||||||
uint32_t mtu;
|
uint32_t mtu;
|
||||||
usec_t time_now;
|
usec_t time_now;
|
||||||
Address *address;
|
|
||||||
Iterator i;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
|
@ -166,34 +164,15 @@ static int ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Failed to get gateway address from RA: %m");
|
return log_link_error_errno(link, r, "Failed to get gateway address from RA: %m");
|
||||||
|
|
||||||
SET_FOREACH(address, link->addresses, i) {
|
if (address_exists(link, AF_INET6, &gateway)) {
|
||||||
if (address->family != AF_INET6)
|
if (DEBUG_LOGGING) {
|
||||||
continue;
|
_cleanup_free_ char *buffer = NULL;
|
||||||
if (in_addr_equal(AF_INET6, &gateway, &address->in_addr)) {
|
|
||||||
if (DEBUG_LOGGING) {
|
|
||||||
_cleanup_free_ char *buffer = NULL;
|
|
||||||
|
|
||||||
(void) in_addr_to_string(AF_INET6, &address->in_addr, &buffer);
|
(void) in_addr_to_string(AF_INET6, &gateway, &buffer);
|
||||||
log_link_debug(link, "No NDisc route added, gateway %s matches local address",
|
log_link_debug(link, "No NDisc route added, gateway %s matches local address",
|
||||||
strnull(buffer));
|
strnull(buffer));
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SET_FOREACH(address, link->addresses_foreign, i) {
|
|
||||||
if (address->family != AF_INET6)
|
|
||||||
continue;
|
|
||||||
if (in_addr_equal(AF_INET6, &gateway, &address->in_addr)) {
|
|
||||||
if (DEBUG_LOGGING) {
|
|
||||||
_cleanup_free_ char *buffer = NULL;
|
|
||||||
|
|
||||||
(void) in_addr_to_string(AF_INET6, &address->in_addr, &buffer);
|
|
||||||
log_link_debug(link, "No NDisc route added, gateway %s matches local address",
|
|
||||||
strnull(buffer));
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = sd_ndisc_router_get_preference(rt, &preference);
|
r = sd_ndisc_router_get_preference(rt, &preference);
|
||||||
|
@ -836,14 +815,14 @@ static void ndisc_handler(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *r
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SD_NDISC_EVENT_TIMEOUT:
|
case SD_NDISC_EVENT_TIMEOUT:
|
||||||
log_link_debug(link, "NDISC handler get timeout event");
|
log_link_debug(link, "NDisc handler get timeout event");
|
||||||
link->ndisc_addresses_configured = true;
|
link->ndisc_addresses_configured = true;
|
||||||
link->ndisc_routes_configured = true;
|
link->ndisc_routes_configured = true;
|
||||||
link_check_ready(link);
|
link_check_ready(link);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert_not_reached("IPv6 Neighbor Discovery unknown event");
|
assert_not_reached("Unknown NDisc event");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -969,7 +948,7 @@ int config_parse_ndisc_deny_listed_prefix(
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
"Failed to parse NDISC deny-listed prefix, ignoring assignment: %s",
|
"Failed to parse NDisc deny-listed prefix, ignoring assignment: %s",
|
||||||
rvalue);
|
rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -979,7 +958,7 @@ int config_parse_ndisc_deny_listed_prefix(
|
||||||
r = in_addr_from_string(AF_INET6, n, &ip);
|
r = in_addr_from_string(AF_INET6, n, &ip);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
"NDISC deny-listed prefix is invalid, ignoring assignment: %s", n);
|
"NDisc deny-listed prefix is invalid, ignoring assignment: %s", n);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ int neighbor_configure(Neighbor *neighbor, Link *link, link_netlink_message_hand
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not set state: %m");
|
return log_link_error_errno(link, r, "Could not set state: %m");
|
||||||
|
|
||||||
r = sd_netlink_message_set_flags(req, NLM_F_REQUEST | NLM_F_CREATE | NLM_F_REPLACE);
|
r = sd_netlink_message_set_flags(req, NLM_F_REQUEST | NLM_F_ACK | NLM_F_CREATE | NLM_F_REPLACE);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not set flags: %m");
|
return log_link_error_errno(link, r, "Could not set flags: %m");
|
||||||
|
|
||||||
|
|
|
@ -3191,7 +3191,7 @@ static int inner_child(
|
||||||
if (asprintf((char **)(envp + n_env++), "NOTIFY_SOCKET=%s", NSPAWN_NOTIFY_SOCKET_PATH) < 0)
|
if (asprintf((char **)(envp + n_env++), "NOTIFY_SOCKET=%s", NSPAWN_NOTIFY_SOCKET_PATH) < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
env_use = strv_env_merge(3, envp, arg_setenv, os_release_pairs);
|
env_use = strv_env_merge(3, envp, os_release_pairs, arg_setenv);
|
||||||
if (!env_use)
|
if (!env_use)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,7 @@ static int get_mac(sd_device *device, MACAddressPolicy policy, struct ether_addr
|
||||||
|
|
||||||
int link_config_apply(link_config_ctx *ctx, link_config *config,
|
int link_config_apply(link_config_ctx *ctx, link_config *config,
|
||||||
sd_device *device, const char **name) {
|
sd_device *device, const char **name) {
|
||||||
_cleanup_strv_free_ char **altnames = NULL;
|
_cleanup_strv_free_ char **altnames = NULL, **current_altnames = NULL;
|
||||||
struct ether_addr generated_mac;
|
struct ether_addr generated_mac;
|
||||||
struct ether_addr *mac = NULL;
|
struct ether_addr *mac = NULL;
|
||||||
const char *new_name = NULL;
|
const char *new_name = NULL;
|
||||||
|
@ -539,9 +539,17 @@ int link_config_apply(link_config_ctx *ctx, link_config *config,
|
||||||
if (new_name)
|
if (new_name)
|
||||||
strv_remove(altnames, new_name);
|
strv_remove(altnames, new_name);
|
||||||
strv_remove(altnames, old_name);
|
strv_remove(altnames, old_name);
|
||||||
|
|
||||||
|
r = rtnl_get_link_alternative_names(&ctx->rtnl, ifindex, ¤t_altnames);
|
||||||
|
if (r < 0)
|
||||||
|
log_debug_errno(r, "Failed to get alternative names on %s, ignoring: %m", old_name);
|
||||||
|
|
||||||
|
char **p;
|
||||||
|
STRV_FOREACH(p, current_altnames)
|
||||||
|
strv_remove(altnames, *p);
|
||||||
|
|
||||||
strv_uniq(altnames);
|
strv_uniq(altnames);
|
||||||
strv_sort(altnames);
|
strv_sort(altnames);
|
||||||
|
|
||||||
r = rtnl_set_link_alternative_names(&ctx->rtnl, ifindex, altnames);
|
r = rtnl_set_link_alternative_names(&ctx->rtnl, ifindex, altnames);
|
||||||
if (r == -EOPNOTSUPP)
|
if (r == -EOPNOTSUPP)
|
||||||
log_debug_errno(r, "Could not set AlternativeName= or apply AlternativeNamesPolicy= on %s, ignoring: %m", old_name);
|
log_debug_errno(r, "Could not set AlternativeName= or apply AlternativeNamesPolicy= on %s, ignoring: %m", old_name);
|
||||||
|
|
|
@ -226,6 +226,7 @@ static void setup_remaining_vcs(int src_fd, unsigned src_idx, bool utf8) {
|
||||||
_cleanup_free_ struct unipair* unipairs = NULL;
|
_cleanup_free_ struct unipair* unipairs = NULL;
|
||||||
_cleanup_free_ void *fontbuf = NULL;
|
_cleanup_free_ void *fontbuf = NULL;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
int log_level;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
unipairs = new(struct unipair, USHRT_MAX);
|
unipairs = new(struct unipair, USHRT_MAX);
|
||||||
|
@ -234,11 +235,20 @@ static void setup_remaining_vcs(int src_fd, unsigned src_idx, bool utf8) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_level = LOG_WARNING;
|
||||||
|
|
||||||
/* get metadata of the current font (width, height, count) */
|
/* get metadata of the current font (width, height, count) */
|
||||||
r = ioctl(src_fd, KDFONTOP, &cfo);
|
r = ioctl(src_fd, KDFONTOP, &cfo);
|
||||||
if (r < 0)
|
if (r < 0) {
|
||||||
log_warning_errno(errno, "KD_FONT_OP_GET failed while trying to get the font metadata: %m");
|
/* We might be called to operate on the dummy console (to setup keymap
|
||||||
else {
|
* mainly) when fbcon deferred takeover is used for example. In such case,
|
||||||
|
* setting font is not supported and is expected to fail. */
|
||||||
|
if (errno == ENOSYS)
|
||||||
|
log_level = LOG_DEBUG;
|
||||||
|
|
||||||
|
log_full_errno(log_level, errno,
|
||||||
|
"KD_FONT_OP_GET failed while trying to get the font metadata: %m");
|
||||||
|
} else {
|
||||||
/* verify parameter sanity first */
|
/* verify parameter sanity first */
|
||||||
if (cfo.width > 32 || cfo.height > 32 || cfo.charcount > 512)
|
if (cfo.width > 32 || cfo.height > 32 || cfo.charcount > 512)
|
||||||
log_warning("Invalid font metadata - width: %u (max 32), height: %u (max 32), count: %u (max 512)",
|
log_warning("Invalid font metadata - width: %u (max 32), height: %u (max 32), count: %u (max 512)",
|
||||||
|
@ -273,7 +283,7 @@ static void setup_remaining_vcs(int src_fd, unsigned src_idx, bool utf8) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfo.op != KD_FONT_OP_SET)
|
if (cfo.op != KD_FONT_OP_SET)
|
||||||
log_warning("Fonts will not be copied to remaining consoles");
|
log_full(log_level, "Fonts will not be copied to remaining consoles");
|
||||||
|
|
||||||
for (i = 1; i <= 63; i++) {
|
for (i = 1; i <= 63; i++) {
|
||||||
char ttyname[sizeof("/dev/tty63")];
|
char ttyname[sizeof("/dev/tty63")];
|
||||||
|
|
Loading…
Reference in New Issue