-
Notifications
You must be signed in to change notification settings - Fork 18
Make DHCPv4 client (partly) RFC compliant #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Remove ciaddr and added DHCP server ID in DHCPREQUEST messages, since those are MUST NOT and MUST be filled respectively for the initial DHCP request as defined in RFC2131 (see section 4.4.1). Signed-off-by: Lemon Lam <alemonmk@users.noreply.github.com>
|
morning! |
|
hi alemonmk,
to speed up things just a little bit i did the following:
i personally configure the dhcp4 client with the following way to get addresses from my android hotspot (lineageos latest/greatest):
players#show running-config interface sdn2
interface sdn2
description to my cellphone
mtu 1500
macaddr 503e.bbc1.fa21
vrf forwarding gsm
ipv4 address dynamic dynamic
ipv4 gateway-prefix def4
ipv4 host-watch
ipv4 dhcp-client enable
ipv4 dhcp-client early <---------------------------- to don't give a fuck about the responses :)
ipv6 address dynamic dynamic
ipv6 enable
ipv6 gateway-prefix def6
ipv6 host-watch
ipv6 slaac-client enable
ipv6 slaac-client renew-max 3600000
ipv6 prefix-suppress
follow-tracker triggerPhysical
no shutdown
log-link-change
exit
!
players#
cd src
./c.sh
./tw.sh conn-dhcp nowait
- 0/release: starting process
- 0/release: stopping process
- 0/version: starting process
- 0/version: stopping process
- oobase=20001
- slot=0
- paralell=0
- jvm=java -Xmx256m -jar rtr.jar
- release=freeRouter v23.5.17-cur, done by ***@***.***
- version=23.5.17
- url=../cfg/
- path=../cfg/
- temp=../binTmp/
- discard=^$
- mdfile=false
- summary=false
- cfgarch=./
- window=false
- wait=false
- config=false
- unexit=false
- reapply=0
- restart=0
- chatty=null
- predelay=0
- postdelay=0
- randord=false
- retry=1
- other=0 null
- remote=null
- persist=null
- capture=0
- files=4
* ---------- starting 1 workers ----------
* ---------- err=0 trc=0 ret=0 don=0 ned=4 tot=4 tim=00:00:00 ---------- conn-dhcp01.tst ----------
* test: dhcp
- 0/r1: starting process
- 0/r2: starting process
- 0/r2: pinging 1.1.1.1 vrf v1.
- 0/r2: pinging 1234::1 vrf v1.
- 0/r2: pinging 4.4.4.4 vrf v1.
- 0/r2: pinging 4444::4 vrf v1.
- 0/r1: stopping process
- 0/r2: stopping process
* ../cfg/conn-dhcp01.tst;conn-dhcp01.tst;success;dhcp
* ---------- err=0 trc=0 ret=0 don=1 ned=3 tot=4 tim=00:00:13 ---------- conn-dhcp02.tst ----------
* test: dhcp with arp/nd security
- 0/r1: starting process
- 0/r2: starting process
- 0/r2: pinging 1.1.1.1 vrf v1.
- 0/r2: pinging 1234::1 vrf v1.
- 0/r2: pinging 4.4.4.4 vrf v1.
- 0/r2: pinging 4444::4 vrf v1.
- 0/r1: stopping process
- 0/r2: stopping process
* ../cfg/conn-dhcp02.tst;conn-dhcp02.tst;success;dhcp with arp/nd security
* ---------- err=0 trc=0 ret=0 don=2 ned=2 tot=4 tim=00:00:27 ---------- conn-dhcp03.tst ----------
* test: dhcp with static allocation
- 0/r1: starting process
- 0/r2: starting process
- 0/r2: pinging 1.1.1.1 vrf v1.
- 0/r2: pinging 1234::1 vrf v1.
- 0/r2: pinging 4.4.4.4 vrf v1.
- 0/r2: pinging 4444::4 vrf v1.
- 0/r1: pinging 1.1.1.111 vrf v1.
- 0/r1: pinging 1234::111 vrf v1.
- 0/r1: stopping process
- 0/r2: stopping process
* ../cfg/conn-dhcp03.tst;conn-dhcp03.tst;success;dhcp with static allocation
* ---------- err=0 trc=0 ret=0 don=3 ned=1 tot=4 tim=00:00:41 ---------- conn-dhcp04.tst ----------
* test: dhcp with excluded address
- 0/r1: starting process
- 0/r2: starting process
- 0/r3: starting process
- 0/r3: pinging 1.1.1.1 vrf v1.
- 0/r3: pinging 1234::1 vrf v1.
- 0/r3: pinging 4.4.4.4 vrf v1.
- 0/r3: pinging 4444::4 vrf v1.
- 0/r2: pinging 1.1.1.1 vrf v1.
- 0/r2: pinging 1234::1 vrf v1.
- 0/r2: pinging 4.4.4.4 vrf v1.
- 0/r2: pinging 4444::4 vrf v1.
- 0/r1: stopping process
- 0/r2: stopping process
- 0/r3: stopping process
* ../cfg/conn-dhcp04.tst;conn-dhcp04.tst;success;dhcp with excluded address
- summary: 2023-05-17 07:22:58, took 00:01:01, with 1 workers, on 4 cases, 0 failed, 0 traces, 0 retries
error cfgInit.stopRouter:cfgInit.java:1107 shutdown code=1 reason=finished
i now saw this with and without your diff (*) so imho i should accept this :)
*: the diff at https://github.com/rare-freertr/freeRtr/pull/21 , more clearly here:
rare-freertr@e73a89e
in plaintext here:
pckd.dhcpOp = packDhcp4.dhcpOpRequest;
pckd.putParamReqList();
pckd.dhcpClientId = true;
- pckd.bootpCiaddr = locAddr.copyBytes();
+ pckd.dhcpServer = dhcpAddr.copyBytes();
pckd.dhcpRequested = locAddr.copyBytes();
pckd.createHeader(pck, null);
sender.send2net(pck);
…On 5/17/23 06:49, mc36 wrote:
morning!
thanks for the patch, first i'll run my ci-cd after i'll merge as it seems reasonable :)
all the best,
cs
Reply to this email directly, view it on GitHub <https://github.com/rare-freertr/freeRtr/pull/21#issuecomment-1550726873>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD2P4GZOFZZWVQ7U5OT2ZLLXGRKFLANCNFSM6AAAAAAYDU2BDQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
|
tbh im still shaking this in my local ci-cd (as described below) now im at this diff and it still works... :)
soon to test this against my android hotspot :)))
br,
cs
…--- ../src/src/net/freertr/clnt/clntDhcp4.java 2022-07-24 12:31:26.000000000 +0200
+++ /safe/src/net/freertr/clnt/clntDhcp4.java 2023-05-17 09:43:44.799605800 +0200
@@ -404,20 +404,21 @@
packHolder pck = new packHolder(true, true);
packDhcp4 pckd = new packDhcp4();
pckd.bootpOp = packDhcp4.bootpOpRequest;
pckd.bootpXid = lastId;
pckd.bootpBroadcast = broadcastMode;
pckd.bootpChaddr = (addrMac) ethtyp.getHwAddr().copyBytes();
pckd.dhcpOp = packDhcp4.dhcpOpRequest;
pckd.putParamReqList();
pckd.dhcpClientId = true;
pckd.bootpCiaddr = locAddr.copyBytes();
+ pckd.dhcpServer = dhcpAddr.copyBytes(); // github pull req#21
pckd.dhcpRequested = locAddr.copyBytes();
pckd.createHeader(pck, null);
sender.send2net(pck);
lastTime = bits.getTime();
if (debugger.clntDhcp4traf) {
logger.debug("tx " + sender + " " + pckd);
}
}
private void sendKeepalive() {
On 5/17/23 09:28, mc36 wrote:
hi alemonmk,
to speed up things just a little bit i did the following:
i personally configure the dhcp4 client with the following way to get addresses from my android hotspot (lineageos latest/greatest):
players#show running-config interface sdn2
interface sdn2
description to my cellphone
mtu 1500
macaddr 503e.bbc1.fa21
vrf forwarding gsm
ipv4 address dynamic dynamic
ipv4 gateway-prefix def4
ipv4 host-watch
ipv4 dhcp-client enable
ipv4 dhcp-client early <---------------------------- to don't give a fuck about the responses :)
ipv6 address dynamic dynamic
ipv6 enable
ipv6 gateway-prefix def6
ipv6 host-watch
ipv6 slaac-client enable
ipv6 slaac-client renew-max 3600000
ipv6 prefix-suppress
follow-tracker triggerPhysical
no shutdown
log-link-change
exit
!
players#
cd src
./c.sh
./tw.sh conn-dhcp nowait
- 0/release: starting process
- 0/release: stopping process
- 0/version: starting process
- 0/version: stopping process
- oobase=20001
- slot=0
- paralell=0
- jvm=java -Xmx256m -jar rtr.jar
- release=freeRouter v23.5.17-cur, done by ***@***.***
- version=23.5.17
- url=../cfg/
- path=../cfg/
- temp=../binTmp/
- discard=^$
- mdfile=false
- summary=false
- cfgarch=./
- window=false
- wait=false
- config=false
- unexit=false
- reapply=0
- restart=0
- chatty=null
- predelay=0
- postdelay=0
- randord=false
- retry=1
- other=0 null
- remote=null
- persist=null
- capture=0
- files=4
* ---------- starting 1 workers ----------
* ---------- err=0 trc=0 ret=0 don=0 ned=4 tot=4 tim=00:00:00 ---------- conn-dhcp01.tst ----------
* test: dhcp
- 0/r1: starting process
- 0/r2: starting process
- 0/r2: pinging 1.1.1.1 vrf v1.
- 0/r2: pinging 1234::1 vrf v1.
- 0/r2: pinging 4.4.4.4 vrf v1.
- 0/r2: pinging 4444::4 vrf v1.
- 0/r1: stopping process
- 0/r2: stopping process
* ../cfg/conn-dhcp01.tst;conn-dhcp01.tst;success;dhcp
* ---------- err=0 trc=0 ret=0 don=1 ned=3 tot=4 tim=00:00:13 ---------- conn-dhcp02.tst ----------
* test: dhcp with arp/nd security
- 0/r1: starting process
- 0/r2: starting process
- 0/r2: pinging 1.1.1.1 vrf v1.
- 0/r2: pinging 1234::1 vrf v1.
- 0/r2: pinging 4.4.4.4 vrf v1.
- 0/r2: pinging 4444::4 vrf v1.
- 0/r1: stopping process
- 0/r2: stopping process
* ../cfg/conn-dhcp02.tst;conn-dhcp02.tst;success;dhcp with arp/nd security
* ---------- err=0 trc=0 ret=0 don=2 ned=2 tot=4 tim=00:00:27 ---------- conn-dhcp03.tst ----------
* test: dhcp with static allocation
- 0/r1: starting process
- 0/r2: starting process
- 0/r2: pinging 1.1.1.1 vrf v1.
- 0/r2: pinging 1234::1 vrf v1.
- 0/r2: pinging 4.4.4.4 vrf v1.
- 0/r2: pinging 4444::4 vrf v1.
- 0/r1: pinging 1.1.1.111 vrf v1.
- 0/r1: pinging 1234::111 vrf v1.
- 0/r1: stopping process
- 0/r2: stopping process
* ../cfg/conn-dhcp03.tst;conn-dhcp03.tst;success;dhcp with static allocation
* ---------- err=0 trc=0 ret=0 don=3 ned=1 tot=4 tim=00:00:41 ---------- conn-dhcp04.tst ----------
* test: dhcp with excluded address
- 0/r1: starting process
- 0/r2: starting process
- 0/r3: starting process
- 0/r3: pinging 1.1.1.1 vrf v1.
- 0/r3: pinging 1234::1 vrf v1.
- 0/r3: pinging 4.4.4.4 vrf v1.
- 0/r3: pinging 4444::4 vrf v1.
- 0/r2: pinging 1.1.1.1 vrf v1.
- 0/r2: pinging 1234::1 vrf v1.
- 0/r2: pinging 4.4.4.4 vrf v1.
- 0/r2: pinging 4444::4 vrf v1.
- 0/r1: stopping process
- 0/r2: stopping process
- 0/r3: stopping process
* ../cfg/conn-dhcp04.tst;conn-dhcp04.tst;success;dhcp with excluded address
- summary: 2023-05-17 07:22:58, took 00:01:01, with 1 workers, on 4 cases, 0 failed, 0 traces, 0 retries
error cfgInit.stopRouter:cfgInit.java:1107 shutdown code=1 reason=finished
i now saw this with and without your diff (*) so imho i should accept this :)
*: the diff at https://github.com/rare-freertr/freeRtr/pull/21 , more clearly here:
rare-freertr@e73a89e
in plaintext here:
pckd.dhcpOp = packDhcp4.dhcpOpRequest;
pckd.putParamReqList();
pckd.dhcpClientId = true;
- pckd.bootpCiaddr = locAddr.copyBytes();
+ pckd.dhcpServer = dhcpAddr.copyBytes();
pckd.dhcpRequested = locAddr.copyBytes();
pckd.createHeader(pck, null);
sender.send2net(pck);
On 5/17/23 06:49, mc36 wrote:
> morning!
> thanks for the patch, first i'll run my ci-cd after i'll merge as it seems reasonable :)
> all the best,
> cs
>
>
> Reply to this email directly, view it on GitHub <https://github.com/rare-freertr/freeRtr/pull/21#issuecomment-1550726873>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AD2P4GZOFZZWVQ7U5OT2ZLLXGRKFLANCNFSM6AAAAAAYDU2BDQ>.
> You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
>
Reply to this email directly, view it on GitHub <https://github.com/rare-freertr/freeRtr/pull/21#issuecomment-1550891419>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD2P4G3ZD4NM3BWKL6OMH5DXGR43PANCNFSM6AAAAAAYDU2BDQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
|
@frederic-loui time to send out a github invite to @alemonmk .... also don't forget about @famfo for his/her/its rusty tries at http://git.famfo.xyz/famfo/freertr_native-rs :) |
|
now the hotspot with a new random mac does not works on my diff so now im retrying with your original one:
players#debug client dhcp4
players#sleep 66666
players#show logging last 100 | include Dhcp4
2023-05-17 10:07:28 debug clntDhcp4.datagramWork:clntDhcp4.java:282 work dhcp4c sdn2 68 -> 255.255.255.255 67
2023-05-17 10:07:28 debug clntDhcp4.sendDiscovery:clntDhcp4.java:396 tx dhcp4c sdn2 68 -> 255.255.255.255 67 op=req sec=0 cia=0.0.0.0 yia=0.0.0.0 sia=0.0.0.0 gia=0.0.0.0
cha=503e.aaa0.0bad srv=null fil=null op=discover dhcpsrv=null hstnm=null dom=null lease=0 renew=0 mask=null gw=null dns1=null dns2=null req=null
2023-05-17 10:07:33 debug clntDhcp4.datagramWork:clntDhcp4.java:282 work dhcp4c sdn2 68 -> 255.255.255.255 67
2023-05-17 10:07:33 debug clntDhcp4.sendDiscovery:clntDhcp4.java:396 tx dhcp4c sdn2 68 -> 255.255.255.255 67 op=req sec=0 cia=0.0.0.0 yia=0.0.0.0 sia=0.0.0.0 gia=0.0.0.0
cha=503e.aaa0.0bad srv=null fil=null op=discover dhcpsrv=null hstnm=null dom=null lease=0 renew=0 mask=null gw=null dns1=null dns2=null req=null
2023-05-17 10:07:38 debug clntDhcp4.datagramWork:clntDhcp4.java:282 work dhcp4c sdn2 68 -> 255.255.255.255 67
2023-05-17 10:07:38 debug clntDhcp4.sendDiscovery:clntDhcp4.java:396 tx dhcp4c sdn2 68 -> 255.255.255.255 67 op=req sec=0 cia=0.0.0.0 yia=0.0.0.0 sia=0.0.0.0 gia=0.0.0.0
cha=503e.aaa0.0bad srv=null fil=null op=discover dhcpsrv=null hstnm=null dom=null lease=0 renew=0 mask=null gw=null dns1=null dns2=null req=null
2023-05-17 10:07:43 debug clntDhcp4.datagramWork:clntDhcp4.java:282 work dhcp4c sdn2 68 -> 255.255.255.255 67
2023-05-17 10:07:43 debug clntDhcp4.sendDiscovery:clntDhcp4.java:396 tx dhcp4c sdn2 68 -> 255.255.255.255 67 op=req sec=0 cia=0.0.0.0 yia=0.0.0.0 sia=0.0.0.0 gia=0.0.0.0
cha=503e.aaa0.0bad srv=null fil=null op=discover dhcpsrv=null hstnm=null dom=null lease=0 renew=0 mask=null gw=null dns1=null dns2=null req=null
2023-05-17 10:07:48 debug clntDhcp4.datagramWork:clntDhcp4.java:282 work dhcp4c sdn2 68 -> 255.255.255.255 67
2023-05-17 10:07:48 debug clntDhcp4.sendDiscovery:clntDhcp4.java:396 tx dhcp4c sdn2 68 -> 255.255.255.255 67 op=req sec=0 cia=0.0.0.0 yia=0.0.0.0 sia=0.0.0.0 gia=0.0.0.0
cha=503e.aaa0.0bad srv=null fil=null op=discover dhcpsrv=null hstnm=null dom=null lease=0 renew=0 mask=null gw=null dns1=null dns2=null req=null
i'll trying with this diff 4 now:
diff -r -U 10 --color ../src/src/net/freertr/clnt/clntDhcp4.java /safe/src/net/freertr/clnt/clntDhcp4.java
--- ../src/src/net/freertr/clnt/clntDhcp4.java 2022-07-24 12:31:26.000000000 +0200
+++ /safe/src/net/freertr/clnt/clntDhcp4.java 2023-05-17 10:11:16.284489500 +0200
@@ -403,21 +403,22 @@
}
packHolder pck = new packHolder(true, true);
packDhcp4 pckd = new packDhcp4();
pckd.bootpOp = packDhcp4.bootpOpRequest;
pckd.bootpXid = lastId;
pckd.bootpBroadcast = broadcastMode;
pckd.bootpChaddr = (addrMac) ethtyp.getHwAddr().copyBytes();
pckd.dhcpOp = packDhcp4.dhcpOpRequest;
pckd.putParamReqList();
pckd.dhcpClientId = true;
- pckd.bootpCiaddr = locAddr.copyBytes();
+ // pckd.bootpCiaddr = locAddr.copyBytes(); // github pull req#21
+ pckd.dhcpServer = dhcpAddr.copyBytes(); // github pull req#21
pckd.dhcpRequested = locAddr.copyBytes();
pckd.createHeader(pck, null);
sender.send2net(pck);
lastTime = bits.getTime();
if (debugger.clntDhcp4traf) {
logger.debug("tx " + sender + " " + pckd);
}
}
private void sendKeepalive() {
…On 5/17/23 09:48, mc36 wrote:
tbh im still shaking this in my local ci-cd (as described below) now im at this diff and it still works... :)
soon to test this against my android hotspot :)))
br,
cs
--- ../src/src/net/freertr/clnt/clntDhcp4.java 2022-07-24 12:31:26.000000000 +0200
+++ /safe/src/net/freertr/clnt/clntDhcp4.java 2023-05-17 09:43:44.799605800 +0200
@@ -404,20 +404,21 @@
packHolder pck = new packHolder(true, true);
packDhcp4 pckd = new packDhcp4();
pckd.bootpOp = packDhcp4.bootpOpRequest;
pckd.bootpXid = lastId;
pckd.bootpBroadcast = broadcastMode;
pckd.bootpChaddr = (addrMac) ethtyp.getHwAddr().copyBytes();
pckd.dhcpOp = packDhcp4.dhcpOpRequest;
pckd.putParamReqList();
pckd.dhcpClientId = true;
pckd.bootpCiaddr = locAddr.copyBytes();
+ pckd.dhcpServer = dhcpAddr.copyBytes(); // github pull req#21
pckd.dhcpRequested = locAddr.copyBytes();
pckd.createHeader(pck, null);
sender.send2net(pck);
lastTime = bits.getTime();
if (debugger.clntDhcp4traf) {
logger.debug("tx " + sender + " " + pckd);
}
}
private void sendKeepalive() {
On 5/17/23 09:28, mc36 wrote:
> hi alemonmk,
>
> to speed up things just a little bit i did the following:
>
> i personally configure the dhcp4 client with the following way to get addresses from my android hotspot (lineageos latest/greatest):
>
> players#show running-config interface sdn2
> interface sdn2
> description to my cellphone
> mtu 1500
> macaddr 503e.bbc1.fa21
> vrf forwarding gsm
> ipv4 address dynamic dynamic
> ipv4 gateway-prefix def4
> ipv4 host-watch
> ipv4 dhcp-client enable
> ipv4 dhcp-client early <---------------------------- to don't give a fuck about the responses :)
> ipv6 address dynamic dynamic
> ipv6 enable
> ipv6 gateway-prefix def6
> ipv6 host-watch
> ipv6 slaac-client enable
> ipv6 slaac-client renew-max 3600000
> ipv6 prefix-suppress
> follow-tracker triggerPhysical
> no shutdown
> log-link-change
> exit
> !
>
> players#
>
>
>
> cd src
> ./c.sh
> ./tw.sh conn-dhcp nowait
> - 0/release: starting process
> - 0/release: stopping process
> - 0/version: starting process
> - 0/version: stopping process
> - oobase=20001
> - slot=0
> - paralell=0
> - jvm=java -Xmx256m -jar rtr.jar
> - release=freeRouter v23.5.17-cur, done by ***@***.***
> - version=23.5.17
> - url=../cfg/
> - path=../cfg/
> - temp=../binTmp/
> - discard=^$
> - mdfile=false
> - summary=false
> - cfgarch=./
> - window=false
> - wait=false
> - config=false
> - unexit=false
> - reapply=0
> - restart=0
> - chatty=null
> - predelay=0
> - postdelay=0
> - randord=false
> - retry=1
> - other=0 null
> - remote=null
> - persist=null
> - capture=0
> - files=4
> * ---------- starting 1 workers ----------
> * ---------- err=0 trc=0 ret=0 don=0 ned=4 tot=4 tim=00:00:00 ---------- conn-dhcp01.tst ----------
> * test: dhcp
> - 0/r1: starting process
> - 0/r2: starting process
> - 0/r2: pinging 1.1.1.1 vrf v1.
> - 0/r2: pinging 1234::1 vrf v1.
> - 0/r2: pinging 4.4.4.4 vrf v1.
> - 0/r2: pinging 4444::4 vrf v1.
> - 0/r1: stopping process
> - 0/r2: stopping process
> * ../cfg/conn-dhcp01.tst;conn-dhcp01.tst;success;dhcp
> * ---------- err=0 trc=0 ret=0 don=1 ned=3 tot=4 tim=00:00:13 ---------- conn-dhcp02.tst ----------
> * test: dhcp with arp/nd security
> - 0/r1: starting process
> - 0/r2: starting process
> - 0/r2: pinging 1.1.1.1 vrf v1.
> - 0/r2: pinging 1234::1 vrf v1.
> - 0/r2: pinging 4.4.4.4 vrf v1.
> - 0/r2: pinging 4444::4 vrf v1.
> - 0/r1: stopping process
> - 0/r2: stopping process
> * ../cfg/conn-dhcp02.tst;conn-dhcp02.tst;success;dhcp with arp/nd security
> * ---------- err=0 trc=0 ret=0 don=2 ned=2 tot=4 tim=00:00:27 ---------- conn-dhcp03.tst ----------
> * test: dhcp with static allocation
> - 0/r1: starting process
> - 0/r2: starting process
> - 0/r2: pinging 1.1.1.1 vrf v1.
> - 0/r2: pinging 1234::1 vrf v1.
> - 0/r2: pinging 4.4.4.4 vrf v1.
> - 0/r2: pinging 4444::4 vrf v1.
> - 0/r1: pinging 1.1.1.111 vrf v1.
> - 0/r1: pinging 1234::111 vrf v1.
> - 0/r1: stopping process
> - 0/r2: stopping process
> * ../cfg/conn-dhcp03.tst;conn-dhcp03.tst;success;dhcp with static allocation
> * ---------- err=0 trc=0 ret=0 don=3 ned=1 tot=4 tim=00:00:41 ---------- conn-dhcp04.tst ----------
> * test: dhcp with excluded address
> - 0/r1: starting process
> - 0/r2: starting process
> - 0/r3: starting process
> - 0/r3: pinging 1.1.1.1 vrf v1.
> - 0/r3: pinging 1234::1 vrf v1.
> - 0/r3: pinging 4.4.4.4 vrf v1.
> - 0/r3: pinging 4444::4 vrf v1.
> - 0/r2: pinging 1.1.1.1 vrf v1.
> - 0/r2: pinging 1234::1 vrf v1.
> - 0/r2: pinging 4.4.4.4 vrf v1.
> - 0/r2: pinging 4444::4 vrf v1.
> - 0/r1: stopping process
> - 0/r2: stopping process
> - 0/r3: stopping process
> * ../cfg/conn-dhcp04.tst;conn-dhcp04.tst;success;dhcp with excluded address
> - summary: 2023-05-17 07:22:58, took 00:01:01, with 1 workers, on 4 cases, 0 failed, 0 traces, 0 retries
> error cfgInit.stopRouter:cfgInit.java:1107 shutdown code=1 reason=finished
>
>
>
> i now saw this with and without your diff (*) so imho i should accept this :)
>
>
> *: the diff at https://github.com/rare-freertr/freeRtr/pull/21 , more clearly here:
>
> rare-freertr@e73a89e
>
> in plaintext here:
>
> pckd.dhcpOp = packDhcp4.dhcpOpRequest;
> pckd.putParamReqList();
> pckd.dhcpClientId = true;
> - pckd.bootpCiaddr = locAddr.copyBytes();
> + pckd.dhcpServer = dhcpAddr.copyBytes();
> pckd.dhcpRequested = locAddr.copyBytes();
> pckd.createHeader(pck, null);
> sender.send2net(pck);
>
>
>
> On 5/17/23 06:49, mc36 wrote:
> > morning!
> > thanks for the patch, first i'll run my ci-cd after i'll merge as it seems reasonable :)
> > all the best,
> > cs
> >
> >
> > Reply to this email directly, view it on GitHub <https://github.com/rare-freertr/freeRtr/pull/21#issuecomment-1550726873>, or unsubscribe
> > <https://github.com/notifications/unsubscribe-auth/AD2P4GZOFZZWVQ7U5OT2ZLLXGRKFLANCNFSM6AAAAAAYDU2BDQ>.
> > You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
> >
>
>
> Reply to this email directly, view it on GitHub <https://github.com/rare-freertr/freeRtr/pull/21#issuecomment-1550891419>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AD2P4G3ZD4NM3BWKL6OMH5DXGR43PANCNFSM6AAAAAAYDU2BDQ>.
> You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
>
|
|
for now some quick lunch 4 me but i have the strong feeling this change deserves a config knob under int xxx / ipv4 dhcp XXX like fill-ciaddr :) edit: no worries, i'll take care of that 4 u.... :) |
|
--ofkoz i'll keep you posted with the updates :) |
|
evening alemonmk,
it's 18:01 in my timezone and the feature is almost ready 4 the release..... :)
id(cfg-if)#show running-config this | include ciad
sid(cfg-if)#ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#show running-config this | include ciad
sid(cfg-if)#no ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#show running-config this | include ciad
no ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#no ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#show running-config this | include ciad
no ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#show running-config this | include ciad
sid(cfg-if)#
this is my current diff:
diff -r -U 10 --color ../src/src/net/freertr/cfg/cfgIfc.java /safe/src/net/freertr/cfg/cfgIfc.java
--- ../src/src/net/freertr/cfg/cfgIfc.java 2023-03-01 11:29:51.000000000 +0100
+++ /safe/src/net/freertr/cfg/cfgIfc.java 2023-05-17 17:54:30.560840500 +0200
@@ -1569,20 +1569,21 @@
"interface .*! no ipv[46] ptp enable",
"interface .*! no ipv[46] ptp receive",
"interface .*! ipv4 dhcp-client broadcast",
"interface .*! no ipv6 dhcp-client prefix",
"interface .*! no ipv[46] dhcp-client early",
"interface .*! ipv[46] dhcp-client renew-min 60000",
"interface .*! ipv[46] dhcp-client renew-max 43200000",
"interface .*! no ipv[46] dhcp-client enable",
"interface .*! no ipv6 prefix-suppress",
"interface .*! no ipv6 slaac-client enable",
+ "interface .*! ipv4 dhcp-client fill-ciaddr",
"interface .*! ipv6 slaac-client renew-min 60000",
"interface .*! ipv6 slaac-client renew-max 43200000",
"interface .*! no ipv6 prefix-dns",
"interface .*! no ipv6 prefix-domain",
"interface .*! ipv6 prefix-interval 120000",
"interface .*! ipv6 prefix-validity 604800000",
// multicast
"interface .*! no ipv[46] multicast source-override-in",
"interface .*! no ipv[46] multicast source-override-out",
"interface .*! ipv[46] multicast ttl-threshold 0",
@@ -6576,20 +6577,21 @@
l.add(null, "1 2 ipv4 interface internet protocol config commands");
ipFwdIface.getHelp(l);
l.add(null, "2 3 dhcp-client acquire address by dhcp");
l.add(null, "3 . enable start address acquision");
l.add(null, "3 . broadcast set broadcast flag");
l.add(null, "3 . early pick up address early");
l.add(null, "3 4 renew-min minimum renew time");
l.add(null, "4 . <num> time in ms");
l.add(null, "3 4 renew-max maximum renew time");
l.add(null, "4 . <num> time in ms");
+ l.add(null, "3 . fill-ciaddr fill in bootp ciaddr or dhcpserver address");
l.add(null, "2 3 pool peer address pool");
l.add(null, "3 . <name:pl4> name of address pool");
l.add(null, "1 2 ipv6 interface internet protocol config commands");
ipFwdIface.getHelp(l);
l.add(null, "2 3 slaac-client stateless address autoconfiguration");
l.add(null, "3 . enable start address acquision");
l.add(null, "3 4 renew-min minimum renew time");
l.add(null, "4 . <num> time in ms");
l.add(null, "3 4 renew-max maximum renew time");
l.add(null, "4 . <num> time in ms");
diff -r -U 10 --color ../src/src/net/freertr/clnt/clntDhcp4.java /safe/src/net/freertr/clnt/clntDhcp4.java
--- ../src/src/net/freertr/clnt/clntDhcp4.java 2023-05-17 10:11:16.000000000 +0200
+++ /safe/src/net/freertr/clnt/clntDhcp4.java 2023-05-17 17:56:32.452518500 +0200
@@ -25,20 +25,25 @@
* @author matecsaba
*/
public class clntDhcp4 implements prtServP {
/**
* early mode
*/
public boolean earlyMode = false;
/**
+ * fill ciaddr
+ */
+ public boolean fillCiaddr = true;
+
+ /**
* broadcast mode
*/
public boolean broadcastMode = true;
/**
* minimum lease time
*/
public int leaseMin = 60 * 1000;
/**
@@ -122,40 +127,45 @@
/**
* get configuration
*
* @param l storage
* @param beg beginning
* @param cmd command
*/
public void getConfig(List<String> l, String beg, String cmd) {
cmds.cfgLine(l, !broadcastMode, beg, cmd + "broadcast", "");
cmds.cfgLine(l, !earlyMode, beg, cmd + "early", "");
+ cmds.cfgLine(l, !fillCiaddr, beg, cmd + "fill-ciaddr", "");
l.add(beg + cmd + "renew-min " + leaseMin);
l.add(beg + cmd + "renew-max " + leaseMax);
}
/**
* do configuration
*
* @param a command
* @param cmd commands
* @return result code, true on error, false on success
*/
public boolean doConfig(String a, cmds cmd) {
if (a.equals("broadcast")) {
broadcastMode = true;
return false;
}
if (a.equals("early")) {
earlyMode = true;
return false;
}
+ if (a.equals("fill-ciaddr")) {
+ fillCiaddr = true;
+ return false;
+ }
if (a.equals("renew-min")) {
leaseMin = bits.str2num(cmd.word());
return false;
}
if (a.equals("renew-max")) {
leaseMax = bits.str2num(cmd.word());
return false;
}
return true;
}
@@ -168,20 +178,24 @@
*/
public boolean unConfig(String a) {
if (a.equals("broadcast")) {
broadcastMode = false;
return false;
}
if (a.equals("early")) {
earlyMode = false;
return false;
}
+ if (a.equals("fill-ciaddr")) {
+ fillCiaddr = false;
+ return false;
+ }
return true;
}
/**
* stop client
*/
public void closeClient() {
clearState();
socketUnbind();
if (debugger.clntDhcp4traf) {
@@ -403,22 +417,25 @@
}
packHolder pck = new packHolder(true, true);
packDhcp4 pckd = new packDhcp4();
pckd.bootpOp = packDhcp4.bootpOpRequest;
pckd.bootpXid = lastId;
pckd.bootpBroadcast = broadcastMode;
pckd.bootpChaddr = (addrMac) ethtyp.getHwAddr().copyBytes();
pckd.dhcpOp = packDhcp4.dhcpOpRequest;
pckd.putParamReqList();
pckd.dhcpClientId = true;
- // pckd.bootpCiaddr = locAddr.copyBytes(); // github pull req#21
- pckd.dhcpServer = dhcpAddr.copyBytes(); // github pull req#21
+ if (fillCiaddr) {
+ pckd.bootpCiaddr = locAddr.copyBytes();
+ } else {
+ pckd.dhcpServer = dhcpAddr.copyBytes();
+ }
pckd.dhcpRequested = locAddr.copyBytes();
pckd.createHeader(pck, null);
sender.send2net(pck);
lastTime = bits.getTime();
if (debugger.clntDhcp4traf) {
logger.debug("tx " + sender + " " + pckd);
}
}
private void sendKeepalive() {
some more tests here & there, but at the end of the day,
it should be out in the next "flash upgrade" in the signed jar...
br,
cs
…On 5/17/23 10:30, mc36 wrote:
Merged #21 <https://github.com/rare-freertr/freeRtr/pull/21> into master.
Reply to this email directly, view it on GitHub <https://github.com/rare-freertr/freeRtr/pull/21#event-9266347938>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD2P4G7JVSW2SRGLJIOQWFDXGSECXANCNFSM6AAAAAAYDU2BDQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
|
here is my current commit: rare-freertr@92d00bd
br,
cs
…On 5/17/23 18:04, mc36 wrote:
evening alemonmk,
it's 18:01 in my timezone and the feature is almost ready 4 the release..... :)
id(cfg-if)#show running-config this | include ciad
sid(cfg-if)#ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#show running-config this | include ciad
sid(cfg-if)#no ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#show running-config this | include ciad
no ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#no ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#show running-config this | include ciad
no ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#ipv4 dhcp-client fill-ciaddr
sid(cfg-if)#show running-config this | include ciad
sid(cfg-if)#
this is my current diff:
diff -r -U 10 --color ../src/src/net/freertr/cfg/cfgIfc.java /safe/src/net/freertr/cfg/cfgIfc.java
--- ../src/src/net/freertr/cfg/cfgIfc.java 2023-03-01 11:29:51.000000000 +0100
+++ /safe/src/net/freertr/cfg/cfgIfc.java 2023-05-17 17:54:30.560840500 +0200
@@ -1569,20 +1569,21 @@
"interface .*! no ipv[46] ptp enable",
"interface .*! no ipv[46] ptp receive",
"interface .*! ipv4 dhcp-client broadcast",
"interface .*! no ipv6 dhcp-client prefix",
"interface .*! no ipv[46] dhcp-client early",
"interface .*! ipv[46] dhcp-client renew-min 60000",
"interface .*! ipv[46] dhcp-client renew-max 43200000",
"interface .*! no ipv[46] dhcp-client enable",
"interface .*! no ipv6 prefix-suppress",
"interface .*! no ipv6 slaac-client enable",
+ "interface .*! ipv4 dhcp-client fill-ciaddr",
"interface .*! ipv6 slaac-client renew-min 60000",
"interface .*! ipv6 slaac-client renew-max 43200000",
"interface .*! no ipv6 prefix-dns",
"interface .*! no ipv6 prefix-domain",
"interface .*! ipv6 prefix-interval 120000",
"interface .*! ipv6 prefix-validity 604800000",
// multicast
"interface .*! no ipv[46] multicast source-override-in",
"interface .*! no ipv[46] multicast source-override-out",
"interface .*! ipv[46] multicast ttl-threshold 0",
@@ -6576,20 +6577,21 @@
l.add(null, "1 2 ipv4 interface internet protocol config commands");
ipFwdIface.getHelp(l);
l.add(null, "2 3 dhcp-client acquire address by dhcp");
l.add(null, "3 . enable start address acquision");
l.add(null, "3 . broadcast set broadcast flag");
l.add(null, "3 . early pick up address early");
l.add(null, "3 4 renew-min minimum renew time");
l.add(null, "4 . <num> time in ms");
l.add(null, "3 4 renew-max maximum renew time");
l.add(null, "4 . <num> time in ms");
+ l.add(null, "3 . fill-ciaddr fill in bootp ciaddr or dhcpserver address");
l.add(null, "2 3 pool peer address pool");
l.add(null, "3 . <name:pl4> name of address pool");
l.add(null, "1 2 ipv6 interface internet protocol config commands");
ipFwdIface.getHelp(l);
l.add(null, "2 3 slaac-client stateless address autoconfiguration");
l.add(null, "3 . enable start address acquision");
l.add(null, "3 4 renew-min minimum renew time");
l.add(null, "4 . <num> time in ms");
l.add(null, "3 4 renew-max maximum renew time");
l.add(null, "4 . <num> time in ms");
diff -r -U 10 --color ../src/src/net/freertr/clnt/clntDhcp4.java /safe/src/net/freertr/clnt/clntDhcp4.java
--- ../src/src/net/freertr/clnt/clntDhcp4.java 2023-05-17 10:11:16.000000000 +0200
+++ /safe/src/net/freertr/clnt/clntDhcp4.java 2023-05-17 17:56:32.452518500 +0200
@@ -25,20 +25,25 @@
* @author matecsaba
*/
public class clntDhcp4 implements prtServP {
/**
* early mode
*/
public boolean earlyMode = false;
/**
+ * fill ciaddr
+ */
+ public boolean fillCiaddr = true;
+
+ /**
* broadcast mode
*/
public boolean broadcastMode = true;
/**
* minimum lease time
*/
public int leaseMin = 60 * 1000;
/**
@@ -122,40 +127,45 @@
/**
* get configuration
*
* @param l storage
* @param beg beginning
* @param cmd command
*/
public void getConfig(List<String> l, String beg, String cmd) {
cmds.cfgLine(l, !broadcastMode, beg, cmd + "broadcast", "");
cmds.cfgLine(l, !earlyMode, beg, cmd + "early", "");
+ cmds.cfgLine(l, !fillCiaddr, beg, cmd + "fill-ciaddr", "");
l.add(beg + cmd + "renew-min " + leaseMin);
l.add(beg + cmd + "renew-max " + leaseMax);
}
/**
* do configuration
*
* @param a command
* @param cmd commands
* @return result code, true on error, false on success
*/
public boolean doConfig(String a, cmds cmd) {
if (a.equals("broadcast")) {
broadcastMode = true;
return false;
}
if (a.equals("early")) {
earlyMode = true;
return false;
}
+ if (a.equals("fill-ciaddr")) {
+ fillCiaddr = true;
+ return false;
+ }
if (a.equals("renew-min")) {
leaseMin = bits.str2num(cmd.word());
return false;
}
if (a.equals("renew-max")) {
leaseMax = bits.str2num(cmd.word());
return false;
}
return true;
}
@@ -168,20 +178,24 @@
*/
public boolean unConfig(String a) {
if (a.equals("broadcast")) {
broadcastMode = false;
return false;
}
if (a.equals("early")) {
earlyMode = false;
return false;
}
+ if (a.equals("fill-ciaddr")) {
+ fillCiaddr = false;
+ return false;
+ }
return true;
}
/**
* stop client
*/
public void closeClient() {
clearState();
socketUnbind();
if (debugger.clntDhcp4traf) {
@@ -403,22 +417,25 @@
}
packHolder pck = new packHolder(true, true);
packDhcp4 pckd = new packDhcp4();
pckd.bootpOp = packDhcp4.bootpOpRequest;
pckd.bootpXid = lastId;
pckd.bootpBroadcast = broadcastMode;
pckd.bootpChaddr = (addrMac) ethtyp.getHwAddr().copyBytes();
pckd.dhcpOp = packDhcp4.dhcpOpRequest;
pckd.putParamReqList();
pckd.dhcpClientId = true;
- // pckd.bootpCiaddr = locAddr.copyBytes(); // github pull req#21
- pckd.dhcpServer = dhcpAddr.copyBytes(); // github pull req#21
+ if (fillCiaddr) {
+ pckd.bootpCiaddr = locAddr.copyBytes();
+ } else {
+ pckd.dhcpServer = dhcpAddr.copyBytes();
+ }
pckd.dhcpRequested = locAddr.copyBytes();
pckd.createHeader(pck, null);
sender.send2net(pck);
lastTime = bits.getTime();
if (debugger.clntDhcp4traf) {
logger.debug("tx " + sender + " " + pckd);
}
}
private void sendKeepalive() {
some more tests here & there, but at the end of the day,
it should be out in the next "flash upgrade" in the signed jar...
br,
cs
On 5/17/23 10:30, mc36 wrote:
> Merged #21 <https://github.com/rare-freertr/freeRtr/pull/21> into master.
>
>
> Reply to this email directly, view it on GitHub <https://github.com/rare-freertr/freeRtr/pull/21#event-9266347938>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AD2P4G7JVSW2SRGLJIOQWFDXGSECXANCNFSM6AAAAAAYDU2BDQ>.
> You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
>
Reply to this email directly, view it on GitHub <https://github.com/rare-freertr/freeRtr/pull/21#issuecomment-1551673009>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD2P4G2YWYHJNRGR7TFEFJTXGTZJZANCNFSM6AAAAAAYDU2BDQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Remove ciaddr and added DHCP server ID in DHCPREQUEST messages, since it is MUST be filled for the first DHCP request as defined in RFC2131, section 4.4.1.
Those changes (at least) allow me to obtain an address via DHCP from my ISP. It's partly standard compliant because in renewing and rebinding state ciaddr has to be filled, but there are not such states here.