Re: If source address specified on mount, it should force destination address to be same type (IPv4 vs IPv6)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 17, 2025 at 4:12 PM Ben Greear <greearb@xxxxxxxxxxxxxxx> wrote:
>
> On 2/17/25 1:28 PM, Tom Talpey wrote:
> > On 2/17/2025 4:18 PM, Steve French wrote:
> >> On Mon, Feb 17, 2025 at 3:08 PM Tom Talpey <tom@xxxxxxxxxx> wrote:
> >>>
> >>> On 2/17/2025 1:27 PM, Steve French wrote:
> >>>> Noticed this old bug today when cleaning up emails.
> >>>>
> >>>> When the user specifies a srcaddr on mount, the DNS resolution of the
> >>>> host name should only look for the same type of address (ie IPv4 if
> >>>> srcaddr is IPv4, IPv6 if IPv6) right?
> >>>>
> >>>> Any thoughts on how this was handled in other protocols?
> >>>
> >>> What is this "srcaddr" witchcraft that thou dost utter? :)
> >>
> >> The original patch which added it was this, and apparently is needed in some
> >> cases where the subnet the request comes from is restricted:
> >>
> >> commit 3eb9a8893a76cf1cda3b41c3212eb2cfe83eae0e
> >> Author: Ben Greear <greearb@xxxxxxxxxxxxxxx>
> >> Date:   Wed Sep 1 17:06:02 2010 -0700
> >>
> >>      cifs: Allow binding to local IP address.
> >>
> >>      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 srcaddr=192.168.1.50,user=foo, ...
> >>         Usage:  mount -t cifs -o srcaddr=2002::100:1,user=foo, ...
> >>
> >>      Acked-by: Jeff Layton <jlayton@xxxxxxxxxx>
> >>      Acked-by: Dr. David Holder <david.holder@xxxxxxxxxxx>
> >>      Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx>
> >
> > I still think this is a hack, and unlikely to work reliably.
>
> Except for that DNS issue, it works as intended as far as I can tell, and someone that doesn't want
> the behaviour can just not use it.

Presumably this could be fixed in cifs-utils by checking for the cases
when "srcaddr=" is
specified, only assembling the list of host ip addresses that match
IPv4 vs. IPv6
(ie change to resolve_host() function in cifs-utils/resolve_host.c)



> I guess we never run CIFS in mixed ipv4/6 environment with DNS.
>
> >>> There isn't such an option in mount.nfs that I'm aware of.
> >>> And, it isn't documented in mount.cifs either.
> >>
> >> NFS man page does show "clientaddr=" mount option,
> >> and it is necessary apparently in some cases (e.g.
> >> https://forum.proxmox.com/threads/nfs-mounts-using-wrong-source-ip-interface.70754/)
> >
> > The NFSv4.0 clientaddr is totally different, that protocol requires
> > the client to inform the server which address to establish a
> > callback channel to. This horribly broken protocol architecture
> > was corrected in NFSv4.1.
>
> NFS requires a small pile of patches to have a similar behaviour...they are in
> our kernel (github.com greearb) in case anyone wants them, but were never accepted upstream.
>
> Thanks,
> Ben
>
> >
> > Tom.
> >
> >>
> >>
> >>> It seems like a hack on top of a hack to match the DNS result
> >>> to the type of the specified srcaddr. If the server supports
> >>> both IP versions and the DNS record exposes them, won't the
> >>> same issue occur on "normal" mounts?
> >>>
> >>> I would not see this playing nicely with multichannel, btw.
> >>> Or RDMA. Probably other scenarios.
> >>>
> >>> Tom.
> >>>
> >>>
> >>>>
> >>>> https://bugzilla.kernel.org/show_bug.cgi?id=218523
> >>
> >
>
>
> --
> Ben Greear <greearb@xxxxxxxxxxxxxxx>
> Candela Technologies Inc  http://www.candelatech.com



-- 
Thanks,

Steve





[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux