Sudafed is one of about a squllion decongestants built upon pseudoephedrine HCl, a vasoconstrictor that works essentially by shrinking tissue near mucous membranes.
The drug's best work is done on stuffy noses due to colds or allergies, but some people report success in taking a decongestant to shrink the tissues of the eustachian tube (the tube connecting the nasal passage to the inner ear), thus allowing better airflow to equalize pressure on the eardrum.
If you want to give it a try, make certain you read the warnings on the box so as not to interfere with any medical condition you might have or other medications you are taking. Sudafed should take effect within one hour of ingestion, faster on a less full stomach. It's efficacy should be about 12 hours, assuming this is the dose you buy.
As a side note, pseudoephedrine works a little differently for different people. Some can take it with no noticable side effects. Others experience moderate to severe drowsiness. If you have to do something when you get off the plane, you might want to have a few cups of coffee first.