Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Catch a wave and you're sitting on top of the world." -- The Beach Boys


devel / comp.lang.c / Berkeley Sockets -- Reply to UDP Broadcast

SubjectAuthor
* Berkeley Sockets -- Reply to UDP BroadcastFrederick Gotham
+- Re: Berkeley Sockets -- Reply to UDP BroadcastBranimir Maksimovic
+* Re: Berkeley Sockets -- Reply to UDP BroadcastLew Pitcher
|`* Re: Berkeley Sockets -- Reply to UDP BroadcastBen Bacarisse
| `* Re: Berkeley Sockets -- Reply to UDP BroadcastLew Pitcher
|  `- Re: Berkeley Sockets -- Reply to UDP BroadcastBranimir Maksimovic
`- Re: Berkeley Sockets -- Reply to UDP BroadcastLew Pitcher

1
Berkeley Sockets -- Reply to UDP Broadcast

<140867bc-9f6f-4875-8861-264c403c74a3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18596&group=comp.lang.c#18596

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:7e87:: with SMTP id w7mr363006qtj.166.1633545200479;
Wed, 06 Oct 2021 11:33:20 -0700 (PDT)
X-Received: by 2002:a05:620a:638:: with SMTP id 24mr214742qkv.333.1633545200359;
Wed, 06 Oct 2021 11:33:20 -0700 (PDT)
Path: rocksolid2!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 6 Oct 2021 11:33:20 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=92.40.182.195; posting-account=w4UqJAoAAAAYC-PItfDbDoVGcg0yISyA
NNTP-Posting-Host: 92.40.182.195
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <140867bc-9f6f-4875-8861-264c403c74a3n@googlegroups.com>
Subject: Berkeley Sockets -- Reply to UDP Broadcast
From: cauldwel...@gmail.com (Frederick Gotham)
Injection-Date: Wed, 06 Oct 2021 18:33:20 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Frederick Gotham - Wed, 6 Oct 2021 18:33 UTC

I'm programming an embedded Linux device to send a reply to an incoming UDP broadcast packet. I spent a few hours today trying to figure this out, and it looks like I might be resorting to raw sockets with custom headers that I've written by myself byte by byte.

Let's say the incoming UDP broadcast datagram has source port 5432, and destination port 1011.

I want the reply packet I send to have source port 1011 and destination port 5432. I thought this would be possible by simply taking the address structure from the 'recvfrom' function and passing it verbatim to the 'sendto' function, however this doesn't work (it doesn't send the packet out).

It seems as though I would have to create a new UDP socket and then send the reply packet on that new socket, however the problem here is that the source port will be an ephemeral port (e.g. 17654 instead of 1011).

I played with all the settings like SO_BROADCAST but no joy.

Re: Berkeley Sockets -- Reply to UDP Broadcast

<Kkm7J.56011$nR3.42247@fx38.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18597&group=comp.lang.c#18597

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!news.neodome.net!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx38.iad.POSTED!not-for-mail
Newsgroups: comp.lang.c
From: branimir...@icloud.com (Branimir Maksimovic)
Subject: Re: Berkeley Sockets -- Reply to UDP Broadcast
References: <140867bc-9f6f-4875-8861-264c403c74a3n@googlegroups.com>
User-Agent: slrn/1.0.3 (Darwin)
Lines: 28
Message-ID: <Kkm7J.56011$nR3.42247@fx38.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Wed, 06 Oct 2021 18:57:46 UTC
Organization: usenet-news.net
Date: Wed, 06 Oct 2021 18:57:46 GMT
X-Received-Bytes: 1844
 by: Branimir Maksimovic - Wed, 6 Oct 2021 18:57 UTC

On 2021-10-06, Frederick Gotham <cauldwell.thomas@gmail.com> wrote:
>
> I'm programming an embedded Linux device to send a reply to an incoming UDP
> broadcast packet. I spent a few hours today trying to figure this out, and it
> looks like I might be resorting to raw sockets with custom headers that I've
> written by myself byte by byte.
>
> Let's say the incoming UDP broadcast datagram has source port 5432, and
> destination port 1011.
>
> I want the reply packet I send to have source port 1011 and destination port
> 5432. I thought this would be possible by simply taking the address structure
> from the 'recvfrom' function and passing it verbatim to the 'sendto'
> function, however this doesn't work (it doesn't send the packet out).
>
> It seems as though I would have to create a new UDP socket and then send the
> reply packet on that new socket, however the problem here is that the source
> port will be an ephemeral port (e.g. 17654 instead of 1011).
>
> I played with all the settings like SO_BROADCAST but no joy.
Source port is decided by IP, lower level then TCP/UDP

