2007-08-06 22:52:34

by Kevin K

[permalink] [raw]
Subject: sending raw packets via PPP

Is it possible to send raw packets via ppp under Linux?

More specifically, in 2.4 series kernels such as RH's 2.4.21-47 kernel?

I've trying to modify the DHCP 3.0.1 code provided with RH 3 so I can
send requests via a PPP connection (standard RS-232), and it is just
being dropped by the stack according to ifconfig and debug statements
in ppp_generic.c.

Thanks,
Kevin


2007-08-06 23:30:44

by James Carlson

[permalink] [raw]
Subject: Re: sending raw packets via PPP

Kevin K writes:
> Is it possible to send raw packets via ppp under Linux?
>
> More specifically, in 2.4 series kernels such as RH's 2.4.21-47 kernel?
>
> I've trying to modify the DHCP 3.0.1 code provided with RH 3 so I can
> send requests via a PPP connection (standard RS-232), and it is just
> being dropped by the stack according to ifconfig and debug statements
> in ppp_generic.c.

I'm not sure what sort of "raw" packets you're talking about (IP raw
or something else), but you shouldn't need to send any raw packets to
do this. DHCP runs over UDP, and, unlike Ethernet, there's no link
layer addressing to worry about.

--
James Carlson 42.703N 71.076W <[email protected]>

2007-08-07 00:24:44

by Kevin K

[permalink] [raw]
Subject: Re: sending raw packets via PPP


On Aug 6, 2007, at 6:30 PM, James Carlson wrote:

> Kevin K writes:
>> Is it possible to send raw packets via ppp under Linux?
>>
>> More specifically, in 2.4 series kernels such as RH's 2.4.21-47
>> kernel?
>>
>> I've trying to modify the DHCP 3.0.1 code provided with RH 3 so I can
>> send requests via a PPP connection (standard RS-232), and it is just
>> being dropped by the stack according to ifconfig and debug statements
>> in ppp_generic.c.
>
> I'm not sure what sort of "raw" packets you're talking about (IP raw
> or something else), but you shouldn't need to send any raw packets to
> do this. DHCP runs over UDP, and, unlike Ethernet, there's no link
> layer addressing to worry about.

I was basing the raw mode on comments in the DHCP source code about
problems in older Linux kernels with sending packets to
255.255.255.255 via normal IP. The DHCP source code therefore wants
to send raw packets (SOCKET_PACKET) (down to the ethernet addressing
info). I guess I thought I would need to do this too to fit in with
the existing source code.

I'll give it a try to see whether packets sent to 255.255.255.255 can
make it to ppp with the IP address unchanged.

Thanks,

2007-08-07 01:40:51

by Chris Fowler

[permalink] [raw]
Subject: Re: sending raw packets via PPP

On Mon, 2007-08-06 at 19:24 -0500, Kevin K wrote:
> The DHCP source code therefore wants
> to send raw packets (SOCKET_PACKET) (down to the ethernet addressing
> info).

I can imagine that would be the case. The box requesting the DHCP
address has no IP address. Therefore TCP/IP can not be used at that
point to communicate between the two. I've not had to look at the DHCP
code to see how this works.



2007-08-07 08:51:14

by Matt Keenan

[permalink] [raw]
Subject: Re: sending raw packets via PPP

