Skip to Content.
Sympa Menu

rare-dev - Re: [rare-dev] [rare-freertr/freeRtr] Make DHCPv4 client (partly) RFC compliant (PR #21)

Subject: Rare project developers

List archive

Re: [rare-dev] [rare-freertr/freeRtr] Make DHCPv4 client (partly) RFC compliant (PR #21)


Chronological Thread 
  • From: mc36 <>
  • To: rare-freertr/freeRtr <>, mc36 <>, rare-freertr/freeRtr <>
  • Cc: mc36 <>, Your activity <>, "" <>, "" <>, "" <>
  • Subject: Re: [rare-dev] [rare-freertr/freeRtr] Make DHCPv4 client (partly) RFC compliant (PR #21)
  • Date: Wed, 17 May 2023 18:04:25 +0200

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:
<>



  • Re: [rare-dev] [rare-freertr/freeRtr] Make DHCPv4 client (partly) RFC compliant (PR #21), mc36, 05/17/2023

Archive powered by MHonArc 2.6.24.

Top of Page