|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
[PATCH 0/5] cifs: clean up show_options code and add support for mounting link-local addressesThis patchset does a bit of cleanup to the cifs_show_options code and
adds support for parsing and using link-local addresses. Should be pretty straightforward set. Jeff Layton (5): cifs: remove unneeded NULL checks from cifs_show_options cifs: have cifs_show_options show forceuid/forcegid options cifs: add new routine for converting AF_INET and AF_INET6 addrs cifs: have cifs parse scope_id out of IPv6 addresses and use it cifs: display scopeid in /proc/mounts fs/cifs/cifsfs.c | 148 +++++++++++++++++++++++++------------------------ fs/cifs/cifsproto.h | 2 +- fs/cifs/connect.c | 27 +++------ fs/cifs/dns_resolve.c | 23 +------ fs/cifs/netmisc.c | 56 +++++++++++++++++- 5 files changed, 141 insertions(+), 115 deletions(-) _______________________________________________ linux-cifs-client mailing list linux-cifs-client@... https://lists.samba.org/mailman/listinfo/linux-cifs-client |
|
|
[PATCH 1/5] cifs: remove unneeded NULL checks from cifs_show_optionsshow_options is always called with the namespace_sem held. Therefore we
don't need to worry about the vfsmount being NULL, or it vanishing while the function is running. By the same token, there's no need to worry about the superblock, tcon, smb or tcp sessions being NULL on entry. Signed-off-by: Jeff Layton <jlayton@...> --- fs/cifs/cifsfs.c | 130 ++++++++++++++++++++++++----------------------------- 1 files changed, 59 insertions(+), 71 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 0a10a59..ec63b09 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -342,80 +342,68 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) struct TCP_Server_Info *server; cifs_sb = CIFS_SB(m->mnt_sb); + tcon = cifs_sb->tcon; - if (cifs_sb) { - tcon = cifs_sb->tcon; - if (tcon) { - seq_printf(s, ",unc=%s", cifs_sb->tcon->treeName); - if (tcon->ses) { - if (tcon->ses->userName) - seq_printf(s, ",username=%s", - tcon->ses->userName); - if (tcon->ses->domainName) - seq_printf(s, ",domain=%s", - tcon->ses->domainName); - server = tcon->ses->server; - if (server) { - seq_printf(s, ",addr="); - switch (server->addr.sockAddr6. - sin6_family) { - case AF_INET6: - seq_printf(s, "%pI6", - &server->addr.sockAddr6.sin6_addr); - break; - case AF_INET: - seq_printf(s, "%pI4", - &server->addr.sockAddr.sin_addr.s_addr); - break; - } - } - } - if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) || - !(tcon->unix_ext)) - seq_printf(s, ",uid=%d", cifs_sb->mnt_uid); - if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) || - !(tcon->unix_ext)) - seq_printf(s, ",gid=%d", cifs_sb->mnt_gid); - if (!tcon->unix_ext) { - seq_printf(s, ",file_mode=0%o,dir_mode=0%o", + seq_printf(s, ",unc=%s", cifs_sb->tcon->treeName); + if (tcon->ses->userName) + seq_printf(s, ",username=%s", tcon->ses->userName); + if (tcon->ses->domainName) + seq_printf(s, ",domain=%s", tcon->ses->domainName); + + cifs_show_address(s, tcon->ses->server); + + seq_printf(s, ",uid=%d", cifs_sb->mnt_uid); + seq_printf(s, ",gid=%d", cifs_sb->mnt_gid); + + server = tcon->ses->server; + seq_printf(s, ",addr="); + switch (server->addr.sockAddr6.sin6_family) { + case AF_INET6: + seq_printf(s, "%pI6", &server->addr.sockAddr6.sin6_addr); + break; + case AF_INET: + seq_printf(s, "%pI4", &server->addr.sockAddr.sin_addr.s_addr); + break; + } + + if (!tcon->unix_ext) + seq_printf(s, ",file_mode=0%o,dir_mode=0%o", cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); - } - if (tcon->seal) - seq_printf(s, ",seal"); - if (tcon->nocase) - seq_printf(s, ",nocase"); - if (tcon->retry) - seq_printf(s, ",hard"); - } - if (cifs_sb->prepath) - seq_printf(s, ",prepath=%s", cifs_sb->prepath); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) - seq_printf(s, ",posixpaths"); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) - seq_printf(s, ",setuids"); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) - seq_printf(s, ",serverino"); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) - seq_printf(s, ",directio"); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) - seq_printf(s, ",nouser_xattr"); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) - seq_printf(s, ",mapchars"); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) - seq_printf(s, ",sfu"); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) - seq_printf(s, ",nobrl"); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) - seq_printf(s, ",cifsacl"); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) - seq_printf(s, ",dynperm"); - if (m->mnt_sb->s_flags & MS_POSIXACL) - seq_printf(s, ",acl"); - - seq_printf(s, ",rsize=%d", cifs_sb->rsize); - seq_printf(s, ",wsize=%d", cifs_sb->wsize); - } + if (tcon->seal) + seq_printf(s, ",seal"); + if (tcon->nocase) + seq_printf(s, ",nocase"); + if (tcon->retry) + seq_printf(s, ",hard"); + if (cifs_sb->prepath) + seq_printf(s, ",prepath=%s", cifs_sb->prepath); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) + seq_printf(s, ",posixpaths"); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) + seq_printf(s, ",setuids"); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) + seq_printf(s, ",serverino"); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) + seq_printf(s, ",directio"); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) + seq_printf(s, ",nouser_xattr"); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) + seq_printf(s, ",mapchars"); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) + seq_printf(s, ",sfu"); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) + seq_printf(s, ",nobrl"); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) + seq_printf(s, ",cifsacl"); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) + seq_printf(s, ",dynperm"); + if (m->mnt_sb->s_flags & MS_POSIXACL) + seq_printf(s, ",acl"); + + seq_printf(s, ",rsize=%d", cifs_sb->rsize); + seq_printf(s, ",wsize=%d", cifs_sb->wsize); + return 0; } -- 1.6.0.6 _______________________________________________ linux-cifs-client mailing list linux-cifs-client@... https://lists.samba.org/mailman/listinfo/linux-cifs-client |
|
|
[PATCH 2/5] cifs: have cifs_show_options show forceuid/forcegid optionsSigned-off-by: Jeff Layton <jlayton@...>
--- fs/cifs/cifsfs.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index ec63b09..a1520fc 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -353,7 +353,12 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) cifs_show_address(s, tcon->ses->server); seq_printf(s, ",uid=%d", cifs_sb->mnt_uid); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) + seq_printf(s, ",forceuid"); + seq_printf(s, ",gid=%d", cifs_sb->mnt_gid); + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) + seq_printf(s, ",forcegid"); server = tcon->ses->server; seq_printf(s, ",addr="); -- 1.6.0.6 _______________________________________________ linux-cifs-client mailing list linux-cifs-client@... https://lists.samba.org/mailman/listinfo/linux-cifs-client |
|
|
[PATCH 3/5] cifs: add new routine for converting AF_INET and AF_INET6 addrs...to consolidate some logic used in more than one place.
Signed-off-by: Jeff Layton <jlayton@...> --- fs/cifs/cifsproto.h | 2 +- fs/cifs/connect.c | 21 ++++----------------- fs/cifs/dns_resolve.c | 19 ++----------------- fs/cifs/netmisc.c | 34 ++++++++++++++++++++++++++++++---- 4 files changed, 37 insertions(+), 39 deletions(-) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index f945232..c419416 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -74,7 +74,7 @@ extern unsigned int smbCalcSize(struct smb_hdr *ptr); extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); extern int decode_negTokenInit(unsigned char *security_blob, int length, enum securityEnum *secType); -extern int cifs_inet_pton(const int, const char *source, void *dst); +extern int cifs_convert_address(char *src, void *dst); extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); extern void header_assemble(struct smb_hdr *, char /* command */ , const struct cifsTconInfo *, int /* length of diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index c7d789c..6a91b5f 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1421,28 +1421,15 @@ cifs_get_tcp_session(struct smb_vol *volume_info) memset(&addr, 0, sizeof(struct sockaddr_storage)); - if (volume_info->UNCip && volume_info->UNC) { - rc = cifs_inet_pton(AF_INET, volume_info->UNCip, - &sin_server->sin_addr.s_addr); - - if (rc <= 0) { - /* not ipv4 address, try ipv6 */ - rc = cifs_inet_pton(AF_INET6, volume_info->UNCip, - &sin_server6->sin6_addr.in6_u); - if (rc > 0) - addr.ss_family = AF_INET6; - } else { - addr.ss_family = AF_INET; - } + cFYI(1, ("UNC: %s ip: %s", volume_info->UNC, volume_info->UNCip)); - if (rc <= 0) { + if (volume_info->UNCip && volume_info->UNC) { + rc = cifs_convert_address(volume_info->UNCip, &addr); + if (!rc) { /* we failed translating address */ rc = -EINVAL; goto out_err; } - - cFYI(1, ("UNC: %s ip: %s", volume_info->UNC, - volume_info->UNCip)); } else if (volume_info->UNCip) { /* BB using ip addr as tcp_ses name to connect to the DFS root below */ diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c index df4a306..91b5500 100644 --- a/fs/cifs/dns_resolve.c +++ b/fs/cifs/dns_resolve.c @@ -37,24 +37,9 @@ static int is_ip(const char *name) { - int rc; - struct sockaddr_in sin_server; - struct sockaddr_in6 sin_server6; - - rc = cifs_inet_pton(AF_INET, name, - &sin_server.sin_addr.s_addr); - - if (rc <= 0) { - /* not ipv4 address, try ipv6 */ - rc = cifs_inet_pton(AF_INET6, name, - &sin_server6.sin6_addr.in6_u); - if (rc > 0) - return 1; - } else { - return 1; - } - /* we failed translating address */ - return 0; + struct sockaddr_storage ss; + + return cifs_convert_address(name, &ss); } static int diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index 32d6baa..00e6e35 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c @@ -133,10 +133,12 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = { {0, 0} }; -/* Convert string containing dotted ip address to binary form */ -/* returns 0 if invalid address */ - -int +/* + * Convert a string containing text IPv4 or IPv6 address to binary form. + * + * Returns 0 on failure. + */ +static int cifs_inet_pton(const int address_family, const char *cp, void *dst) { int ret = 0; @@ -153,6 +155,30 @@ cifs_inet_pton(const int address_family, const char *cp, void *dst) return ret; } +/* + * Try to convert a string to an IPv4 address and then attempt to convert + * it to an IPv6 address if that fails. Set the family field if either + * succeeds. + * + * Returns 0 on failure. + */ +int +cifs_convert_address(char *src, void *dst) +{ + struct sockaddr_in *s4 = (struct sockaddr_in *) dst; + struct sockaddr_in6 *s6 = (Struct sockaddr_in6 *) dst; + + if (cifs_inet_pton(AF_INET, src, &s4->sin_addr.s_addr)) { + s4->sin_family = AF_INET; + return 1; + } else if (cifs_inet_pton(AF_INET6, src, &s6->sin6_addr.s6_addr)) { + s6->sin6_family = AF_INET6; + return 1; + } + + return 0; +} + /***************************************************************************** convert a NT status code to a dos class/code *****************************************************************************/ -- 1.6.0.6 _______________________________________________ linux-cifs-client mailing list linux-cifs-client@... https://lists.samba.org/mailman/listinfo/linux-cifs-client |
|
|
[PATCH 4/5] cifs: have cifs parse scope_id out of IPv6 addresses and use itThis patch has CIFS look for a '%' in an IPv6 address. If one is
present then it will try to treat that value as a numeric interface index suitable for stuffing into the sin6_scope_id field. This should allow people to mount servers on IPv6 link-local addresses. Signed-off-by: Jeff Layton <jlayton@...> --- fs/cifs/connect.c | 6 ++++-- fs/cifs/dns_resolve.c | 4 ++-- fs/cifs/netmisc.c | 34 ++++++++++++++++++++++++++++------ 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 6a91b5f..c9e489c 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1374,8 +1374,10 @@ cifs_find_tcp_session(struct sockaddr_storage *addr) server->addr.sockAddr.sin_addr.s_addr)) continue; else if (addr->ss_family == AF_INET6 && - !ipv6_addr_equal(&server->addr.sockAddr6.sin6_addr, - &addr6->sin6_addr)) + (!ipv6_addr_equal(&server->addr.sockAddr6.sin6_addr, + &addr6->sin6_addr) || + server->addr.sockAddr6.sin6_scope_id != + addr6->sin6_scope_id)) continue; ++server->srv_count; diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c index 91b5500..8794814 100644 --- a/fs/cifs/dns_resolve.c +++ b/fs/cifs/dns_resolve.c @@ -35,7 +35,7 @@ * 0 - name is not IP */ static int -is_ip(const char *name) +is_ip(char *name) { struct sockaddr_storage ss; @@ -57,7 +57,7 @@ dns_resolver_instantiate(struct key *key, const void *data, ip[datalen] = '\0'; /* make sure this looks like an address */ - if (!is_ip((const char *) ip)) { + if (!is_ip(ip)) { kfree(ip); return -EINVAL; } diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index 00e6e35..bd6d689 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c @@ -158,25 +158,47 @@ cifs_inet_pton(const int address_family, const char *cp, void *dst) /* * Try to convert a string to an IPv4 address and then attempt to convert * it to an IPv6 address if that fails. Set the family field if either - * succeeds. + * succeeds. If it's an IPv6 address and it has a '%' sign in it, try to + * treat the part following it as a numeric sin6_scope_id. * * Returns 0 on failure. */ int cifs_convert_address(char *src, void *dst) { + int rc; + char *pct, *endp; struct sockaddr_in *s4 = (struct sockaddr_in *) dst; - struct sockaddr_in6 *s6 = (Struct sockaddr_in6 *) dst; + struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) dst; + /* IPv4 address */ if (cifs_inet_pton(AF_INET, src, &s4->sin_addr.s_addr)) { s4->sin_family = AF_INET; return 1; - } else if (cifs_inet_pton(AF_INET6, src, &s6->sin6_addr.s6_addr)) { - s6->sin6_family = AF_INET6; - return 1; } - return 0; + /* temporarily terminate string */ + pct = strchr(src, '%'); + if (pct) + *pct = '\0'; + + rc = cifs_inet_pton(AF_INET6, src, &s6->sin6_addr.s6_addr); + + /* repair temp termination (if any) and make pct point to scopeid */ + if (pct) + *pct++ = '%'; + + if (!rc) + return rc; + + s6->sin6_family = AF_INET6; + if (pct) { + s6->sin6_scope_id = (u32) simple_strtoul(pct, &endp, 0); + if (!*pct || *endp) + return 0; + } + + return rc; } /***************************************************************************** -- 1.6.0.6 _______________________________________________ linux-cifs-client mailing list linux-cifs-client@... https://lists.samba.org/mailman/listinfo/linux-cifs-client |
|
|
[PATCH 5/5] cifs: display scopeid in /proc/mountsMove address display into a new function and display the scopeid as part
of the address in /proc/mounts. Signed-off-by: Jeff Layton <jlayton@...> --- fs/cifs/cifsfs.c | 33 ++++++++++++++++++++++----------- 1 files changed, 22 insertions(+), 11 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index a1520fc..882e671 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -329,6 +329,27 @@ cifs_destroy_inode(struct inode *inode) kmem_cache_free(cifs_inode_cachep, CIFS_I(inode)); } +static void +cifs_show_address(struct seq_file *s, struct TCP_Server_Info *server) +{ + seq_printf(s, ",addr="); + + switch (server->addr.sockAddr.sin_family) { + case AF_INET: + seq_printf(s, "%pI4", &server->addr.sockAddr.sin_addr.s_addr); + break; + case AF_INET6: + seq_printf(s, "%pI6", + &server->addr.sockAddr6.sin6_addr.s6_addr); + if (server->addr.sockAddr6.sin6_scope_id) + seq_printf(s, "%%%u", + server->addr.sockAddr6.sin6_scope_id); + break; + default: + seq_printf(s, "(unknown)"); + } +} + /* * cifs_show_options() is for displaying mount options in /proc/mounts. * Not all settable options are displayed but most of the important @@ -339,7 +360,6 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) { struct cifs_sb_info *cifs_sb; struct cifsTconInfo *tcon; - struct TCP_Server_Info *server; cifs_sb = CIFS_SB(m->mnt_sb); tcon = cifs_sb->tcon; @@ -360,16 +380,7 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) seq_printf(s, ",forcegid"); - server = tcon->ses->server; - seq_printf(s, ",addr="); - switch (server->addr.sockAddr6.sin6_family) { - case AF_INET6: - seq_printf(s, "%pI6", &server->addr.sockAddr6.sin6_addr); - break; - case AF_INET: - seq_printf(s, "%pI4", &server->addr.sockAddr.sin_addr.s_addr); - break; - } + cifs_show_address(s, tcon->ses->server); if (!tcon->unix_ext) seq_printf(s, ",file_mode=0%o,dir_mode=0%o", -- 1.6.0.6 _______________________________________________ linux-cifs-client mailing list linux-cifs-client@... https://lists.samba.org/mailman/listinfo/linux-cifs-client |
|
|
Re: [PATCH 4/5] cifs: have cifs parse scope_id outof IPv6 addresses and use itJeff,
Great to see this going into the code. Do you plan to allow for textual interface names after the %? You can use getnameinfo() with the NI_NUMERICHOST flag to convert the textual interface name and IPv6 address to numeric format or just use if_nametoindex(). Regards, David > This patch has CIFS look for a '%' in an IPv6 address. If one is > present then it will try to treat that value as a numeric interface > index suitable for stuffing into the sin6_scope_id field. > > This should allow people to mount servers on IPv6 link-local addresses. > > Signed-off-by: Jeff Layton <jlayton@...> > --- > fs/cifs/connect.c | 6 ++++-- > fs/cifs/dns_resolve.c | 4 ++-- > fs/cifs/netmisc.c | 34 ++++++++++++++++++++++++++++------ > 3 files changed, 34 insertions(+), 10 deletions(-) > > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c > index 6a91b5f..c9e489c 100644 > --- a/fs/cifs/connect.c > +++ b/fs/cifs/connect.c > @@ -1374,8 +1374,10 @@ cifs_find_tcp_session(struct sockaddr_storage > *addr) > server->addr.sockAddr.sin_addr.s_addr)) > continue; > else if (addr->ss_family == AF_INET6 && > - !ipv6_addr_equal(&server->addr.sockAddr6.sin6_addr, > - &addr6->sin6_addr)) > + (!ipv6_addr_equal(&server->addr.sockAddr6.sin6_addr, > + &addr6->sin6_addr) || > + server->addr.sockAddr6.sin6_scope_id != > + addr6->sin6_scope_id)) > continue; > > ++server->srv_count; > diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c > index 91b5500..8794814 100644 > --- a/fs/cifs/dns_resolve.c > +++ b/fs/cifs/dns_resolve.c > @@ -35,7 +35,7 @@ > * 0 - name is not IP > */ > static int > -is_ip(const char *name) > +is_ip(char *name) > { > struct sockaddr_storage ss; > > @@ -57,7 +57,7 @@ dns_resolver_instantiate(struct key *key, const void > *data, > ip[datalen] = '\0'; > > /* make sure this looks like an address */ > - if (!is_ip((const char *) ip)) { > + if (!is_ip(ip)) { > kfree(ip); > return -EINVAL; > } > diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c > index 00e6e35..bd6d689 100644 > --- a/fs/cifs/netmisc.c > +++ b/fs/cifs/netmisc.c > @@ -158,25 +158,47 @@ cifs_inet_pton(const int address_family, const char > *cp, void *dst) > /* > * Try to convert a string to an IPv4 address and then attempt to convert > * it to an IPv6 address if that fails. Set the family field if either > - * succeeds. > + * succeeds. If it's an IPv6 address and it has a '%' sign in it, try to > + * treat the part following it as a numeric sin6_scope_id. > * > * Returns 0 on failure. > */ > int > cifs_convert_address(char *src, void *dst) > { > + int rc; > + char *pct, *endp; > struct sockaddr_in *s4 = (struct sockaddr_in *) dst; > - struct sockaddr_in6 *s6 = (Struct sockaddr_in6 *) dst; > + struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) dst; > > + /* IPv4 address */ > if (cifs_inet_pton(AF_INET, src, &s4->sin_addr.s_addr)) { > s4->sin_family = AF_INET; > return 1; > - } else if (cifs_inet_pton(AF_INET6, src, &s6->sin6_addr.s6_addr)) { > - s6->sin6_family = AF_INET6; > - return 1; > } > > - return 0; > + /* temporarily terminate string */ > + pct = strchr(src, '%'); > + if (pct) > + *pct = '\0'; > + > + rc = cifs_inet_pton(AF_INET6, src, &s6->sin6_addr.s6_addr); > + > + /* repair temp termination (if any) and make pct point to scopeid */ > + if (pct) > + *pct++ = '%'; > + > + if (!rc) > + return rc; > + > + s6->sin6_family = AF_INET6; > + if (pct) { > + s6->sin6_scope_id = (u32) simple_strtoul(pct, &endp, 0); > + if (!*pct || *endp) > + return 0; > + } > + > + return rc; > } > > /***************************************************************************** > -- > 1.6.0.6 > > _______________________________________________ > linux-cifs-client mailing list > linux-cifs-client@... > https://lists.samba.org/mailman/listinfo/linux-cifs-client > _______________________________________________ linux-cifs-client mailing list linux-cifs-client@... https://lists.samba.org/mailman/listinfo/linux-cifs-client |
|
|
Re: [PATCH 4/5] cifs: have cifs parse scope_id outof IPv6 addresses and use itOn Thu, 11 Jun 2009 16:13:05 +0100 (BST)
"David Holder" <david@...> wrote: > Jeff, > > Great to see this going into the code. Do you plan to allow for textual > interface names after the %? > > You can use getnameinfo() with the NI_NUMERICHOST flag to convert the > textual interface name and IPv6 address to numeric format or just use > if_nametoindex(). > > Regards, David > Yep. Users will be able to use text interface names assuming they have mount.cifs installed. getaddrinfo will convert textual interface names to numeric ones already, so we don't really need to do much special for this. This support will depend on a mount.cifs patch too (sorry, should have made that clear when I posted the kernel patchset). The mount.cifs patch is similar, but slightly different from the one posted yesterday. FWIW, when I was testing today, my mount string was: mount -t cifs -o sec=none //fe80::21d:7dff:fe9c:3c86%eth0/scratch /mnt/cifs ...and it worked just fine. I'll send the mount.cifs patch along in a little while... -- Jeff Layton <jlayton@...> _______________________________________________ linux-cifs-client mailing list linux-cifs-client@... https://lists.samba.org/mailman/listinfo/linux-cifs-client |
|
|
Re: [PATCH 0/5] cifs: clean up show_options code and add support for mounting link-local addressesmay be a little while before I can doublecheck, test and merge these,
but seems reasonable at first glance ... On Thu, Jun 11, 2009 at 9:27 AM, Jeff Layton<jlayton@...> wrote: > This patchset does a bit of cleanup to the cifs_show_options code and > adds support for parsing and using link-local addresses. Should be > pretty straightforward set. > > Jeff Layton (5): > cifs: remove unneeded NULL checks from cifs_show_options > cifs: have cifs_show_options show forceuid/forcegid options > cifs: add new routine for converting AF_INET and AF_INET6 addrs > cifs: have cifs parse scope_id out of IPv6 addresses and use it > cifs: display scopeid in /proc/mounts > > fs/cifs/cifsfs.c | 148 +++++++++++++++++++++++++------------------------ > fs/cifs/cifsproto.h | 2 +- > fs/cifs/connect.c | 27 +++------ > fs/cifs/dns_resolve.c | 23 +------ > fs/cifs/netmisc.c | 56 +++++++++++++++++- > 5 files changed, 141 insertions(+), 115 deletions(-) > > -- Thanks, Steve _______________________________________________ linux-cifs-client mailing list linux-cifs-client@... https://lists.samba.org/mailman/listinfo/linux-cifs-client |
| Free embeddable forum powered by Nabble | Forum Help |