Kevin K wrote:
>
> On Aug 6, 2007, at 6:30 PM, James Carlson wrote:
>
>> Kevin K writes:
>>> Is it possible to send raw packets via ppp under Linux?
>>>
>>> More specifically, in 2.4 series kernels such as RH's 2.4.21-47 kernel?
>>>
>>> I've trying to modify the DHCP 3.0.1 code provided with RH 3 so I can
>>> send requests via a PPP connection (standard RS-232), and it is just
>>> being dropped by the stack according to ifconfig and debug statements
>>> in ppp_generic.c.
>>
>> I'm not sure what sort of "raw" packets you're talking about (IP raw
>> or something else), but you shouldn't need to send any raw packets to
>> do this. DHCP runs over UDP, and, unlike Ethernet, there's no link
>> layer addressing to worry about.
>
> I was basing the raw mode on comments in the DHCP source code about
> problems in older Linux kernels with sending packets to
> 255.255.255.255 via normal IP. The DHCP source code therefore wants
> to send raw packets (SOCKET_PACKET) (down to the ethernet addressing
> info). I guess I thought I would need to do this too to fit in with
> the existing source code.
>
> I'll give it a try to see whether packets sent to 255.255.255.255 can
> make it to ppp with the IP address unchanged.
You shouldn't need to run DHCP over PPP, PPP uses LCP to configure
connections. I suspect the only time you would need to run DHCP over a
PPP link is if you had a DHCP proxy run the request over the PPP link,
but that sounds way more complicated than what you are looking for. Have
a quick look at
http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/ppp.htm that
should bring you up to speed on how PPP works. You will probably find
that LCP does everything you need. If you really need some of the
functionality of DHCP (such as setting up WINS servers et al) you might
find that you need to hack a way to do this.

Matt

2007-08-07 10:31:18

by James Carlson

[permalink] [raw]
Subject: Re: sending raw packets via PPP

Matt Keenan writes:
> Kevin K wrote:
> > I'll give it a try to see whether packets sent to 255.255.255.255 can
> > make it to ppp with the IP address unchanged.

You should be able to make DHCP work by sending ordinary unicast UDP
packets to the peer. There shouldn't be any need to hack around with
special broadcast addresses.

Use AF_INET, SOCK_DGRAM, and send away.

> You shouldn't need to run DHCP over PPP, PPP uses LCP to configure
> connections. I suspect the only time you would need to run DHCP over a
> PPP link is if you had a DHCP proxy run the request over the PPP link,
> but that sounds way more complicated than what you are looking for.

I don't think that DHCP over PPP is a bad idea at all, particularly so
with DHCPINFORM messages, which are stateless and don't involve any
sort of address assignment.

PPP is not designed to provide arbitrary client application layer
configuration. The RFC 1877 nonsense is a Microsoft proprietary thing
that doesn't actually work very well -- see my book for a more
substantial list of its flaws.

In contrast, DHCP works everywhere, includes *far* more configuration
information (such as boot servers, print servers, SIP addresses,
domain names, and the like), and is easier to manage than cramming
things into PPP.

> Have
> a quick look at
> http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/ppp.htm that
> should bring you up to speed on how PPP works. You will probably find
> that LCP does everything you need. If you really need some of the
> functionality of DHCP (such as setting up WINS servers et al) you might
> find that you need to hack a way to do this.

The existing pppd already supports the MS proprietary hacks for DNS
and WINS server addresses. Since that's a dead end, you'll need DHCP
if you want to go further.

--
James Carlson 42.703N 71.076W <[email protected]>

2007-08-07 10:33:42

by James Carlson

[permalink] [raw]
Subject: Re: sending raw packets via PPP

Christopher Fowler writes:
> On Mon, 2007-08-06 at 19:24 -0500, Kevin K wrote:
> > The DHCP source code therefore wants
> > to send raw packets (SOCKET_PACKET) (down to the ethernet addressing
> > info).
>
> I can imagine that would be the case. The box requesting the DHCP
> address has no IP address.

That's not always true. DHCP works fine on systems that already have
IP addresses -- address leasing is an _optional_ part of the protocol.
You can use DHCPINFORM to retrieve configuration parameters alone if
you already have an address.

Note that address assignment is technically optional in PPP (IPCP) as
well, so it would be possible to refuse IPCP addresses and then use
DHCP to acquire the needed information. It'd be strange to do, though.

--
James Carlson 42.703N 71.076W <[email protected]>

2007-08-07 17:00:19

by Kevin K

[permalink] [raw]
Subject: Re: sending raw packets via PPP


On Aug 7, 2007, at 5:30 AM, James Carlson wrote:

