No one is trying to crucify Pakistan in this thread. It is all about protecting Afghanistan from irregular Pakistanis and other neighbors who are killing innocent Afghanis.
And one of the reasons for this mayhem in Afghanistan is its porous borders. Thus it is a key to secure Afghan borders if they ever want peace in their country.
The only way to protect Afghanistan is to make them stand on their own two feet somehow...
And then, force them to cease all hostility towards Pak, which means keeping Pakistans security needs in mind even in dealings with India.
The Pak Kashmir issue should also be resolved to defuse tension between India an Pak.
The Porous border will always be there, cant do anything about that.