Re: [systemd-devel] [PATCH v3 01/26] dhcp: Add DHCP protocol structures and initial defines

2013-12-12 Thread Marcel Holtmann
Hi Patrik,

>> I agree with Zbigniew: this should probably be in
>> src/libsystemd-dhcp/, so that this is similar to libsystemd-bus/,
>> libsystemd-id128/ and so on...
> 
> Sent a patch for that, and in the process of creating an account on
> freedesktop.org. As that will most probably take some time, someone with
> proper access could bite the bullet...

I will take care of getting these patches committed. Can you just send an 
updated version with everything in place in the right location.

Regards

Marcel

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


Re: [systemd-devel] [PATCH v3 01/26] dhcp: Add DHCP protocol structures and initial defines

2013-12-12 Thread Patrik Flykt
On Tue, 2013-12-10 at 18:48 +0100, Lennart Poettering wrote:
> I agree with Zbigniew: this should probably be in
> src/libsystemd-dhcp/, so that this is similar to libsystemd-bus/,
> libsystemd-id128/ and so on...

Sent a patch for that, and in the process of creating an account on
freedesktop.org. As that will most probably take some time, someone with
proper access could bite the bullet...

Cheers,

Patrik


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


Re: [systemd-devel] [PATCH v3 01/26] dhcp: Add DHCP protocol structures and initial defines

2013-12-10 Thread Lennart Poettering
On Tue, 10.12.13 18:12, Marcel Holtmann (mar...@holtmann.org) wrote:

> Hi Lennart,
> 
>  +uint32_t ciaddr;
>  +uint32_t yiaddr;
>  +uint32_t siaddr;
>  +uint32_t giaddr;
> >>> 
> >>> Hmmm, why uin32_t? Shouldn't this be32_t? THis is network byte order,
> >>> right? which is just synoymous to big endian...
> >>> 
> >>> Or even, if you now use "struct in_addr" elsewhere anyway, why not
> >>> just use that here too?
> >> 
> >> be32_t seems reasonable, the 'struct in_addr' was deemed to add slightly
> >> too much cruft without being particularly useful in internal code. What
> >> if we figure out whether this patch set is otherwise reasonable and fix
> >> this and add the remaining parts of DHCP in a coming patch set?
> >> Meanwhile Tom could take the code for an official test spin...
> > 
> > This code looks as if it's ready to be merged. WHatever else comes up
> > can be fixed post-commit. I think it would be best if you'd get commit
> > access so that you can maintain this.
> 
> are you fine with the layout of files and directories? Then I can start 
> handling maintaining it and dealing with patches.

I agree with Zbigniew: this should probably be in src/libsystemd-dhcp/,
so that this is similar to libsystemd-bus/, libsystemd-id128/ and so
on...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH v3 01/26] dhcp: Add DHCP protocol structures and initial defines

2013-12-10 Thread Marcel Holtmann
Hi Lennart,

 +uint32_t ciaddr;
 +uint32_t yiaddr;
 +uint32_t siaddr;
 +uint32_t giaddr;
>>> 
>>> Hmmm, why uin32_t? Shouldn't this be32_t? THis is network byte order,
>>> right? which is just synoymous to big endian...
>>> 
>>> Or even, if you now use "struct in_addr" elsewhere anyway, why not
>>> just use that here too?
>> 
>> be32_t seems reasonable, the 'struct in_addr' was deemed to add slightly
>> too much cruft without being particularly useful in internal code. What
>> if we figure out whether this patch set is otherwise reasonable and fix
>> this and add the remaining parts of DHCP in a coming patch set?
>> Meanwhile Tom could take the code for an official test spin...
> 
> This code looks as if it's ready to be merged. WHatever else comes up
> can be fixed post-commit. I think it would be best if you'd get commit
> access so that you can maintain this.

are you fine with the layout of files and directories? Then I can start 
handling maintaining it and dealing with patches.

Regards