--

7-77-777
Evil Sinner!
to weak you should be meek, and you should brainfuck stronger
https://github.com/rofl0r/chaos-pp

Re: Berkeley Sockets -- Reply to UDP Broadcast

<sjkrn2$rjq$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18598&group=comp.lang.c#18598

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.c
Subject: Re: Berkeley Sockets -- Reply to UDP Broadcast
Date: Wed, 6 Oct 2021 18:59:46 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <sjkrn2$rjq$2@dont-email.me>
References: <140867bc-9f6f-4875-8861-264c403c74a3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 6 Oct 2021 18:59:46 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="0e9b9a0701d74cf704c7b49f6ec9c310";
logging-data="28282"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+HonphIHMoRzBqrUP6DGf+kFt+1FREqiA="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:QtWbWK3918E1Txn3ZOmWHYbB3Sc=
 by: Lew Pitcher - Wed, 6 Oct 2021 18:59 UTC

On Wed, 06 Oct 2021 11:33:20 -0700, Frederick Gotham wrote:

> I'm programming an embedded Linux device to send a reply to an incoming
> UDP broadcast packet. I spent a few hours today trying to figure this
> out, and it looks like I might be resorting to raw sockets with custom
> headers that I've written by myself byte by byte.
>
> Let's say the incoming UDP broadcast datagram has source port 5432, and
> destination port 1011.
>
> I want the reply packet I send to have source port 1011 and destination
> port 5432. I thought this would be possible by simply taking the
> address structure from the 'recvfrom' function and passing it verbatim
> to the 'sendto' function, however this doesn't work (it doesn't send
> the packet out).
[snip]

The bad news is that comp.lang.c is not a forum that discusses the ins
and outs of the Berkeley Sockets interface on Linux.

The good news is that both comp.os.linux.networking /and/
comp.os.linux.programmer /are/ fora where the Linux implementation of
Berkeley Sockets is relevant.

The even better news is that what you want to do can easily be
accomplished through judicious use of the sendto() and recvfrom() calls
available in the Linux implementation of Berkeley Sockets, which I, and
others, would be more than happy to discuss with you on one or the one of
the two aforementioned newsgroups.

--
Lew Pitcher
"In Skills, We Trust"

Re: Berkeley Sockets -- Reply to UDP Broadcast

<87tuhtdhtc.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18600&group=comp.lang.c#18600

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: Berkeley Sockets -- Reply to UDP Broadcast
Date: Wed, 06 Oct 2021 21:22:39 +0100
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <87tuhtdhtc.fsf@bsb.me.uk>
References: <140867bc-9f6f-4875-8861-264c403c74a3n@googlegroups.com>
<sjkrn2$rjq$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="409271780c79a48a8a30379b98ff5507";
logging-data="10018"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5X5JSIH8mMdFywvMZR50+1Ztv4ZQCQ3Q="
Cancel-Lock: sha1:acipCjtufUPk0m33zPCLckQadRY=
sha1:extyglzrMFTs+VjzTpqBNCxiZ94=
X-BSB-Auth: 1.adf2a5097d56e527c657.20211006212239BST.87tuhtdhtc.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 6 Oct 2021 20:22 UTC

Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:

> On Wed, 06 Oct 2021 11:33:20 -0700, Frederick Gotham wrote:
>
>> I'm programming an embedded Linux device to send a reply to an incoming
>> UDP broadcast packet. I spent a few hours today trying to figure this
>> out, and it looks like I might be resorting to raw sockets with custom
>> headers that I've written by myself byte by byte.
<cut>
> The bad news is that comp.lang.c is not a forum that discusses the ins
> and outs of the Berkeley Sockets interface on Linux.
>
> The good news is that both comp.os.linux.networking /and/
> comp.os.linux.programmer /are/ fora where the Linux implementation of
> Berkeley Sockets is relevant.

I can't find comp.os.linux.programmer. But there is
comp.unix.programmer which I was going to mention anyway.

--
Ben.

Re: Berkeley Sockets -- Reply to UDP Broadcast

