Re: [systemd-devel] [PATCH 10/11] Avoid doubling the efforts for /var/log/journal

2014-06-18 Thread Dr. Werner Fink
On Mon, Jun 16, 2014 at 11:10:15AM -0400, Cristian Rodríguez wrote:
 El 13/06/14 10:41, Werner Fink escribió:
  That is: set NOATIME, NOCOW, and NOCOMP for the journal directory
  
  ---
   src/journal/journald-server.c |   29 +++--
   1 file changed, 27 insertions(+), 2 deletions(-)
  
  diff --git src/journal/journald-server.c src/journal/journald-server.c
  index eda5dcf..37d6dc3 100644
  --- src/journal/journald-server.c
  +++ src/journal/journald-server.c
  @@ -21,6 +21,7 @@
   
   #include sys/signalfd.h
   #include sys/ioctl.h
  +#include linux/fs.h
   #include linux/sockios.h
   #include sys/statvfs.h
   #include sys/mman.h
  @@ -920,7 +921,7 @@ finish:
   
   
   static int system_journal_open(Server *s) {
  -int r;
  +int r, fd;
 
 _cleanup_close_ ...
 
  +/*
  + * On journaling and/or compressing file systems avoid 
  doubling the
  + * efforts for the system, that is set NOCOW and NOCOMP 
  inode flags.
  + * Check for every single flag as otherwise some of the 
  file systems
  + * may return EOPNOTSUPP on one unkown flag (like BtrFS 
  does).
  + */
  +if ((fd = open(fn, O_DIRECTORY)) = 0) {
 
 O_CLOEXEC...
 
  +long flags;
  +if (ioctl(fd, FS_IOC_GETFLAGS, flags) == 0) {
  +int old = flags;
  +if (!(flagsFS_NOATIME_FL)  ioctl(fd, 
  FS_IOC_SETFLAGS, flags|FS_NOATIME_FL) == 0)
  +flags |= FS_NOATIME_FL;
  +if (!(flagsFS_NOCOW_FL)  ioctl(fd, 
  FS_IOC_SETFLAGS, flags|FS_NOCOW_FL) == 0)
  +flags |= FS_NOCOW_FL;
  +if (!(flagsFS_NOCOMP_FL)  s-compress) {
  +flags = ~FS_COMPR_FL;
  +flags |= FS_NOCOMP_FL;
  +}
  +if (old != flags)
  +ioctl(fd, FS_IOC_SETFLAGS, flags);
  +}
  +close(fd);
  +}
 
 I agree that this should be done, however I remain unconvinced this is
 the right place to do it..

IMHO this is the correct place as it helps to speed up systemd-journal
on BtrFS.  This was the reason for this patch and is tested even if the
patch does not use _cleanup_close_ and O_CLOEXEC ;)


Werner

-- 
  Having a smoking section in a restaurant is like having
  a peeing section in a swimming pool. -- Edward Burr


pgp3Lcj6mvhs4.pgp
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 01/11] Ensure that systemd-sysctl.service is applied after modules are loaded

2014-06-18 Thread Dr. Werner Fink
On Mon, Jun 16, 2014 at 06:02:37PM +0200, Tom Gundersen wrote:
 On Mon, Jun 16, 2014 at 5:19 PM, Frederic Crozat fcro...@suse.com wrote:
 
  See https://bugzilla.novell.com/show_bug.cgi?id=725412
 
 Hm, that really does not look convincing. There is a fundamental
 problem here (as Ludwig Nessel points out in the linked discussion:
 sysctl is broken by design unfortunately.), and the discussion nor
 the patch do not get to the bottom of that.
 
 Moreover, (essentially) this patch was already posted and rejected
 last year. Lennart then wrote:
 
 Well, most modules are loaded asynchronously from udev, so I fear this
 won't do much...
 
 /etc/sysctl.d/ is really only for sysctl settings that exist all the
 time, and -- as a special exception -- for network-device related
 settings, which we set via a udev rule.
 
 If people want to apply sysctls based on specific modules that are
 loaded, or based on specific hw that shows up (i.e. hw that isn't a
 network device) the only sane way is probably via a udev rule...

The only problem with udev rules is that many system administrators
do not know enough how to write and how to place such rules.  What
about simple dependencies for such sysctl settings for specific modules.
Maybe by using a special name spavce below sysctl.d directories or a
special comment within the configure files below modules-load.d
directories.  Or similar like the unit configuration of services.

Werner

-- 
  Having a smoking section in a restaurant is like having
  a peeing section in a swimming pool. -- Edward Burr


pgpzDOAVFMXRz.pgp
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 02/24] sd-dhcp6-client: Add Router Solicitation and Advertisement support

2014-06-18 Thread Tom Gundersen
On Wed, Jun 18, 2014 at 2:26 PM, Patrik Flykt
patrik.fl...@linux.intel.com wrote:
 On Mon, 2014-06-16 at 12:39 +0300, Patrik Flykt wrote:
  1) usage of struct ether_addr may prevent correct operation on
  non-ethernet links, like Infiniband or PPP or GRE.  They don't have
  6-byte MAC addresses, so anywhere that currently uses a MAC address
  I'd suggest passing u8*, u8 len instead, to allow for non-ethernet
  links. See ndisc_fill_addr_option() in the kernel...

 This one I have left for a bit later as no harm is done if the MAC
 address is not set.

Makes sense to keep this on the TODO and sort it out later. We
probably should do the same for the other libraries (where
applicable).

  2) as I replied to Tom, could we keep RS/RA code together and not
  tie it with DHCP stuff, since they aren't really related?  DHCP is
  the consumer of the M/O bits, but if DHCP isn't requested at all by
  the router via the M/O bits, there's no reason for DHCP to ever be
  involved in the process.  I think it would be better to keep them
  fully separate.

 That I can do.

 This is now done and the interface looks like the following:

 $ cat src/systemd/sd-icmp6-nd.h
 ...
 enum {
 ICMP6_EVENT_ROUTER_ADVERTISMENT_NONE= 0,
 ICMP6_EVENT_ROUTER_ADVERTISMENT_TIMEOUT = 1,
 ICMP6_EVENT_ROUTER_ADVERTISMENT_OTHER   = 2,
 ICMP6_EVENT_ROUTER_ADVERTISMENT_MANAGED = 3,
 };

 typedef struct sd_icmp6_nd sd_icmp6_nd;

 typedef void(*sd_icmp6_nd_callback_t)(sd_icmp6_nd *nd, int event,
   void *userdata);

 int sd_icmp6_nd_set_callback(sd_icmp6_nd *nd, sd_icmp6_nd_callback_t cb,
  void *userdata);
 int sd_icmp6_nd_set_index(sd_icmp6_nd *nd, int interface_index);
 int sd_icmp6_nd_set_mac(sd_icmp6_nd *nd, const struct ether_addr *mac_addr);

 int sd_icmp6_nd_attach_event(sd_icmp6_nd *nd, sd_event *event, int priority);
 int sd_icmp6_nd_detach_event(sd_icmp6_nd *nd);
 sd_event *sd_icmp6_nd_get_event(sd_icmp6_nd *nd);

 sd_icmp6_nd *sd_icmp6_nd_ref(sd_icmp6_nd *nd);
 sd_icmp6_nd *sd_icmp6_nd_unref(sd_icmp6_nd *nd);
 int sd_icmp6_nd_new(sd_icmp6_nd **ret);

 int sd_icmp6_router_solicitation_start(sd_icmp6_nd *nd);


 Did anyone have further comments on this initial patch set? Shall I send
 the updated version to the mailing list or how do we want to proceed?

