networkmanager-0.9.8: add package

This commit is contained in:
Nikolay Amiantov 2015-06-12 02:00:35 +03:00
parent c865eb56ab
commit 6cb8e04a5c
3 changed files with 122 additions and 0 deletions

View File

@ -0,0 +1,58 @@
{ stdenv, fetchurl, intltool, pkgconfig, dbus_glib
, udev, libnl, libuuid, gnutls, dhcp
, libgcrypt, perl }:
stdenv.mkDerivation rec {
name = "network-manager-${version}";
version = "0.9.8.10";
src = fetchurl {
url = "mirror://gnome/sources/NetworkManager/0.9/NetworkManager-${version}.tar.xz";
sha256 = "0wn9qh8r56r8l19dqr68pdl1rv3zg1dv47rfy6fqa91q7li2fk86";
};
preConfigure = ''
substituteInPlace tools/glib-mkenums --replace /usr/bin/perl ${perl}/bin/perl
'';
# Right now we hardcode quite a few paths at build time. Probably we should
# patch networkmanager to allow passing these path in config file. This will
# remove unneeded build-time dependencies.
configureFlags = [
"--with-distro=exherbo"
"--with-dhclient=${dhcp}/sbin/dhclient"
"--with-dhcpcd=no"
"--with-iptables=no"
"--with-udev-dir=\${out}/lib/udev"
"--with-resolvconf=no"
"--sysconfdir=/etc" "--localstatedir=/var"
"--with-dbus-sys-dir=\${out}/etc/dbus-1/system.d"
"--with-crypto=gnutls" "--disable-more-warnings"
"--with-systemdsystemunitdir=$(out)/etc/systemd/system"
"--with-kernel-firmware-dir=/run/current-system/firmware"
"--disable-ppp"
];
buildInputs = [ udev libnl libuuid gnutls libgcrypt ];
propagatedBuildInputs = [ dbus_glib ];
nativeBuildInputs = [ intltool pkgconfig ];
patches =
[ ./libnl-3.2.25.patch
./nixos-purity.patch
];
preInstall =
''
installFlagsArray=( "sysconfdir=$out/etc" "localstatedir=$out/var" )
'';
meta = with stdenv.lib; {
homepage = http://projects.gnome.org/NetworkManager/;
description = "Network configuration and management tool";
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,61 @@
diff --git a/src/nm-netlink-monitor.c b/src/nm-netlink-monitor.c
index ba8053e..5ac39d3 100644
--- a/src/nm-netlink-monitor.c
+++ b/src/nm-netlink-monitor.c
@@ -177,40 +177,15 @@ link_msg_handler (struct nl_object *obj, void *arg)
static int
event_msg_recv (struct nl_msg *msg, void *arg)
{
- struct nl_sock *nlh = arg;
- struct nlmsghdr *hdr = nlmsg_hdr (msg);
struct ucred *creds = nlmsg_get_creds (msg);
- const struct sockaddr_nl *snl;
- guint32 local_port;
- gboolean accept_msg = FALSE;
-
- /* Only messages sent from the kernel */
- if (!creds || creds->uid != 0) {
- nm_log_dbg (LOGD_HW, "ignoring netlink message from UID %d",
- creds ? creds->uid : -1);
- return NL_SKIP;
- }
-
- snl = nlmsg_get_src (msg);
- g_assert (snl);
-
- /* Accept any messages from the kernel */
- if (hdr->nlmsg_pid == 0 || snl->nl_pid == 0)
- accept_msg = TRUE;
- /* And any multicast message directed to our netlink PID, since multicast
- * currently requires CAP_ADMIN to use.
- */
- local_port = nl_socket_get_local_port (nlh);
- if ((hdr->nlmsg_pid == local_port) && snl->nl_groups)
- accept_msg = TRUE;
-
- if (accept_msg == FALSE) {
- nm_log_dbg (LOGD_HW, "ignoring netlink message from PID %d (local PID %d, multicast %d)",
- hdr->nlmsg_pid,
- local_port,
- (hdr->nlmsg_flags & NLM_F_MULTI));
- return NL_SKIP;
+ if (!creds || creds->pid || creds->uid || creds->gid) {
+ if (creds)
+ nm_log_dbg (LOGD_HW, "netlink: received non-kernel message (pid %d uid %d gid %d)",
+ creds->pid, creds->uid, creds->gid);
+ else
+ nm_log_dbg (LOGD_HW, "netlink: received message without credentials");
+ return NL_STOP;
}
return NL_OK;
@@ -285,7 +260,7 @@ nlh_setup (struct nl_sock *nlh,
{
int err;
- nl_socket_modify_cb (nlh, NL_CB_MSG_IN, NL_CB_CUSTOM, event_msg_recv, cb_data);
+ nl_socket_modify_cb (nlh, NL_CB_MSG_IN, NL_CB_CUSTOM, event_msg_recv, NULL);
if (valid_func)
nl_socket_modify_cb (nlh, NL_CB_VALID, NL_CB_CUSTOM, valid_func, cb_data);

View File

@ -2333,6 +2333,9 @@ let
netselect = callPackage ../tools/networking/netselect { };
# stripped down, needed by steam
networkmanager098 = callPackage ../tools/networking/network-manager/0.9.8.nix { };
networkmanager = callPackage ../tools/networking/network-manager { };
networkmanager_openvpn = callPackage ../tools/networking/network-manager/openvpn.nix { };