<sjl10q$rjq$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18601&group=comp.lang.c#18601

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.c
Subject: Re: Berkeley Sockets -- Reply to UDP Broadcast
Date: Wed, 6 Oct 2021 20:30:19 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <sjl10q$rjq$3@dont-email.me>
References: <140867bc-9f6f-4875-8861-264c403c74a3n@googlegroups.com>
<sjkrn2$rjq$2@dont-email.me> <87tuhtdhtc.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 6 Oct 2021 20:30:19 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="0e9b9a0701d74cf704c7b49f6ec9c310";
logging-data="28282"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/tpD7aznSyIhjQ7I28r7UcGHIBrXu6yh8="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:Jpv+fVKiI3Tj5SEnwPa08KdGrzk=
 by: Lew Pitcher - Wed, 6 Oct 2021 20:30 UTC

On Wed, 06 Oct 2021 21:22:39 +0100, Ben Bacarisse wrote:

> Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
>
>> On Wed, 06 Oct 2021 11:33:20 -0700, Frederick Gotham wrote:
>>
>>> I'm programming an embedded Linux device to send a reply to an
>>> incoming UDP broadcast packet. I spent a few hours today trying to
>>> figure this out, and it looks like I might be resorting to raw sockets
>>> with custom headers that I've written by myself byte by byte.
> <cut>
>> The bad news is that comp.lang.c is not a forum that discusses the ins
>> and outs of the Berkeley Sockets interface on Linux.
>>
>> The good news is that both comp.os.linux.networking /and/
>> comp.os.linux.programmer /are/ fora where the Linux implementation of
>> Berkeley Sockets is relevant.
>
> I can't find comp.os.linux.programmer. But there is
> comp.unix.programmer which I was going to mention anyway.

fsck, you're right. I meant to say comp.unix.programmer. Sorry

--
Lew Pitcher
"In Skills, We Trust"

Re: Berkeley Sockets -- Reply to UDP Broadcast

<xTn7J.26021$nh7.23371@fx22.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18602&group=comp.lang.c#18602

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!news.neodome.net!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx22.iad.POSTED!not-for-mail
Newsgroups: comp.lang.c
From: branimir...@icloud.com (Branimir Maksimovic)
Subject: Re: Berkeley Sockets -- Reply to UDP Broadcast
References: <140867bc-9f6f-4875-8861-264c403c74a3n@googlegroups.com>
<sjkrn2$rjq$2@dont-email.me> <87tuhtdhtc.fsf@bsb.me.uk>
<sjl10q$rjq$3@dont-email.me>
User-Agent: slrn/1.0.3 (Darwin)
Lines: 15
Message-ID: <xTn7J.26021$nh7.23371@fx22.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Wed, 06 Oct 2021 20:43:09 UTC
Organization: usenet-news.net
Date: Wed, 06 Oct 2021 20:43:09 GMT
X-Received-Bytes: 1126
 by: Branimir Maksimovic - Wed, 6 Oct 2021 20:43 UTC

On 2021-10-06, Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
>>
>> I can't find comp.os.linux.programmer. But there is
>> comp.unix.programmer which I was going to mention anyway.
>
> fsck, you're right. I meant to say comp.unix.programmer. Sorry
>
There is also comp.unix.programmers :P

--

7-77-777
Evil Sinner!
to weak you should be meek, and you should brainfuck stronger
https://github.com/rofl0r/chaos-pp

Re: Berkeley Sockets -- Reply to UDP Broadcast

<sjn6n9$p0k$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18612&group=comp.lang.c#18612

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.c
Subject: Re: Berkeley Sockets -- Reply to UDP Broadcast
Date: Thu, 7 Oct 2021 16:19:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <sjn6n9$p0k$1@dont-email.me>
References: <140867bc-9f6f-4875-8861-264c403c74a3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 7 Oct 2021 16:19:53 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="a465bab7c8bf1477e104bc9132df5780";
logging-data="25620"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rfpueIa2VfsKWAYngBfn2DDg7D1E601o="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:UweLcijSXl+TkVGeBNfXgO71hk8=
 by: Lew Pitcher - Thu, 7 Oct 2021 16:19 UTC

On Wed, 06 Oct 2021 11:33:20 -0700, Frederick Gotham wrote:

> I'm programming an embedded Linux device to send a reply to an incoming
> UDP broadcast packet. I spent a few hours today trying to figure this
> out, and it looks like I might be resorting to raw sockets with custom
> headers that I've written by myself byte by byte.
[snip]

See my reply in either comp.os.linux.networking or comp.unix.programmer

--
Lew Pitcher
"In Skills, We Trust"

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor