Solution by OronSH.
Let P(x,y) denote the assertion
f(xf(x)+yf(x))=xf(x)+xf(y).
The zero function is a solution. We now assume f is not constant.
Taking x=0 gives f(yf(0))=0 for all y, so f(0)=0. Taking y=0 gives
f(xf(x))=xf(x).
Also, P(x,−x) gives
xf(x)+xf(−x)=0,
so f is odd.
If f(c)=0, then P(c,y) gives cf(y)=0 for all y, so c=0. Thus 0 has the unique preimage 0.
Now suppose f(a)=f(b). If this common value is 0, then a=b=0. Otherwise, applying P(a,b−a) gives
f(bf(a))=af(a)+af(b−a)=bf(a),
so
(b−a)f(a)=af(b−a).
Similarly,
(a−b)f(b)=bf(a−b).
Using f(a)=f(b) and oddness, we get
af(b−a)=bf(b−a),
hence a=b. Therefore f is injective.
From f(xf(x))=xf(x) with x=1, we get f(f(1))=f(1), so injectivity gives f(1)=1. Thus
P(1,y):f(1+y)=1+f(y).
Replacing y by y+1 in P(x,y) gives
f(xf(x)+yf(x)+f(x))=xf(x)+xf(y)+x.
Since xf(x)=0 for x=0, the quantity xf(x)+yf(x) ranges over all real values as y varies. Hence
f(z+f(x))=f(z)+x
for all real z,x. Setting z=0 gives f(f(x))=x. Substituting x=f(t) gives
f(z+t)=f(z)+f(t),
so f is additive.
The original equation now becomes
f(yf(x))=xf(y).
Putting x=f(t) gives f(yt)=f(y)f(t), so f is multiplicative. Since f(x2)=f(x)2≥0, the additive function f is bounded below on an interval, hence linear. With f(1)=1, we get f(x)=x.
Together with the zero solution, the solutions are
f(x)≡0orf(x)=x.