ksmb: add ipv6 support in parse_srvaddr() in smb client
Subsystems (2)
PATCH 1/1 ksmb: add ipv6 support in parse_srvaddr() in smb client
Add ipv6 support in parse_srvaddr() in fs/smb/client/cifsroot.c. The existing parser filters out ipv4 out of the given string. The updated implementation identifies the ip version by checking the characters used and filters out the ip.
Signed-off-by Aaditya Kansal <[email protected]>
--- fs/smb/client/cifsroot.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
fs/smb/client/cifsroot.c +10 -3
@@ -24,13 +24,20 @@ static char root_opts[1024] __initdata = DEFAULT_MNT_OPTS;static __be32 __init parse_srvaddr (char *start,char *end) { -/* TODO: ipv6 support */ -char addr[sizeof ("aaa.bbb.ccc.ddd" )]; +char addr[sizeof ("aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh" )];int i =0 ; +int ipv6 =-1 ;while (start < end && i <sizeof (addr) -1 ) { -if (isdigit (*start) || *start =='.' ) +if (isdigit (*start)) addr[i++] = *start; +else if (*start =='.' && ipv6 !=1 ) { + addr[i++] = *start; + ipv6 =0 ; + }else if ((isalpha (*start) || *start ==':' ) && ipv6 !=0 ) { + addr[i++] = *start; + ipv6 =1 ; + } start++; } addr[i] ='\0' ;
Signature · 1 line
2.51.1