[systemd-commits] 2 commits - src/network
Tom Gundersen
tomegun at kemper.freedesktop.org
Mon Jul 7 05:19:00 PDT 2014
src/network/networkd-address.c | 26 ++++++++++++++++++++++----
src/network/networkd-macvlan.c | 2 ++
src/network/networkd-network-gperf.gperf | 1 +
src/network/networkd-tunnel.c | 2 ++
src/network/networkd-vlan.c | 2 ++
src/network/networkd-vxlan.c | 2 ++
src/network/networkd.h | 1 +
7 files changed, 32 insertions(+), 4 deletions(-)
New commits:
commit e04468dec04a968c523ee09da7d2163a1d1a5a15
Author: Tom Gundersen <teg at jklm.no>
Date: Mon Jul 7 14:18:26 2014 +0200
networkd: netdev - add missing refs
Without this, the underlying device would get freed (and hence
fail).
diff --git a/src/network/networkd-macvlan.c b/src/network/networkd-macvlan.c
index 9227144..7c23426 100644
--- a/src/network/networkd-macvlan.c
+++ b/src/network/networkd-macvlan.c
@@ -150,6 +150,8 @@ int netdev_create_macvlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t
return r;
}
+ link_ref(link);
+
log_debug_netdev(netdev, "creating netdev");
netdev->state = NETDEV_STATE_CREATING;
diff --git a/src/network/networkd-tunnel.c b/src/network/networkd-tunnel.c
index 7341487..5a244f6 100644
--- a/src/network/networkd-tunnel.c
+++ b/src/network/networkd-tunnel.c
@@ -529,6 +529,8 @@ int netdev_create_tunnel(NetDev *netdev, Link *link, sd_rtnl_message_handler_t c
return r;
}
+ link_ref(link);
+
log_debug_netdev(netdev, "Creating tunnel netdev: %s",
netdev_kind_to_string(netdev->kind));
diff --git a/src/network/networkd-vlan.c b/src/network/networkd-vlan.c
index 1d812fd..8727b9f 100644
--- a/src/network/networkd-vlan.c
+++ b/src/network/networkd-vlan.c
@@ -139,6 +139,8 @@ int netdev_create_vlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cal
return r;
}
+ link_ref(link);
+
log_debug_netdev(netdev, "creating netdev");
netdev->state = NETDEV_STATE_CREATING;
diff --git a/src/network/networkd-vxlan.c b/src/network/networkd-vxlan.c
index 8832024..1604594 100644
--- a/src/network/networkd-vxlan.c
+++ b/src/network/networkd-vxlan.c
@@ -154,6 +154,8 @@ int netdev_create_vxlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t ca
return r;
}
+ link_ref(link);
+
log_debug_netdev(netdev, "Creating vxlan netdev: %s",
netdev_kind_to_string(netdev->kind));
commit c081882f07617e56bcbce54105068137e4e0bb52
Author: Susant Sahani <susant at redhat.com>
Date: Mon Jul 7 14:58:56 2014 +0530
networkd: add support for peer address
This patch adds peer address support for
networkd . In the [Address] a new configurable
param is Peer.
[Match]
Name=ipip-tun
[Address]
Address=10.0.0.1/32
Peer=10.0.0.2/32
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 1ba2108..8c4ef99 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -345,13 +345,25 @@ int address_configure(Address *address, Link *link,
return r;
}
- if (address->family == AF_INET) {
- r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
+ if (!in_addr_null(address->family, &address->in_addr_peer)) {
+ if (address->family == AF_INET)
+ r = sd_rtnl_message_append_in_addr(req, IFA_ADDRESS, &address->in_addr_peer.in);
+ else if (address->family == AF_INET6)
+ r = sd_rtnl_message_append_in6_addr(req, IFA_ADDRESS, &address->in_addr_peer.in6);
if (r < 0) {
- log_error("Could not append IFA_BROADCAST attribute: %s",
+ log_error("Could not append IFA_ADDRESS attribute: %s",
strerror(-r));
return r;
}
+ } else {
+ if (address->family == AF_INET) {
+ r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
+ if (r < 0) {
+ log_error("Could not append IFA_BROADCAST attribute: %s",
+ strerror(-r));
+ return r;
+ }
+ }
}
if (address->label) {
@@ -488,6 +500,7 @@ int config_parse_address(const char *unit,
Network *network = userdata;
_cleanup_address_free_ Address *n = NULL;
_cleanup_free_ char *address = NULL;
+ union in_addr_union *addr;
const char *e;
int r;
@@ -507,6 +520,11 @@ int config_parse_address(const char *unit,
if (r < 0)
return r;
+ if (streq(lvalue, "Address"))
+ addr = &n->in_addr;
+ else
+ addr = &n->in_addr_peer;
+
/* Address=address/prefixlen */
/* prefixlen */
@@ -532,7 +550,7 @@ int config_parse_address(const char *unit,
return log_oom();
}
- r = net_parse_inaddr(address, &n->family, &n->in_addr);
+ r = net_parse_inaddr(address, &n->family, addr);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
"Address is invalid, ignoring assignment: %s", address);
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index ce9047c..c821ead 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -39,6 +39,7 @@ Network.DNS, config_parse_dns, 0,
Network.NTP, config_parse_dns, 0, offsetof(Network, ntp)
Network.Tunnel, config_parse_tunnel, 0, offsetof(Network, tunnel)
Address.Address, config_parse_address, 0, 0
+Address.Peer, config_parse_address, 0, 0
Address.Broadcast, config_parse_broadcast, 0, 0
Address.Label, config_parse_label, 0, 0
Route.Gateway, config_parse_gateway, 0, 0
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 6a00175..5df52c9 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -211,6 +211,7 @@ struct Address {
struct ifa_cacheinfo cinfo;
union in_addr_union in_addr;
+ union in_addr_union in_addr_peer;
LIST_FIELDS(Address, addresses);
};
More information about the systemd-commits
mailing list