search for: write_option

Displaying 9 results from an estimated 9 matches for "write_option".

2011 Apr 15
2
[PATCH] Escape DHCP options written to /tmp/net-$DEVCICE.conf
...6 deletions(-) diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c index 76708a9..e53e22c 100644 --- a/usr/kinit/ipconfig/main.c +++ b/usr/kinit/ipconfig/main.c @@ -95,6 +95,25 @@ static void configure_device(struct netdev *dev) dev->hostname, dev->name); } +static void write_option(FILE* f, const char* name, const char* value) +{ + int i=0; + + fprintf(f, "%s=\"", name); + while (value[i]) { + switch (value[i]) { + case '"': + case '$': + case '`': + case '\\': + fprintf(f, "\\"); + } + fprintf(f, &qu...
2017 Dec 19
0
[PATCH] Implement classless static routes
...printf("IP-Config: failed to set routes on %s\n", dev->name); if (dev->hostname[0] && sethostname(dev->hostname, strlen(dev->hostname))) @@ -160,8 +173,24 @@ static void dump_device_config(struct netdev *dev) my_inet_ntoa(dev->ip_broadcast)); write_option(f, "IPV4NETMASK", my_inet_ntoa(dev->ip_netmask)); - write_option(f, "IPV4GATEWAY", - my_inet_ntoa(dev->ip_gateway)); + if (dev->routes != NULL) { + /* Use 6 digits to encode the index */ + char key[23]; + char value[19]; + int i = 0; + struct route *...
2018 Jun 12
0
[PATCH v2] Implement classless static routes
...printf("IP-Config: failed to set routes on %s\n", dev->name); if (dev->hostname[0] && sethostname(dev->hostname, strlen(dev->hostname))) @@ -160,8 +180,24 @@ static void dump_device_config(struct netdev *dev) my_inet_ntoa(dev->ip_broadcast)); write_option(f, "IPV4NETMASK", my_inet_ntoa(dev->ip_netmask)); - write_option(f, "IPV4GATEWAY", - my_inet_ntoa(dev->ip_gateway)); + if (dev->routes != NULL) { + /* Use 6 digits to encode the index */ + char key[23]; + char value[19]; + int i = 0; + struct route *...
2019 Jan 18
0
[klibc:master] ipconfig: Implement classless static routes
...printf("IP-Config: failed to set routes on %s\n", dev->name); if (dev->hostname[0] && sethostname(dev->hostname, strlen(dev->hostname))) @@ -161,8 +181,24 @@ static void dump_device_config(struct netdev *dev) my_inet_ntoa(dev->ip_broadcast)); write_option(f, "IPV4NETMASK", my_inet_ntoa(dev->ip_netmask)); - write_option(f, "IPV4GATEWAY", - my_inet_ntoa(dev->ip_gateway)); + if (dev->routes != NULL) { + /* Use 6 digits to encode the index */ + char key[23]; + char value[19]; + int i = 0; + struct route *...
2018 Jun 18
1
[PATCH v3 1/2] Implement classless static routes
...printf("IP-Config: failed to set routes on %s\n", dev->name); if (dev->hostname[0] && sethostname(dev->hostname, strlen(dev->hostname))) @@ -160,8 +180,24 @@ static void dump_device_config(struct netdev *dev) my_inet_ntoa(dev->ip_broadcast)); write_option(f, "IPV4NETMASK", my_inet_ntoa(dev->ip_netmask)); - write_option(f, "IPV4GATEWAY", - my_inet_ntoa(dev->ip_gateway)); + if (dev->routes != NULL) { + /* Use 6 digits to encode the index */ + char key[23]; + char value[19]; + int i = 0; + struct route *...
2012 May 22
0
[klibc:master] ipconfig: Write $DOMAINSEARCH as domain-search
...+ udp header */ [1] = {&bootp, sizeof(struct bootp_hdr)}, diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c index 148ccb6..476384a 100644 --- a/usr/kinit/ipconfig/main.c +++ b/usr/kinit/ipconfig/main.c @@ -176,6 +176,8 @@ static void dump_device_config(struct netdev *dev) write_option(f, "UPTIME", buf21); sprintf(buf21, "%u", (unsigned int)dev->dhcpleasetime); write_option(f, "DHCPLEASETIME", buf21); + write_option(f, "DOMAINSEARCH", dev->domainsearch == NULL ? + "" : dev->domainsearch); fclose(f); }...
2012 May 22
0
[klibc:master] ipconfig: Use /run/ directory for script file
...etdev *dev) * sizeof(UINT64_MAX)==21 */ char buf21[21]; + const char path[] = "/run/"; - snprintf(fn, sizeof(fn), "/tmp/net-%s.conf", dev->name); + snprintf(fn, sizeof(fn), "%snet-%s.conf", path, dev->name); f = fopen(fn, "w"); if (f) { write_option(f, "DEVICE", dev->name);
2011 Jul 08
4
[PATCH 0/4] usr/kinit checkpatch
Various coding style fixes checkpatch warns about. The goal is not to be 100% checkpatch compliant, but to have more consistent coding style. As this is a trivial patch serie, will land in 24 hours in klibc git, unless of course ml review hits a bugger. Checked with size(3) that the generated kinit, fstype, ipconfig and nfsmount are the same. maximilian attems (4): [klibc] ipconfig: reduce
2011 Jul 05
6
[PATCH 1/7] ln: Check snprintf() return values
Add some semi-useful error message, as printing the failing dir or file seems not really advisable after that error. Signed-off-by: maximilian attems <max at stro.at> --- usr/utils/ln.c | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/usr/utils/ln.c b/usr/utils/ln.c index e826eb8..257b33f 100644 --- a/usr/utils/ln.c +++ b/usr/utils/ln.c @@ -9,7