Solution by maromex.
Let P(x,y) denote the given assertion f(f(x)+f(xy))=f(x)+yf(x).
Case 1: f(x)=0 for all real x
This function works.
Case 2: There exists real x0 such that f(x0)=0
Claim: f is surjective.
Proof: P(x0,f(x0)t−1):f(?)=t for any real t. □
For any real number t, let s be a real number such that f(s)=t−f(0).
P(s,0):f(t)=t−f(0).
So f(x)=x−f(0) for all real x. Plugging this into the given equation, x+xy−3f(0)=x+xy−f(0)−yf(0). This means f(0)=0, so f(x)=x for all real x. This function works.
Combining cases, we get f(x)=0 for all real x and f(x)=x for all real x as the two functions that work.