lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 6 May 2012 14:46:01 +0200
From:	Oskar Berggren <oskar.berggren@...il.com>
To:	Stephen Hemminger <stephen.hemminger@...tta.com>
Cc:	netdev@...r.kernel.org
Subject: Re: ipctl - new tool for efficient read/write of net related sysctl

2012/5/6 Stephen Hemminger <stephen.hemminger@...tta.com>:
>
>>
>> In a project of mine I need to read (and possibly set) many of the
>> properties
>> found under /proc/sys/net/ipv4/conf/. This is simple enough, except
>> that
>> when you have hundreds of interfaces, it is really slow. In my tests
>> it takes
>> about 4 seconds to read a single variable for 700 interfaces. For a
>> while I
>> worked around this using the binary sysctl() interface, but this is
>> deprecated.
>>
>
> What about exposing these as NETLINK attributes? That would be faster
> and you could do bulk updates.


This is my first attempt at using NETLINK, so could you please elaborate?
Below is the generic netlink interface I implemented so far. Any pointers
on how I should do this differently?


#ifndef IPCTL_NL_H_INCLUDED
#define IPCTL_NL_H_INCLUDED

/* Copyright (C) 2012 Oskar Berggren <oskar.berggren@...il.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */


/* NETLINK attributes */
enum {
  IPCTL_ATTR_UNSPEC,
  IPCTL_ATTR_PROPERTY,   /* Use IPCTL_PROPERTY_*  */
  IPCTL_ATTR_IFINDEX,
  IPCTL_ATTR_VALUE,
  __IPCTL_ATTR_MAX,
};
#define IPCTL_ATTR_MAX (__IPCTL_ATTR_MAX - 1)

/* attribute policy */
static struct nla_policy ipctl_genl_policy[IPCTL_ATTR_MAX + 1] = {
	[IPCTL_ATTR_PROPERTY] = { .type = NLA_U32 },
	[IPCTL_ATTR_IFINDEX] = { .type = NLA_U32 },
	[IPCTL_ATTR_VALUE] = { .type = NLA_U8 },
};


/* NETLINK commands */
enum {
  IPCTL_CMD_UNSPEC,
  IPCTL_CMD_SET,
  IPCTL_CMD_GET,
  __IPCTL_CMD_MAX,
};
#define IPCTL_CMD_MAX (__IPCTL_CMD_MAX - 1)


/* Values for IPCTL_ATTR_PROPERTY. */
enum {
  IPCTL_PROPERTY_PROXYARP,
};


/* ipctl use the generic netlink facility. */
#define IPCTL_GENL_NAME "ipctl"

#define IPCTL_GENL_VERSION 1

#endif
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