Go ahead and push. It is probably simpler to make further
suggestions/comments in terms of patches anyway.

Cheers,

Tom
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 09/24] sd-dhcp6-client: Add DHCPv6 client Solicitation timeout handling

2014-06-18 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Jun 13, 2014 at 04:44:59PM +0300, Patrik Flykt wrote:
 Add the core of DHCPv6 client message retransmission and upper bound
 timer and message count handling according to RFC 3315 Secions 7.1.2
 ^ 17.1.2 ?

 and 14. Omit the DHCPv6 initial delay; for now it is assumed that
 systemd-networkd will provide decent startup randomization that will
 desynchronize the clients.
 
 When reinitializing the client, clear all timers.

 +if (!client-retransmit_time) {
 +client-retransmit_time =
 +client_timeout_compute_random(init_retransmit_time);
 +} else {
 +if (max_retransmit_time 
 +client-retransmit_time  max_retransmit_time / 2)
 +client-retransmit_time = 
 client_timeout_compute_random(max_retransmit_time);
 +else
 +client-retransmit_time = 
 client_timeout_compute_random(client-retransmit_time);
 +}
Hm, I don't understand why the  / 2 is here. It seems that the
retransmit time suddenly jumps from max_retransmit_time/2 to
max_retransmit_time.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 12/24] sd-dhcp6-client: Add DHCPv6 Solicit message creation and sending