> Matt Keenan writes:
>> Kevin K wrote:
>>> I'll give it a try to see whether packets sent to 255.255.255.255
>>> can
>>> make it to ppp with the IP address unchanged.
>
> You should be able to make DHCP work by sending ordinary unicast UDP
> packets to the peer. There shouldn't be any need to hack around with
> special broadcast addresses.
>
> Use AF_INET, SOCK_DGRAM, and send away.
>
>> You shouldn't need to run DHCP over PPP, PPP uses LCP to configure
>> connections. I suspect the only time you would need to run DHCP
>> over a
>> PPP link is if you had a DHCP proxy run the request over the PPP
>> link,
>> but that sounds way more complicated than what you are looking for.
>
> I don't think that DHCP over PPP is a bad idea at all, particularly so
> with DHCPINFORM messages, which are stateless and don't involve any
> sort of address assignment.
>
> PPP is not designed to provide arbitrary client application layer
> configuration. The RFC 1877 nonsense is a Microsoft proprietary thing
> that doesn't actually work very well -- see my book for a more
> substantial list of its flaws.
>
> In contrast, DHCP works everywhere, includes *far* more configuration
> information (such as boot servers, print servers, SIP addresses,
> domain names, and the like), and is easier to manage than cramming
> things into PPP.
>
>> Have
>> a quick look at
>> http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/ppp.htm that
>> should bring you up to speed on how PPP works. You will probably find
>> that LCP does everything you need. If you really need some of the
>> functionality of DHCP (such as setting up WINS servers et al) you
>> might
>> find that you need to hack a way to do this.
>
> The existing pppd already supports the MS proprietary hacks for DNS
> and WINS server addresses. Since that's a dead end, you'll need DHCP
> if you want to go further


In my case, I'll be connected to a router using PPP, and it is
supposed to forward DHCP requests out to the broader network. I will
then have to choose between DHCP servers based on some extended
options such as location, software version, etc.

If I don't have an IP address yet, I am supposed to generate a random
IP address in the 10.x.x.x range for use long enough until I accept
an offer. It would obviously have been easier for me if the router
could run the dhcp client, and configured my IP address via PPP.

Since no one has been able to inform me that raw mode is usable via
PPP, that leaves me with some of the other suggestions, such as
sending broadcast DGRAMs, or some other possibilities I've thought of
since yesterday, one of which may work, which involves using iptables.

I have to have a fallback solution since the equipment is not yet
available to test with. So I'm going by requirements of how it is
supposed to work now.

Thanks,
Kevin

2007-08-19 23:46:41

by Kevin K

[permalink] [raw]
Subject: Re: sending raw packets via PPP


On Aug 6, 2007, at 6:30 PM, James Carlson wrote:

> Kevin K writes:
>> Is it possible to send raw packets via ppp under Linux?
>>
>> More specifically, in 2.4 series kernels such as RH's 2.4.21-47
>> kernel?
>>
>> I've trying to modify the DHCP 3.0.1 code provided with RH 3 so I can
>> send requests via a PPP connection (standard RS-232), and it is just
>> being dropped by the stack according to ifconfig and debug statements
>> in ppp_generic.c.
>
> I'm not sure what sort of "raw" packets you're talking about (IP raw
> or something else), but you shouldn't need to send any raw packets to
> do this. DHCP runs over UDP, and, unlike Ethernet, there's no link
> layer addressing to worry about.
>
> --
> James Carlson 42.703N 71.076W
> <[email protected]>


I would like to thank the people who responded to this posting for
their help. It helped keep me from wasting additional time trying to
use SOCK_PACKET over PPP just because the DHCP code in Red Hat used
it for ethernet. (The dhclient code did it to ensure that the
ethernet/IP/UDP headers were to their satisfaction, and to avoid some
bugs in older versions of the Linux kernel).

I've tested through a serial/PPP connection without issues.

This is obviously not a normal configuration, having to run a DHCP
client through PPP, but the IP addresses are assigned via a DHCP
server, but he router we connect to via PPP won't retrieve addresses
from the DHCP server for us.

Thanks,
Kevin