Thank you for the clarification. What you referred to in your initial inquiry is the Foreign Earned Income Exclusion. The requirements to qualify for the exclusion are as follows:
you must have foreign earned income, your tax home must be in a foreign country, and you must be one of the following:
A U.S. citizen who is a bona fide resident of a foreign country or countries for an uninterrupted period that includes an entire tax year,
A U.S. resident alien who is a citizen or national of a country with which the United States has an income tax
treaty in effect and who is a bona fide resident of a foreign country or countries for an uninterrupted period that includes an entire tax year, or
A U.S. citizen or a U.S. resident alien who is physically present in a foreign country or countries for at least 330 full days during any period of 12 consecutive months.
As you were only in Afghanistan for 170 days (just shy of 6 mos.), you will not be eligible to take the exclusion, therefore the answer to your question is yes, you will need to pay tax on all of your income.
Please let me know if you require additional assistance with this matter.
As we know that you have choices, I thank you for choosing this Q&A service today.