cifs: Allow binding to local IP address.
Subsystems (2)
When using multi-homed machines, it's nice to be able to specify the local IP to use for outbound connections. This patch gives cifs the ability to bind to a particular IP address.
Usage: mount -t cifs -o bindaddr=192.168.1.50,user=foo, ...
---
:100644 100644 b7431af... 7466533... M fs/cifs/cifsfs.c
:100644 100644 c9d0cfc... c0176d8... M fs/cifs/cifsglob.h
:100644 100644 ec0ea4a... cc0a16a... M fs/cifs/connect.c
fs/cifs/cifsfs.c | 3 +++ fs/cifs/cifsglob.h | 1 + fs/cifs/connect.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 53 insertions(+), 2 deletions(-)
fs/cifs/cifsfs.c +3 -0
@@ -374,6 +374,9 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)if (tcon->ses->domainName)seq_printf (s,",domain=%s" , tcon->ses->domainName); +if (tcon->ses->server->ip4_local_ip) +seq_printf (s,",bindaddr=%pI4" , &tcon->ses->server->ip4_local_ip); +seq_printf (s,",uid=%d" , cifs_sb->mnt_uid);if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_UID )seq_printf (s,",forceuid" );
fs/cifs/cifsglob.h +1 -0
@@ -157,6 +157,7 @@ struct TCP_Server_Info {struct sockaddr_in sockAddr;struct sockaddr_in6 sockAddr6; } addr; +u32 ip4_local_ip;wait_queue_head_t response_q;wait_queue_head_t request_q;/* if more than maxmpx to srvr must block*/ struct list_head pending_mid_q;
fs/cifs/connect.c +49 -2
99 lines not on this page · raw message
Signature · 1 line
1.6.2.5
A message that is not in the archive (sent off-list or not yet received): 1282777235-20218-1-git-send-email-greearb-my8/[email protected]
Quoted 5 lines · Ben Greear
When using multi-homed machines, it's nice to be able to specify the local IP to use for outbound connections. This patch gives cifs the ability to bind to a particular IP address.
Usage: mount -t cifs -o bindaddr=192.168.1.50,user=foo, ...
Seems like a reasonable idea, but I have a few questions. Is there a similar named mount option for other network file systems on other operating systems?
Also don't IPv6 address strings already allow you to specify the local interface to use?
Signature · 3 lines
Thanks, Steve
Quoted 10 lines · Steve French
Quoted 5 lines · Ben Greear
When using multi-homed machines, it's nice to be able to specify the local IP to use for outbound connections. This patch gives cifs the ability to bind to a particular IP address.
Usage: mount -t cifs -o bindaddr=192.168.1.50,user=foo, ...
Seems like a reasonable idea, but I have a few questions. Is there a similar named mount option for other network file systems on other operating systems?
I have patches for NFS as well, but they are a bit more complex, so I was going to start with cifs.
It *seems* that bindaddr is sort of half way expected to work,
for nfs, (but does not on linux, last I checked, without my additional patches).
I've never tried this on any other platform.
Quoted 2 lines
Also don't IPv6 address strings already allow you to specify the local interface to use?
I think you still have to do the bind() call somewhere, and I don't think that is happening in the current cifs code.
If/when I can get the ipv4 stuff in acceptable shape for inclusion, I'll work on ipv6 (it shouldn't be much additional work).
Thanks,
Ben
Signature · 2 lines
Ben Greear <greearb-my8/[email protected]> Candela Technologies Inc http://www.candelatech.com