Exact results for the entanglement across defects in critical chains