Modern vehicles are equipped with wireless communication technologies, allowing them to communicate with each other and forming large self-organized ad hoc networks (or vehicular ad hoc networks (VANETs)). VANETs, while promising new approaches for improving road safety, require privacy of vehicles (or drivers) to be protected from a variety of threats. Although pseudonym schemes have provided a promising solution at the upper layers, privacy attacks could still be carried out from medium access control (MAC) layer. In this project, we first propose a new MAC layer context linking attack, which could link the old and new pseudonyms of a vehicle by analyzing its transmission characteristics. To deal with the attack, we propose a time division multiple access based MAC layer Attack Resistant Pseudonym (MARP) scheme. Unlike traditional approaches that design the MAC protocols and pseudonym schemes separately, MARP allows vehicles to change their transmission slots and pseudonyms collaboratively. Thus, the unlink ability is guaranteed. Taking the pseudonym age, anonymity set size and time to confusion as the location privacy metrics, we derive an analytical model to quantify location privacy achieved in MARP. The analytical model is general to be applied for other pseudonym schemes. Extensive simulation results have validated the analytical model, showed that MARP can resist the MAC context linking attack and guarantee location privacy and efficient transmission for vehicles in VANETs.