Marcel

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


Re: [systemd-devel] [PATCH v3 01/26] dhcp: Add DHCP protocol structures and initial defines

2013-12-10 Thread Lennart Poettering
On Tue, 10.12.13 14:15, Patrik Flykt (patrik.fl...@linux.intel.com) wrote:

> 
> On Tue, 2013-12-10 at 02:46 +0100, Lennart Poettering wrote:
> > > +uint32_t ciaddr;
> > > +uint32_t yiaddr;
> > > +uint32_t siaddr;
> > > +uint32_t giaddr;
> > 
> > Hmmm, why uin32_t? Shouldn't this be32_t? THis is network byte order,
> > right? which is just synoymous to big endian...
> > 
> > Or even, if you now use "struct in_addr" elsewhere anyway, why not
> > just use that here too?
> 
> be32_t seems reasonable, the 'struct in_addr' was deemed to add slightly
> too much cruft without being particularly useful in internal code. What
> if we figure out whether this patch set is otherwise reasonable and fix
> this and add the remaining parts of DHCP in a coming patch set?
> Meanwhile Tom could take the code for an official test spin...

This code looks as if it's ready to be merged. WHatever else comes up
can be fixed post-commit. I think it would be best if you'd get commit
access so that you can maintain this.

Could you request an fdo account if you don't have one please? If you
already do, please file a bug so that you get commit access to the
systemd repo.

http://www.freedesktop.org/wiki/AccountRequests/

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH v3 01/26] dhcp: Add DHCP protocol structures and initial defines

2013-12-10 Thread Tom Gundersen
On 10 Dec 2013 17:45, "Patrik Flykt"  wrote:
>
> On Tue, 2013-12-10 at 02:46 +0100, Lennart Poettering wrote:
> > > +uint32_t ciaddr;
> > > +uint32_t yiaddr;
> > > +uint32_t siaddr;
> > > +uint32_t giaddr;
> >
> > Hmmm, why uin32_t? Shouldn't this be32_t? THis is network byte order,
> > right? which is just synoymous to big endian...
> >
> > Or even, if you now use "struct in_addr" elsewhere anyway, why not
> > just use that here too?
>
> be32_t seems reasonable, the 'struct in_addr' was deemed to add slightly
> too much cruft without being particularly useful in internal code. What
> if we figure out whether this patch set is otherwise reasonable and fix
> this and add the remaining parts of DHCP in a coming patch set?
> Meanwhile Tom could take the code for an official test spin...

Sounds reasonable to me. I'm mostly afk this week, but should be able to
get it done next week. Do you have a public got repo I could easily pull
from?

Cheers,

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


Re: [systemd-devel] [PATCH v3 01/26] dhcp: Add DHCP protocol structures and initial defines

2013-12-10 Thread Patrik Flykt
On Tue, 2013-12-10 at 02:46 +0100, Lennart Poettering wrote:
> > +uint32_t ciaddr;
> > +uint32_t yiaddr;
> > +uint32_t siaddr;
> > +uint32_t giaddr;
> 
> Hmmm, why uin32_t? Shouldn't this be32_t? THis is network byte order,
> right? which is just synoymous to big endian...
> 
> Or even, if you now use "struct in_addr" elsewhere anyway, why not
> just use that here too?

be32_t seems reasonable, the 'struct in_addr' was deemed to add slightly
too much cruft without being particularly useful in internal code. What
if we figure out whether this patch set is otherwise reasonable and fix
this and add the remaining parts of DHCP in a coming patch set?
Meanwhile Tom could take the code for an official test spin...


Cheers,

Patrik


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


Re: [systemd-devel] [PATCH v3 01/26] dhcp: Add DHCP protocol structures and initial defines

2013-12-09 Thread Lennart Poettering
On Mon, 09.12.13 23:43, Patrik Flykt (patrik.fl...@linux.intel.com) wrote:

