The production of free electrons in the ionospheric D layer by solar and galactic cosmic rays and the resultant absorption of radio waves