Solution by pco.
We claim the only solutions are f(x)≡x and f(x)≡0, which obviously work. We now show they are the only solutions. Let P(x,y) denote the assertion that f(x+yf(x))=f(x)+xf(y).
f(x)=0 ∀x is a solution so let us consider from now that ∃a such that f(a)=0.
Claim 1: f(x)=0 ⟺ x=0.
P(1,0) ⟹ f(0)=0.
Let u such that f(u)=0 : P(u,a) ⟹ uf(a)=0 and so u=0.
Claim 2: f(−1)=−1 and f(1)=1.
P(−1,−1) ⟹ f(−1−f(−1))=0 and so, according to 1) above : −1−f(−1)=0 and so f(−1)=−1.
Let then u=1−f(1) : P(1,−1) ⟹ f(u)=−u.
Then P(u,1) ⟹ f(u+f(u))=f(u)+uf(1) ⟹ 0=u(f(1)−1)=−u2 and so u=0 and f(1)=1.
Claim 3: f(px)=pf(x) ∀p∈Q, ∀x.
P(1,x) ⟹ f(x+1)=f(x)+1 and so f(x+n)=f(x)+n and f(n)=n ∀n∈Z, ∀x.
P(n,x) ⟹ n+f(nx)=n+nf(x) and so f(nx)=nf(x) ∀n∈Z, ∀x.
Then, using f(qpx)=f(pqx)=pf(qx) and f(x)=f(qqx)=qf(qx), we get the result.
Claim 4: f(x)=x.
Let x=0 :
P(x,f(x)y−x) ⟹ f(y)=f(x)+xf(f(x)y−x).
P(2x,f(2x)y−x) ⟹ f(x+y)=f(2x)+2xf(f(2x)y−x) =2f(x)+xf(f(x)y−x).
And so, subtracting these lines : f(x+y)=f(x)+f(y), obviously still true for x=0.
Then P(x,y) may be written f(yf(x))=xf(y) and so f(f(x))=x and so f(xy)=f(x)f(y).
And we get the very classical system :
f(x+y)=f(x)+f(y) and
f(xy)=f(x)f(y).
Whose unique non constant solution is f(x)=x which, indeed, is a solution of original equation.