summaryrefslogtreecommitdiffhomepage
path: root/utils.c
AgeCommit message (Collapse)Author
2020-07-11utils: fix check_pid_path to work with deleted file as wellKarel Kočí
check_pid_patch is checking if process with given PID and executable path is running. If this code fails the rest of the code can be convinced that program is no longer running and possibly spawns new instance that can collide with already running one. This behavior was reproduced with hostapd. Symbolic link exe in process subdirectory in /proc points to original executable. The problem is that it reads as original path plus string ' (deleted)' if file is removed. The process is still running but original file is no longer available on files system. This behavior is triggered not only when file is removed (unlinked) but also when file is replaced. This happens clearly on package update. In general this happens any time all references (hard links) to file are removed from file system. This is not ultimate fix as exe link points to any last reference on file system with preference for original one. The problem is if there are multiple references and the original one is removed. This can be reproduced just by copying executable (hard linking) and unlinking the original one. In such case exe link would point to copy and not to original deleted one. Signed-off-by: Karel Kočí <karel.koci@nic.cz>
2016-08-11utils: Move IP address validation to parse_addr functionHans Dedecker
Commit 7a51f23e adds IP address validation in the function parse_ip_and_netmask; however the added check is too restrictive as the function is used on several places resulting into the problem multicast routes cannot be added anymore via UCI. Therefore move the IP host address validation to the function parse_addr so experimantal/multicast addresses cannot be added as a host IP address while multicast routes can be added again. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-03-07utils.c: Add ip address validationNaresh Kumar Mehta
Do not allow configuring invalid IPv4/IPv6 addresses. Curently if I configure LAN IP Address as 224.1.1.1, netifd will configure it. e.g. uci set network.lan.ipaddr='224.1.1.1' uci commit /etc/init.d/network restart Now ifconfig br-lan returns br-lan Link encap:Ethernet HWaddr 00:03:7F:13:BA:17 inet addr:224.1.1.1 Bcast:224.1.1.255 Mask:255.255.255.0 which is wrong. If I use ifconfig eth1 224.1.1.1, I will get ifconfig: SIOCSIFADDR: Invalid argument it means ifconfig is working fine, whereas netifd not. Proposed patch will test IPv4 address to make sure it is class A/B/C only. Similarly IPv6 multicast addresses will not be allowed. Signed-off-by: Naresh Kumar Mehta <naresh@codeaurora.org>
2015-02-16utils.c: add missing includeFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-02-17add a helper to convert blobmsg types to luci validate rulesJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-10-22utils: add a function for checking if a process given by pid is still aliveFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-19Only update resolv.conf if changed (avoid logspam)Steven Barth
2012-09-28utils.c: add helper function to format mac addresses as stringsJo-Philipp Wich
2012-06-18Move IP address parsing functions to utils.Stéphan Kochen
This is a patch series against the netifd repository. This first patch moves some previously static functions to utils, so that the follow up patch may use them from system-linux.c. Signed-off-by: Stéphan Kochen <stephan@kochen.nl>
2012-05-26vlist is now part of libuboxFelix Fietkau
2012-05-26avl_strcmp is now part of libuboxFelix Fietkau
2012-05-20flush list in vlist_replace()Felix Fietkau
2012-05-19move dns server/search list parsing to interface core to support peerdns=0 + ↵Felix Fietkau
static entries
2012-05-04add copyright headersFelix Fietkau
2012-03-04vlist: add a special node version -1 for nodes that should not be flushed on ↵Felix Fietkau
updates
2012-03-04simplify vlist, move avl key handling to vlist_add()Felix Fietkau
2012-02-03vlist: fix node version update for tree->keep_old/no_deleteFelix Fietkau
2012-01-15add a simplified vlist typeFelix Fietkau
2011-10-24fix a logic error leading to segfaults on updatesFelix Fietkau
2011-10-03utils: fix existing node check when keep_old/no_delete is enabledFelix Fietkau
2011-10-02add a new vlist flag for avoiding automatic delete of entriesFelix Fietkau
2011-10-02vlist: store a pointer to the real key to make lookups easierFelix Fietkau
2011-10-02extend vlist code to allow keeping the old data structure instead of the new ↵Felix Fietkau
one on updates
2011-10-02make versioned lists more flexible by using an external comparatorFelix Fietkau
2011-09-07add code for versioned lists and use it to manage addresses and routesFelix Fietkau
2011-09-07move some code to utils.[ch]Felix Fietkau