summaryrefslogtreecommitdiff
path: root/str.c
AgeCommit message (Collapse)AuthorFilesLines
2019-09-23trafgen: reset errno before calling sscanf in str2macJoachim Nilsson1-0/+1
When testing trafgen with the following example from the man page the error message "Failed to parse MAC address 11:22:33:44:55:66" is printed. trafgen -o lo --cpus 1 -n 3 '{ eth(da=11:22:33:44:55:66, da[0]=dinc()), tcp() }' Turns out errno was not cleared before str2mac() called sscanf(). Signed-off-by: Joachim Nilsson <troglobit@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-06-02str: Add function for converting string into DNS nameVadim Kochan1-0/+37
Add str2fqdn for converting hostname string into DNS name notation: www.xxxx.yy.com -> 3www4xxxx2yy3com0 Returned string must be freed after use by the caller. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-12-16str: Avoid trailing space in string returng by argv2str()Tobias Klauser1-2/+4
Don't add a trailing whitespace to the string returned by argv2str(). Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-01-28str: Add str2mac helper functionVadim Kochan1-0/+29
Add function to convert a string in the format xx:xx:xx:xx:xx:xx to a MAC address byte array. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tk: Add len parameter and error out on too short buffers] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-12-17str: Add helper to extend dynamically argv listVadim Kochan1-0/+20
Add argv_insert function to dynamically insert string into argv list. Also added argv_free func to easy free dynamically allocated argv list. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-09str: Add converting cmdline args vector to str moduleVadim Kochan1-0/+23
Move piece of code which converts cmdline args vector to string from netsniff-ng.c to str.c as function. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-06-04xutils: break out string handling and lockingDaniel Borkmann1-0/+88
Break out all string handling functions and lockme stuff in order to further eliminate the big code blob in xutils, so that it can be easier maintained. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>