> +struct DHCPMessage {
> +uint8_t op;
> +uint8_t htype;
> +uint8_t hlen;
> +uint8_t hops;
> +be32_t xid;
> +be16_t secs;
> +be16_t flags;
> +uint32_t ciaddr;
> +uint32_t yiaddr;
> +uint32_t siaddr;
> +uint32_t giaddr;

Hmmm, why uin32_t? Shouldn't this be32_t? THis is network byte order,
right? which is just synoymous to big endian...

Or even, if you now use "struct in_addr" elsewhere anyway, why not just
use that here too?

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH v3 01/26] dhcp: Add DHCP protocol structures and initial defines

2013-12-09 Thread Patrik Flykt
Create a new directory to host DHCP components.
---
 src/dhcp/protocol.h |  104 +++
 1 file changed, 104 insertions(+)
 create mode 100644 src/dhcp/protocol.h

diff --git a/src/dhcp/protocol.h b/src/dhcp/protocol.h
new file mode 100644
index 000..d375467
--- /dev/null
+++ b/src/dhcp/protocol.h
@@ -0,0 +1,104 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+  This file is part of systemd.
+
+  Copyright (C) 2013 Intel Corporation. All rights reserved.
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see .
+***/
+
+#include 
+#include 
+#include 
+
+#include "macro.h"
+#include "sparse-endian.h"
+
+struct DHCPMessage {
+uint8_t op;
+uint8_t htype;
+uint8_t hlen;
+uint8_t hops;
+be32_t xid;
+be16_t secs;
+be16_t flags;
+uint32_t ciaddr;
+uint32_t yiaddr;
+uint32_t siaddr;
+uint32_t giaddr;
+uint8_t chaddr[16];
+uint8_t sname[64];
+uint8_t file[128];
+} _packed_;
+
+typedef struct DHCPMessage DHCPMessage;
+
+struct DHCPPacket {
+struct iphdr ip;
+struct udphdr udp;
+DHCPMessage dhcp;
+} _packed_;
+
+typedef struct DHCPPacket DHCPPacket;
+
+enum DHCPState {
+DHCP_STATE_INIT = 0,
+DHCP_STATE_SELECTING= 1,
+DHCP_STATE_INIT_REBOOT  = 2,
+DHCP_STATE_REBOOTING= 3,
+DHCP_STATE_REQUESTING   = 4,
+DHCP_STATE_BOUND= 5,
+DHCP_STATE_RENEWING = 6,
+DHCP_STATE_REBINDING= 7,
+};
+
+typedef enum DHCPState DHCPState;
+
+enum {
+BOOTREQUEST = 1,
+BOOTREPLY   = 2,
+};
+
+enum {
+DHCP_DISCOVER   = 1,
+DHCP_OFFER  = 2,
+DHCP_REQUEST= 3,
+DHCP_DECLINE= 4,
+DHCP_ACK= 5,
+DHCP_NAK= 6,
+DHCP_RELEASE= 7,
+};
+
+enum {
+DHCP_OVERLOAD_FILE  = 1,
+DHCP_OVERLOAD_SNAME = 2,
+};
+
+enum {
+DHCP_OPTION_PAD = 0,
+DHCP_OPTION_SUBNET_MASK = 1,
+DHCP_OPTION_ROUTER  = 3,
+DHCP_OPTION_DOMAIN_NAME_SERVER  = 6,
+DHCP_OPTION_HOST_NAME   = 12,
+DHCP_OPTION_DOMAIN_NAME = 15,
+DHCP_OPTION_NTP_SERVER  = 42,
+DHCP_OPTION_REQUESTED_IP_ADDRESS= 50,
+DHCP_OPTION_OVERLOAD= 52,
+DHCP_OPTION_MESSAGE_TYPE= 53,
+DHCP_OPTION_PARAMETER_REQUEST_LIST  = 55,
+DHCP_OPTION_END = 255,
+};
-- 
1.7.10.4

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