2014-06-18 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Jun 13, 2014 at 04:45:02PM +0300, Patrik Flykt wrote:
 Implement the initial functionality used for creating a DHCPv6 Solicit
 message containing the needed options and send it to the DHCPv6
 broadcast address. Increase the sent message count and ensure that
 the Solicit Initial Retransmission Time is strictly greater than
 the Solicitation IRT as described in RFC 3315, section 17.1.2.
 ---
  src/libsystemd-network/dhcp6-internal.h  |   4 ++
  src/libsystemd-network/sd-dhcp6-client.c | 111 
 +++
  2 files changed, 115 insertions(+)
 
 diff --git a/src/libsystemd-network/dhcp6-internal.h 
 b/src/libsystemd-network/dhcp6-internal.h
 index 7a491fb..31f5bd2 100644
 --- a/src/libsystemd-network/dhcp6-internal.h
 +++ b/src/libsystemd-network/dhcp6-internal.h
 @@ -27,6 +27,7 @@
  #include sparse-endian.h
  #include sd-event.h
  #include list.h
 +#include macro.h
  
  typedef struct DHCP6Address DHCP6Address;
  
 @@ -69,3 +70,6 @@ int dhcp6_option_parse(uint8_t **buf, size_t *buflen, 
 uint16_t *optcode,
  int dhcp6_network_bind_udp_socket(int index, struct in6_addr *address);
  int dhcp6_network_send_udp_socket(int s, struct in6_addr *address,
const void *packet, size_t len);
 +
 +const char *dhcp6_message_type_to_string(int s) _const_;
 +int dhcp6_message_type_from_string(const char *s) _pure_;
 diff --git a/src/libsystemd-network/sd-dhcp6-client.c 
 b/src/libsystemd-network/sd-dhcp6-client.c
 index 048b4ea..bdd9177 100644
 --- a/src/libsystemd-network/sd-dhcp6-client.c
 +++ b/src/libsystemd-network/sd-dhcp6-client.c
 @@ -48,6 +48,9 @@ struct sd_dhcp6_client {
  struct ether_addr mac_addr;
  icmp6_nd *ra;
  DHCP6IA ia_na;
 +be32_t transaction_id;
 +int fd;
 +sd_event_source *receive_message;
  usec_t retransmit_time;
  uint8_t retransmit_count;
  sd_event_source *timeout_resend;
 @@ -62,6 +65,24 @@ struct sd_dhcp6_client {
  } _packed_ duid;
  };
  
 +const char * dhcp6_message_type_table[_DHCP6_MESSAGE_MAX] = {
 +[DHCP6_SOLICIT] = SOLICIT,
 +[DHCP6_ADVERTISE] = ADVERTISE,
 +[DHCP6_REQUEST] = REQUEST,
 +[DHCP6_CONFIRM] = CONFIRM,
 +[DHCP6_RENEW] = RENEW,
 +[DHCP6_REBIND] = REBIND,
 +[DHCP6_REPLY] = REPLY,
 +[DHCP6_RELEASE] = RELEASE,
 +[DHCP6_DECLINE] = DECLINE,
 +[DHCP6_RECONFIGURE] = RECONFIGURE,
 +[DHCP6_INFORMATION_REQUEST] = INFORMATION-REQUEST,
 +[DHCP6_RELAY_FORW] = RELAY-FORW,
 +[DHCP6_RELAY_REPL] = RELAY-REPL,
 +};
 +
 +DEFINE_STRING_TABLE_LOOKUP(dhcp6_message_type, int);
 +
  int sd_dhcp6_client_set_callback(sd_dhcp6_client *client,
   sd_dhcp6_client_cb_t cb, void *userdata)
  {
 @@ -110,6 +131,15 @@ static int client_initialize(sd_dhcp6_client *client)
  {
  assert_return(client, -EINVAL);
  
 +client-receive_message =
 +sd_event_source_unref(client-receive_message);
 +

 +if (client-fd  0)
 +safe_close(client-fd);
 +client-fd = -1;
client-fd = safe_close(client-fd);

That's what safe_close is for :)

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 13/24] sd-dhcp6-client: Add RA and DHCPv6 Solicit test case

2014-06-18 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Jun 13, 2014 at 04:45:03PM +0300, Patrik Flykt wrote:
 Copy Router Advertisement functions and data from the previous
 test case and verify the created Solicit message. The test will
 take some non-trivial time to run due to the DHCPv6 initial delay.
 ---
  Makefile.am|   1 +
  src/libsystemd-network/test-dhcp6-client.c | 181 
 +
  2 files changed, 182 insertions(+)
 
 diff --git a/Makefile.am b/Makefile.am
 index f6340dc..87ac728 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -2580,6 +2580,7 @@ test_dhcp6_rs_LDADD = \
  
  test_dhcp6_client_SOURCES = \
   src/systemd/sd-dhcp6-client.h \
 + src/libsystemd-network/dhcp6-icmp6.h \
   src/libsystemd-network/dhcp6-internal.h \
   src/libsystemd-network/test-dhcp6-client.c
  
 diff --git a/src/libsystemd-network/test-dhcp6-client.c 
 b/src/libsystemd-network/test-dhcp6-client.c
 index b52f407..e8cc07d 100644
 --- a/src/libsystemd-network/test-dhcp6-client.c
 +++ b/src/libsystemd-network/test-dhcp6-client.c
 @@ -21,7 +21,12 @@
  
  #include stdbool.h
  #include stdio.h
 +#include sys/types.h
 +#include sys/socket.h
 +#include unistd.h
 +#include netinet/icmp6.h
  
 +#include socket-util.h
  #include macro.h
  #include sd-event.h
  #include event-util.h
 @@ -36,6 +41,12 @@ static struct ether_addr mac_addr = {
  
  static bool verbose = false;
Why not always run in verbose mode (in this test and other too)?
Normally the test output is redirected to a file, and most tests
binaries spit out debug messages freely.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 12/24] sd-dhcp6-client: Add DHCPv6 Solicit message creation and sending

2014-06-18 Thread Filipe Brandenburger
On Wed, Jun 18, 2014 at 6:58 AM, Zbigniew Jędrzejewski-Szmek
zbys...@in.waw.pl wrote:
 +if (client-fd  0)
 +safe_close(client-fd);
 +client-fd = -1;
 client-fd = safe_close(client-fd);

 That's what safe_close is for :)

And shouldn't the check be for client-fd = 0? Zero is a valid file descriptor.

Cheers,
Filipe
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 15/24] sd-dhcp6-client: Add IA Address option parsing

2014-06-18 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Jun 13, 2014 at 04:45:05PM +0300, Patrik Flykt wrote:
 Add functionality to parse DHCPv6 Identity Association for
 Non-temporary (IA_NA) and Temporary Addresses (IA_TA) options.
 Both of them contain one or more IA Address (IAADDR) options
 and optinally a status code option. Only the IA_NA option
 contains lease lifetimes. See RFC 3315, sections 22.4., 22.5.,
 22.6., 22.13. and appendix B. for details. If the lease
 timeouts are not set, use the ones recommended for servers in
 section 22.4.
 
 Factor out common code in the form of an option header parsing
 helper function.
 ---
  src/libsystemd-network/dhcp6-internal.h |   2 +
  src/libsystemd-network/dhcp6-option.c   | 182 
 ++--
  2 files changed, 175 insertions(+), 9 deletions(-)
 
 diff --git a/src/libsystemd-network/dhcp6-internal.h 
 b/src/libsystemd-network/dhcp6-internal.h
 index 31f5bd2..ec1d82a 100644
 --- a/src/libsystemd-network/dhcp6-internal.h
 +++ b/src/libsystemd-network/dhcp6-internal.h
 @@ -66,6 +66,8 @@ int dhcp6_option_append(uint8_t **buf, size_t *buflen, 
 uint16_t code,
  int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia);
  int dhcp6_option_parse(uint8_t **buf, size_t *buflen, uint16_t *optcode,
 size_t *optlen, uint8_t **optvalue);
 +int dhcp6_option_parse_ia(uint8_t **buf, size_t *buflen, uint16_t iatype,
 +  DHCP6IA *ia);
  
  int dhcp6_network_bind_udp_socket(int index, struct in6_addr *address);
  int dhcp6_network_send_udp_socket(int s, struct in6_addr *address,
 diff --git a/src/libsystemd-network/dhcp6-option.c 
 b/src/libsystemd-network/dhcp6-option.c
 index cc4d261..55fd872 100644
 --- a/src/libsystemd-network/dhcp6-option.c
 +++ b/src/libsystemd-network/dhcp6-option.c
 @@ -129,22 +129,186 @@ int dhcp6_option_append_ia(uint8_t **buf, size_t 
 *buflen, DHCP6IA *ia) {
  return 0;
  }
  
 +
 +static int option_parse_hdr(uint8_t **buf, size_t *buflen, uint16_t *opt,
 +size_t *optlen) {
 +uint16_t len;
 +
 +assert_return(buf, -EINVAL);
 +assert_return(opt, -EINVAL);
 +assert_return(optlen, -EINVAL);
 +
 +if (*buflen  4)
 +return -ENOMSG;
 +
 +len = (*buf)[2]  8 | (*buf)[3];
 +
 +if (len  *buflen)
 +return -ENOMSG;
 +
 +*opt = (*buf)[0]  8 | (*buf)[1];
 +*optlen = len;
 +
 +(*buf) += 4;
 +(*buflen) -= 4;
Unnecessary parens?

 -*optvalue = (*buf)[4];
 -*buflen -= (*optlen + 4);
 -(*buf) += (*optlen + 4);
 +*optvalue = *buf;
 +*buflen -= *optlen;
 +(*buf) += *optlen;

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] NoNewPrivileges and Postfix

2014-06-18 Thread Marco d'Itri
I tried using NoNewPrivileges=yes in my inn package, but then I noticed 
that the daemon was unable to send emails:

Jun 18 07:59:38 bongo boot[4623]: postdrop: warning: mail_queue_enter: create 
file maildrop/111862.4636: Permission denied

This happens because postdrop is SGID to be able to securely write new 
emails in the incoming queue:

-r-xr-sr-x 1root postdrop 13636 Mar  2 11:53 /usr/sbin/postdrop

drwx-wx--T 2 postfix postdrop  4096 Jun 18 15:31 /var/spool/postfix/maildrop/

There is a different scheme with no sgid programs and a world writeable 
directory, but it is less secure (it allows some DoS attacks) and I see 
that we do not support it anymore anyway in Debian.

I do not think that Postfix should use the other scheme by default, so 
it looks like we are stuck with not being able to enable NoNewPrivileges 
for daemons that (may) need to send emails.

Is there any other common similar issue with NoNewPrivileges?

-- 
ciao,
Marco


signature.asc
Description: Digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 16/24] sd-dhcp6-client: Receive and parse Advertise messages

2014-06-18 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Jun 13, 2014 at 04:45:06PM +0300, Patrik Flykt wrote:
 When receiving DHCPv6 messages, discard the ones that are not meant
 for DHCPv6 clients and verify the transaction id. Once that is done,
 process the Advertise message and select the Advertise with the
 highest preference.
 
 Create a separate function for lease information parsing so that it
 can be reused in other parts of the protocol. Verify both DUID and
 IAID in the received message and store other necessary information
 with the lease structure.
 ---
  src/libsystemd-network/dhcp6-internal.h  |   2 +
  src/libsystemd-network/dhcp6-protocol.h  |   6 +
  src/libsystemd-network/sd-dhcp6-client.c | 219 
 ++-
  3 files changed, 225 insertions(+), 2 deletions(-)
 
 diff --git a/src/libsystemd-network/dhcp6-internal.h 
 b/src/libsystemd-network/dhcp6-internal.h
 index ec1d82a..94e3a5d 100644
 --- a/src/libsystemd-network/dhcp6-internal.h
 +++ b/src/libsystemd-network/dhcp6-internal.h
 @@ -75,3 +75,5 @@ int dhcp6_network_send_udp_socket(int s, struct in6_addr 
 *address,
  
  const char *dhcp6_message_type_to_string(int s) _const_;
  int dhcp6_message_type_from_string(const char *s) _pure_;
 +const char *dhcp6_message_status_to_string(int s) _const_;
 +int dhcp6_message_status_from_string(const char *s) _pure_;
 diff --git a/src/libsystemd-network/dhcp6-protocol.h 
 b/src/libsystemd-network/dhcp6-protocol.h
 index de100d7..e8df509 100644
 --- a/src/libsystemd-network/dhcp6-protocol.h
 +++ b/src/libsystemd-network/dhcp6-protocol.h
 @@ -21,6 +21,9 @@
along with systemd; If not, see http://www.gnu.org/licenses/.
  ***/
  
 +#include netinet/ip6.h
 +#include netinet/udp.h
 +
  #include macro.h
  #include sparse-endian.h
  
 @@ -36,6 +39,9 @@ struct DHCP6Message {
  
  typedef struct DHCP6Message DHCP6Message;
  
 +#define DHCP6_MIN_OPTIONS_SIZE \
 +1280 - sizeof(struct ip6_hdr) - sizeof(struct udphdr)
 +
  #define IN6ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS_INIT \
  { { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02 } } }
 diff --git a/src/libsystemd-network/sd-dhcp6-client.c 
 b/src/libsystemd-network/sd-dhcp6-client.c
 index bdd9177..a18698c 100644
 --- a/src/libsystemd-network/sd-dhcp6-client.c
 +++ b/src/libsystemd-network/sd-dhcp6-client.c
 @@ -21,6 +21,7 @@
  
  #include errno.h
  #include string.h
 +#include sys/ioctl.h
  
  #include udev.h
  #include udev-util.h
 @@ -34,6 +35,7 @@
  #include dhcp6-protocol.h
  #include dhcp6-internal.h
  #include icmp6-nd.h
 +#include dhcp6-lease-internal.h
  
  #define SYSTEMD_PEN 43793
  #define HASH_KEY 
 SD_ID128_MAKE(80,11,8c,c2,fe,4a,03,ee,3e,d6,0c,6f,36,39,14,09)
 @@ -49,6 +51,7 @@ struct sd_dhcp6_client {
  icmp6_nd *ra;
  DHCP6IA ia_na;
  be32_t transaction_id;
 +struct sd_dhcp6_lease *lease;
  int fd;
  sd_event_source *receive_message;
  usec_t retransmit_time;
 @@ -83,6 +86,17 @@ const char * dhcp6_message_type_table[_DHCP6_MESSAGE_MAX] 
 = {
  
  DEFINE_STRING_TABLE_LOOKUP(dhcp6_message_type, int);
  
 +const char * dhcp6_message_status_table[_DHCP6_STATUS_MAX] = {
 +[DHCP6_STATUS_SUCCESS] = Success,
 +[DHCP6_STATUS_UNSPEC_FAIL] = Unspecified failure,
 +[DHCP6_STATUS_NO_ADDRS_AVAIL] = No addresses available,
 +[DHCP6_STATUS_NO_BINDING] = Binding unavailable,
 +[DHCP6_STATUS_NOT_ON_LINK] = Not on link,
 +[DHCP6_STATUS_USE_MULTICAST] = Use multicast,
 +};
 +
 +DEFINE_STRING_TABLE_LOOKUP(dhcp6_message_status, int);
 +
  int sd_dhcp6_client_set_callback(sd_dhcp6_client *client,
   sd_dhcp6_client_cb_t cb, void *userdata)
  {
 @@ -381,9 +395,210 @@ static int client_ensure_iaid(sd_dhcp6_client *client) {
  return 0;
  }
  
 +static int client_parse_message(sd_dhcp6_client *client,
 +DHCP6Message *message, size_t len,
 +sd_dhcp6_lease *lease) {
 +int r;
 +uint8_t *optval, *option = (uint8_t *)(message + 1), *id = NULL;
 +uint16_t optcode, status;
 +size_t optlen, id_len;
 +bool clientid = false;
 +be32_t iaid_lease;
 +
 +while ((r = dhcp6_option_parse(option, len, optcode, optlen,
 +   optval)) = 0) {
 +switch (optcode) {
 +case DHCP6_OPTION_CLIENTID:
 +if (clientid) {
 +log_dhcp6_client(client, %s contains 
 multiple clientids,
 + 
 dhcp6_message_type_to_string(message-type));
 +return -EINVAL;
 +}
 +
 +if (optlen != sizeof(client-duid) ||
 +memcmp(client-duid, optval, optlen) != 0) {
 +log_dhcp6_client(client, %s DUID 

Re: [systemd-devel] [PATCH 24/24] networkd: Add initial DHCPv6 support

2014-06-18 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Jun 13, 2014 at 04:45:14PM +0300, Patrik Flykt wrote:
 Enable DHCPv6 support by creating a DHCPv6 boolean in the Network
 section. Add necessary dhcp6 structures and initial function calls.
 ---
  src/network/networkd-link.c  | 75 
 
  src/network/networkd-network-gperf.gperf |  1 +
  src/network/networkd.h   |  3 ++
  3 files changed, 79 insertions(+)
 
 diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
 index 3653426..507e82d 100644
 --- a/src/network/networkd-link.c
 +++ b/src/network/networkd-link.c
 @@ -120,6 +120,8 @@ static void link_free(Link *link) {
  
  sd_ipv4ll_unref(link-ipv4ll);
  
 +sd_dhcp6_client_unref(link-dhcp6_client);
 +
  hashmap_remove(link-manager-links, link-ifindex);
  
  free(link-ifname);
 @@ -231,6 +233,17 @@ static int link_stop_clients(Link *link) {
  }
  }
  
 +if (link-network-dhcp6) {
 +assert(link-dhcp6_client);
 +
 +k = sd_dhcp6_client_stop(link-dhcp6_client);
 +if (k  0) {
 +log_warning_link(link, Could not stop DHCPv6 
 + client: %s, strerror(-r));

 +log_warning_link(link, could not acquire DHCPv6 
 + lease);

 +log_warning_link(link, Could not 
 + update MAC address 
 
 + in DHCPv6 client: 
 %s,
 + strerror(-r));

Those multi-line strings are both hard to read, and hard to grep for,
when looking for the source of an error messsage. Normally the line
length restrictions are better ignored for single line message
strings.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 12/24] sd-dhcp6-client: Add DHCPv6 Solicit message creation and sending

2014-06-18 Thread Zbigniew Jędrzejewski-Szmek
On Wed, Jun 18, 2014 at 07:05:35AM -0700, Filipe Brandenburger wrote:
 On Wed, Jun 18, 2014 at 6:58 AM, Zbigniew Jędrzejewski-Szmek
 zbys...@in.waw.pl wrote:
  +if (client-fd  0)
  +safe_close(client-fd);
  +client-fd = -1;
  client-fd = safe_close(client-fd);
 
  That's what safe_close is for :)
 
 And shouldn't the check be for client-fd = 0? Zero is a valid file 
 descriptor.
Yeah... but note that safe_close already has the fd = 0 check, so the
replacement line replaces the if too.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 02/24] sd-dhcp6-client: Add Router Solicitation and Advertisement support

2014-06-18 Thread Zbigniew Jędrzejewski-Szmek
On Wed, Jun 18, 2014 at 03:24:31PM +0200, Tom Gundersen wrote:
  Did anyone have further comments on this initial patch set? Shall I send
  the updated version to the mailing list or how do we want to proceed?
 
 Go ahead and push. It is probably simpler to make further
 suggestions/comments in terms of patches anyway.
Agreed. I made some small comments, but the patch set looks great.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Systemd-networkd: Prepend static nameserver to DHCP-discovered nameservers

2014-06-18 Thread Runiq

On 17.06.2014 14:43:25, Mantas Mikulėnas wrote:

On Jun 17, 2014 2:14 PM, Runiq ru...@archlinux.us wrote:


Hello all,

I'm using systemd 213 on Arch Linux, and systemd-networkd/resolved with
DHCP to connect to the internet. I'm also running a caching DNS server on
127.0.0.1.

I'd like to make this caching server the first DNS server in the list, but
I'd also like to use the nameservers discovered by systemd-resolved. Using
a static resolv.conf isn't really possible, because I connect to networks
with different DNS settings.


Actually, one thing I just remembered.

resolved never actually writes to /etc/resolv.conf, if I remember 
correctly. It only writes to a .conf in /run, and /etc/resolv.conf is 
just a symlink to the latter.


I know, I set that symlink up manually because I wasn't sure whether the 
file in /run would be created at all if the symlink wasn't in place. The 
manpage for systemd-resolved also states that the resolv.conf file in 
/run shouldn't be used directly but only by symlinking it to 
/etc/resolv.conf -- so I thought I'd ask on the mailing list before 
doing what you describe:


So you could just have a static /etc/resolv.conf with 127.0.0.1 in it, 
and tell your cache to look in /run/systemd/resolv.conf for the 
upstream servers' addresses. I'm sure at least dnsmasq has that 
ability.


Yep, that's basically what I'm doing now after looking over the dnsmasq 
config file (I symlinked /run/systemd/network/resolv.conf to 
/etc/resolv-networkd.conf and use that). Thanks for pointing me into 
this direction, everything works as intended now!


Cheers,
Patrice


pgpcMemnYwJ9T.pgp
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] localization of console

2014-06-18 Thread Alexey Shabalin
Hello.

I do not understand how the should work localization of console.
- systemd-vconsole-setup.service for an early boot (for enter password
in cryptsetup? but people do not used non-latin letters for password)

- getty@.service contains TTYReset=yes (or
https://bugzilla.redhat.com/show_bug.cgi?id=972635  but i use
kernel-3.14.6), and all  previous font and kbd settings reseted

I see package workaround-cyrillic-console in Russian Fedora:
https://github.com/RussianFedora/workaround-cyrillic-console
contain unit setup-cyrfont@.service:

After=getty@%i.service
BindsTo=getty@%i.service
Requires=getty@%i.service
IgnoreOnIsolate=yes
[Service]
ExecStart=/usr/bin/setfont -C /dev/%i latarcyrheb-sun16
Type=oneshot

For ALTLinux i was add systemd-vconsole-setup@.service unit:

After=getty@%i.service
BindsTo=getty@%i.service
Requires=getty@%i.service
IgnoreOnIsolate=yes
[Service]
Type=oneshot
ExecStart=/lib/systemd/systemd-vconsole-setup /dev/%i


May be exist better way for localization?


-- 
Alexey Shabalin
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 10/11] Avoid doubling the efforts for /var/log/journal

2014-06-18 Thread Goffredo Baroncelli
Hi Fink

On 06/13/2014 04:41 PM, Werner Fink wrote:
 That is: set NOATIME, NOCOW, and NOCOMP for the journal directory
 
 ---
  src/journal/journald-server.c |   29 +++--
  1 file changed, 27 insertions(+), 2 deletions(-)
 
 diff --git src/journal/journald-server.c src/journal/journald-server.c
 index eda5dcf..37d6dc3 100644
 --- src/journal/journald-server.c
 +++ src/journal/journald-server.c
 @@ -21,6 +21,7 @@
  
  #include sys/signalfd.h
  #include sys/ioctl.h
 +#include linux/fs.h
  #include linux/sockios.h
  #include sys/statvfs.h
  #include sys/mman.h
 @@ -920,7 +921,7 @@ finish:
  
  
  static int system_journal_open(Server *s) {
 -int r;
 +int r, fd;
  char *fn;
  sd_id128_t machine;
  char ids[33];
 @@ -947,7 +948,31 @@ static int system_journal_open(Server *s) {
  (void) mkdir(/var/log/journal/, 0755);
  
  fn = strappenda(/var/log/journal/, ids);
 -(void) mkdir(fn, 0755);
 +(void)mkdir(fn, 0755);
 +
 +/*
 + * On journaling and/or compressing file systems avoid 
 doubling the
 + * efforts for the system, that is set NOCOW and NOCOMP 
 inode flags.
 + * Check for every single flag as otherwise some of the file 
 systems
 + * may return EOPNOTSUPP on one unkown flag (like BtrFS 
 does).
 + */
 +if ((fd = open(fn, O_DIRECTORY)) = 0) {
 +long flags;
 +if (ioctl(fd, FS_IOC_GETFLAGS, flags) == 0) {
 +int old = flags;
 +if (!(flagsFS_NOATIME_FL)  ioctl(fd, 
 FS_IOC_SETFLAGS, flags|FS_NOATIME_FL) == 0)
 +flags |= FS_NOATIME_FL;
 +if (!(flagsFS_NOCOW_FL)  ioctl(fd, 
 FS_IOC_SETFLAGS, flags|FS_NOCOW_FL) == 0)
 +flags |= FS_NOCOW_FL;

If I read correctly, you want set UN-conditionally the NOCOW behavior. Please, 
please, please DON'T DO that.

The NOCOW behavior is not without disadvantage: yes it increase the performance 
but
the file also lost the btrfs checksum protection; when BTRFS manage the disks 
in RAID mode and a corruption happens, it uses the checksum to select the 
correct mirror during the reading. If you set UN-conditionally the NOCOW 
behavior you lost this capability even if the user _want it_ (and if they spend 
moneys in two or more disks, it is likely they _want it_).

Moreover the NOCOW flags has some strange behavior when a NOCOW file is 
snapshotted (it lost the NOCOW property); this may lead to irregular 
performance.

If you want it, it must be configurable at least with a sane default (which 
IMHO should be do nothing, following the least surprise rule).

If you are looking to something like that, I suggest also to defrag the journal 
file before the open (but still as configurable option, and considering the 
least surprise rule).

BR
G.Baroncelli

 +if (!(flagsFS_NOCOMP_FL)  s-compress) {
 +flags = ~FS_COMPR_FL;
 +flags |= FS_NOCOMP_FL;
 +}
 +if (old != flags)
 +ioctl(fd, FS_IOC_SETFLAGS, flags);
 +}
 +close(fd);
 +}
  
  fn = strappenda(fn, /system.journal);
  r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, 
 s-compress, s-seal, s-system_metrics, s-mmap, NULL, s-system_journal);
 


-- 
gpg @keyserver.linux.it: Goffredo Baroncelli (kreijackATinwind.it
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] udevd: skip cd/dvd devices in synthesize_change

2014-06-18 Thread Robert Milasan
If we are running udevd from a LiveCD or ISO image, it can happen that
udevd wont find the cd/dvd in time, causing a failure.

I've attached the patch which seems to fix the issue.

-- 
Robert Milasan

L3 Support Engineer
SUSE Linux (http://www.suse.com)
email: rmila...@suse.com
GPG fingerprint: B6FE F4A8 0FA3 3040 3402  6FE7 2F64 167C 1909 6D1A
From 37ff27dcd84dd835b2e148b86044c3ad5fd8 Mon Sep 17 00:00:00 2001
From: Robert Milasan rmila...@suse.com
Date: Wed, 18 Jun 2014 15:35:27 +0200
Subject: [PATCH] udevd: ignore cd/dvd devices in synthesize_change as it can causes
 issue when udev is running from an ISO image.

Signed-off-by: Robert Milasan rmila...@suse.com
---
 src/udev/udevd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index aed1149..56cf7ea 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -741,7 +741,8 @@ static int synthesize_change(struct udev_device *dev) {
 
 if (streq_ptr(block, udev_device_get_subsystem(dev)) 
 streq_ptr(disk, udev_device_get_devtype(dev)) 
-!startswith(udev_device_get_sysname(dev), dm-)) {
+!startswith(udev_device_get_sysname(dev), dm-) 
+!startswith(udev_device_get_sysname(dev), sr)) {
 bool part_table_read = false;
 bool has_partitions = false;
 int fd;
-- 
1.8.4.5

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] udevd: skip cd/dvd devices in synthesize_change

2014-06-18 Thread Kay Sievers
On Wed, Jun 18, 2014 at 8:17 PM, Robert Milasan rmila...@suse.com wrote:
 If we are running udevd from a LiveCD or ISO image, it can happen that
 udevd wont find the cd/dvd in time, causing a failure.

 I've attached the patch which seems to fix the issue.

Change events are triggered when some tool has opened the device for
writing and closes the file descriptor. That sounds pretty strange
with a Live CD on /dev/sr0.

All we do in the code you patch here is to look for possible partitions.

Are you sure that this is really the problem?

Kay
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] udevd: skip cd/dvd devices in synthesize_change

2014-06-18 Thread Robert Milasan
On Wed, 18 Jun 2014 20:57:35 +0200
Kay Sievers k...@vrfy.org wrote:

 On Wed, Jun 18, 2014 at 8:17 PM, Robert Milasan rmila...@suse.com
 wrote:
  If we are running udevd from a LiveCD or ISO image, it can happen
  that udevd wont find the cd/dvd in time, causing a failure.
 
  I've attached the patch which seems to fix the issue.
 
 Change events are triggered when some tool has opened the device for
 writing and closes the file descriptor. That sounds pretty strange
 with a Live CD on /dev/sr0.
 
 All we do in the code you patch here is to look for possible
 partitions.
 
 Are you sure that this is really the problem?
 
 Kay
 

From our tests yes, but you can wait with pushing the patch for a while
until I get a better confirmation.


-- 
Robert Milasan

L3 Support Engineer
SUSE Linux (http://www.suse.com)
email: rmila...@suse.com
GPG fingerprint: B6FE F4A8 0FA3 3040 3402  6FE7 2F64 167C 1909 6D1A
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] systemd-networkd: no network connectivity with 214/master due to 63a070415db09f5b5bcc5c

2014-06-18 Thread Friedrich Kröner
Hello,

when trying systemd-networkd with =214 and the following config:

[Match]
Name=eth*

[Network]
DHCP=yes

Address=2001:db8::1234:5678/64
DNS=8.8.8.8
DNS=2001:db8:1::ab9:C0A8:102


I get lots of DHCP DISCOVER events and it doesn't aquire an IPv4 address, nor 
sets the configured IPv6.

Jun 18 18:44:31 localhost systemd[1]: Starting Network Service...
Jun 18 18:44:31 localhost systemd-networkd[19468]: timestamp of 
'/etc/systemd/network' changed
Jun 18 18:44:31 localhost systemd-networkd[19468]: sd-rtnl: discarding 20 
bytes of incoming message
Jun 18 18:44:31 localhost systemd-networkd[19468]: eth0: link 3 
added
Jun 18 18:44:31 localhost systemd-networkd[19468]: eth0: udev 
initialized link
Jun 18 18:44:31 localhost systemd-networkd[19468]: eth0: flags 
change: +UP +LOWER_UP +RUNNING +MULTICAST +BROADCAST
Jun 18 18:44:31 localhost systemd-networkd[19468]: eth0: gained 
carrier
Jun 18 18:44:31 localhost systemd-networkd[19468]: could not add new link
Jun 18 18:44:31 localhost systemd-networkd[19468]: lo  : link 1 
added
Jun 18 18:44:31 localhost systemd-networkd[19468]: lo  : udev 
initialized link
Jun 18 18:44:31 localhost systemd-networkd[19468]: lo  : flags 
change: +LOOPBACK +UP +LOWER_UP +RUNNING
Jun 18 18:44:31 localhost systemd-networkd[19468]: lo  : gained 
carrier
Jun 18 18:44:31 localhost systemd[1]: Started Network Service.
Jun 18 18:44:31 localhost systemd-networkd[19468]: eth0: link 
state is up-to-date
Jun 18 18:44:31 localhost systemd-networkd[19468]: eth0: found 
matching network '/etc/systemd/network/80-dhcp.network'
Jun 18 18:44:31 localhost systemd-networkd[19468]: eth0: acquiring 
DHCPv4 lease
Jun 18 18:44:31 localhost systemd-networkd[19468]: DHCP CLIENT (0x3ddf8f7): 
STARTED on ifindex 3 with address 52:54:e4:d2:24:44
Jun 18 18:44:31 localhost systemd-networkd[19468]: Sent message 
type=method_call sender=n/a destination=org.freedesktop.DBus 
object=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello 
cookie=1 reply_cookie=0 error=n/a
Jun 18 18:44:31 localhost systemd-networkd[19468]: DHCP CLIENT (0x3ddf8f7): 
DISCOVER
Jun 18 18:44:31 localhost systemd-networkd[19468]: lo  : getting 
address failed: Device or resource busy
Jun 18 18:44:31 localhost systemd-networkd[19468]: lo  : link 
state is up-to-date
Jun 18 18:44:31 localhost systemd-networkd[19468]: lo  : unmanaged
Jun 18 18:44:31 localhost systemd-networkd[19468]: sd-rtnl: discarding 20 
bytes of incoming message
Jun 18 18:44:31 localhost systemd-networkd[19468]: eth0: added 
address: fe80::5054:e4ff:fed2:2444/64
Jun 18 18:44:31 localhost systemd-networkd[19468]: rtnl: received address for 
a nonexistent link, ignoring
Jun 18 18:44:31 localhost systemd-networkd[19468]: lo  : added 
address: ::1/128
Jun 18 18:44:31 localhost systemd-networkd[19468]: eth0: added 
address: 123.23.23.21/22
Jun 18 18:44:31 localhost systemd-networkd[19468]: lo  : added 
address: 127.0.0.1/8
Jun 18 18:44:31 localhost systemd-networkd[19468]: Got message 
type=method_return sender=org.freedesktop.DBus destination=:1.45 object=n/a 
interface=n/a member=n/a cookie=1 reply_cookie=1 error=n/a 
Jun 18 18:44:31 localhost systemd-networkd[19468]: Got message type=signal 
sender=org.freedesktop.DBus destination=:1.45 object=/org/freedesktop/DBus 
interface=org.freedesktop.DBus member=NameAcquired cookie=2 reply_cookie=0 
error=n/a
Jun 18 18:44:33 localhost systemd-networkd[19468]: DHCP CLIENT (0x3ddf8f7): 
DISCOVER
Jun 18 18:44:34 localhost systemd-networkd[19468]: DHCP CLIENT (0x3ddf8f7): 
DISCOVER
Jun 18 18:44:38 localhost systemd-networkd[19468]: DHCP CLIENT (0x3ddf8f7): 
DISCOVER
Jun 18 18:44:46 localhost systemd-networkd[19468]: DHCP CLIENT (0x3ddf8f7): 
DISCOVER
Jun 18 18:45:02 localhost systemd-networkd[19468]: DHCP CLIENT (0x3ddf8f7): 
DISCOVER
Jun 18 18:45:33 localhost systemd-networkd[19468]: DHCP CLIENT (0x3ddf8f7): 
DISCOVER
Jun 18 18:46:36 localhost systemd-networkd[19468]: DHCP CLIENT (0x3ddf8f7): 
DISCOVER
Jun 18 18:47:41 localhost systemd-networkd[19468]: DHCP CLIENT (0x3ddf8f7): 
DISCOVER
Jun 18 18:48:44 localhost systemd-networkd[19468]: DHCP CLIENT (0x3ddf8f7): 
DISCOVER

reverting commit 63a070415db09f5b5bcc5c sd-dhcp-client: allways request 
broadcast 
restores the previous behavior. Upon restart of systemd-networkd I get the 
usual OFFER, REQUEST, ACK confirmation and the IPv6 gets set as well.

This is on a kvm-machine with virtio_net as module.

Please let me know if you want me to test anything or need further 
information.
Thank you,
Friedrich Kröner

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] localization of console

2014-06-18 Thread Jason St. John
On Wed, Jun 18, 2014 at 12:19 PM, Alexey Shabalin a.shaba...@gmail.com wrote:
 Hello.

 I do not understand how the should work localization of console.
 - systemd-vconsole-setup.service for an early boot (for enter password
 in cryptsetup? but people do not used non-latin letters for password)

 - getty@.service contains TTYReset=yes (or
 https://bugzilla.redhat.com/show_bug.cgi?id=972635  but i use
 kernel-3.14.6), and all  previous font and kbd settings reseted

 I see package workaround-cyrillic-console in Russian Fedora:
 https://github.com/RussianFedora/workaround-cyrillic-console
 contain unit setup-cyrfont@.service:

 After=getty@%i.service
 BindsTo=getty@%i.service
 Requires=getty@%i.service
 IgnoreOnIsolate=yes
 [Service]
 ExecStart=/usr/bin/setfont -C /dev/%i latarcyrheb-sun16
 Type=oneshot

 For ALTLinux i was add systemd-vconsole-setup@.service unit:

 After=getty@%i.service
 BindsTo=getty@%i.service
 Requires=getty@%i.service
 IgnoreOnIsolate=yes
 [Service]
 Type=oneshot
 ExecStart=/lib/systemd/systemd-vconsole-setup /dev/%i


 May be exist better way for localization?


 --
 Alexey Shabalin

What Linux distribution are you using?

On my Arch Linux systems, I configured the font and keymap (keyboard
layout) in /etc/vconsole.conf, and for the initial RAM disk, I put the
consolefont and keymap hooks before the encrypt hook in
/etc/mkinitcpio.conf. This lets me use an alternate keyboard layout
for entering the encryption passphrase. I think something similar to
this is what you are looking for, but adapted to whichever Linux
distribution you are using.

Jason
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] dd-dhcp-server: fix a leak

2014-06-18 Thread Thomas H.P. Andersen
On Fri, Jun 13, 2014 at 10:58 PM, Thomas H.P. Andersen pho...@gmail.com wrote:
 From: Thomas Hindoe Paaboel Andersen pho...@gmail.com

 We must use free instead of dhcp_lease_free here to avoid freeing
 client_id.data.
 ---
  src/libsystemd-network/sd-dhcp-server.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

 diff --git a/src/libsystemd-network/sd-dhcp-server.c 
 b/src/libsystemd-network/sd-dhcp-server.c
 index 17c19cc..38f93c1 100644
 --- a/src/libsystemd-network/sd-dhcp-server.c
 +++ b/src/libsystemd-network/sd-dhcp-server.c
 @@ -694,8 +694,10 @@ int dhcp_server_handle_message(sd_dhcp_server *server, 
 DHCPMessage *message,
  lease-address = req-requested_ip;
  lease-client_id.data = 
 memdup(req-client_id.data,
 
 req-client_id.length);
 -if (!lease-client_id.data)
 +if (!lease-client_id.data) {
 +free(lease);
  return -ENOMEM;
 +}
  lease-client_id.length = 
 req-client_id.length;
  } else
  lease = existing_lease;
 --
 1.9.3


I ended up committing this one directly with a some other patches.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] localization of console

2014-06-18 Thread Alexey Shabalin
2014-06-19 0:06 GMT+04:00 Jason St. John jstj...@purdue.edu:
 On Wed, Jun 18, 2014 at 12:19 PM, Alexey Shabalin a.shaba...@gmail.com 
 wrote:
 Hello.

 I do not understand how the should work localization of console.
 - systemd-vconsole-setup.service for an early boot (for enter password
 in cryptsetup? but people do not used non-latin letters for password)

 - getty@.service contains TTYReset=yes (or
 https://bugzilla.redhat.com/show_bug.cgi?id=972635  but i use
 kernel-3.14.6), and all  previous font and kbd settings reseted

 I see package workaround-cyrillic-console in Russian Fedora:
 https://github.com/RussianFedora/workaround-cyrillic-console
 contain unit setup-cyrfont@.service:

 After=getty@%i.service
 BindsTo=getty@%i.service
 Requires=getty@%i.service
 IgnoreOnIsolate=yes
 [Service]
 ExecStart=/usr/bin/setfont -C /dev/%i latarcyrheb-sun16
 Type=oneshot

 For ALTLinux i was add systemd-vconsole-setup@.service unit:

 After=getty@%i.service
 BindsTo=getty@%i.service
 Requires=getty@%i.service
 IgnoreOnIsolate=yes
 [Service]
 Type=oneshot
 ExecStart=/lib/systemd/systemd-vconsole-setup /dev/%i


 May be exist better way for localization?

 What Linux distribution are you using?

 On my Arch Linux systems, I configured the font and keymap (keyboard
 layout) in /etc/vconsole.conf, and for the initial RAM disk, I put the
 consolefont and keymap hooks before the encrypt hook in
 /etc/mkinitcpio.conf. This lets me use an alternate keyboard layout
 for entering the encryption passphrase. I think something similar to
 this is what you are looking for, but adapted to whichever Linux
 distribution you are using.

Oh, sorry. I have not problems with encryption passphrase.
I can not see my font after getty@.service, after login.
I think because TTYReset=yes in getty@.service, and it reset my font settings.
My question is how to see my font in console.

PS: i am use ALTLinux, but think some problem in fedora too.


-- 
Alexey Shabalin
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] dd-dhcp-server: fix a leak

2014-06-18 Thread Tom Gundersen
Thanks, and sorry for not getting to this sooner.

Cheers,

Tom

On Wed, Jun 18, 2014 at 11:49 PM, Thomas H.P. Andersen pho...@gmail.com wrote:
 On Fri, Jun 13, 2014 at 10:58 PM, Thomas H.P. Andersen pho...@gmail.com 
 wrote:
 From: Thomas Hindoe Paaboel Andersen pho...@gmail.com

 We must use free instead of dhcp_lease_free here to avoid freeing
 client_id.data.
 ---
  src/libsystemd-network/sd-dhcp-server.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

 diff --git a/src/libsystemd-network/sd-dhcp-server.c 
 b/src/libsystemd-network/sd-dhcp-server.c
 index 17c19cc..38f93c1 100644
 --- a/src/libsystemd-network/sd-dhcp-server.c
 +++ b/src/libsystemd-network/sd-dhcp-server.c
 @@ -694,8 +694,10 @@ int dhcp_server_handle_message(sd_dhcp_server *server, 
 DHCPMessage *message,
  lease-address = req-requested_ip;
  lease-client_id.data = 
 memdup(req-client_id.data,
 
 req-client_id.length);
 -if (!lease-client_id.data)
 +if (!lease-client_id.data) {
 +free(lease);
  return -ENOMEM;
 +}
  lease-client_id.length = 
 req-client_id.length;
  } else
  lease = existing_lease;
 --
 1.9.3


 I ended up committing this one directly with a some other patches.
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] localization of console

2014-06-18 Thread Andrey Borzenkov
В Thu, 19 Jun 2014 02:04:53 +0400
Alexey Shabalin a.shaba...@gmail.com пишет:

 2014-06-19 0:06 GMT+04:00 Jason St. John jstj...@purdue.edu:
  On Wed, Jun 18, 2014 at 12:19 PM, Alexey Shabalin a.shaba...@gmail.com 
  wrote:
  Hello.
 
  I do not understand how the should work localization of console.
  - systemd-vconsole-setup.service for an early boot (for enter password
  in cryptsetup? but people do not used non-latin letters for password)
 
  - getty@.service contains TTYReset=yes (or
  https://bugzilla.redhat.com/show_bug.cgi?id=972635  but i use
  kernel-3.14.6), and all  previous font and kbd settings reseted
 
  I see package workaround-cyrillic-console in Russian Fedora:
  https://github.com/RussianFedora/workaround-cyrillic-console
  contain unit setup-cyrfont@.service:
 
  After=getty@%i.service
  BindsTo=getty@%i.service
  Requires=getty@%i.service
  IgnoreOnIsolate=yes
  [Service]
  ExecStart=/usr/bin/setfont -C /dev/%i latarcyrheb-sun16
  Type=oneshot
 
  For ALTLinux i was add systemd-vconsole-setup@.service unit:
 
  After=getty@%i.service
  BindsTo=getty@%i.service
  Requires=getty@%i.service
  IgnoreOnIsolate=yes
  [Service]
  Type=oneshot
  ExecStart=/lib/systemd/systemd-vconsole-setup /dev/%i
 
 
  May be exist better way for localization?
 
  What Linux distribution are you using?
 
  On my Arch Linux systems, I configured the font and keymap (keyboard
  layout) in /etc/vconsole.conf, and for the initial RAM disk, I put the
  consolefont and keymap hooks before the encrypt hook in
  /etc/mkinitcpio.conf. This lets me use an alternate keyboard layout
  for entering the encryption passphrase. I think something similar to
  this is what you are looking for, but adapted to whichever Linux
  distribution you are using.
 
 Oh, sorry. I have not problems with encryption passphrase.
 I can not see my font after getty@.service, after login.

Are you using graphical plymouth (or may be another boot splash screen)?

 I think because TTYReset=yes in getty@.service, and it reset my font settings.
 My question is how to see my font in console.
 
 PS: i am use ALTLinux, but think some problem in fedora too.
 
 

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel