Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP30023: Computer Systems
Practice Exam 2022: Part B & C
Question 9
Consider an application opening a TCP socket to a host on a different subnet.
Describe, in one line each, the actions performed by hosts and routers as part of the protocols at layers 3 and 4
to achieve this.
Solution: Transport: Sends three-way handshake (SYN, SYN/ACK, ACK)
Network: Encapsulates TCP packets and forwards them through routers between source and destination
Question 10
A set of routers all support both IPv4 and IPv6 on all interfaces. Can the path from a router A to a router B
be different for IPv4 and IPv6? Why or why not?
Solution: Yes. Routing is implemented by the network layer. IPv4 and IPv6 are separate network layers, and
can choose different weights for different links.
Question 11
If a physical link gets cut, which OSI layers will definitely be affected? Which other layers may be affected, and
how?
Solution: The physical is affected because physical signals cannot flow through a cut link.
The link layer is affected because it cannot send signals through the broken physical layer
The network layer is affected because the topology of the network has changed, and so routing tables need to
change.
The transport layer *may* be affected because the rerouting may cause packets to arrive out of order, which the
transport layer may need to correct. If routing takes too long, it may time out.
Question 12
What is the relationship between routing and packet forwarding?
Solution: Routing is the process of finding which output link a packet should be forwarded on (populating the
forwarding table).
Forwarding is the process of using the forwarding table to send a packet of of the correct link.
Question 13
What does it mean for a hash function to be collision resistant?
Solution: A hash function H is collision resistant if it is hard to find two messages m1 and m2, m1 6= m2, such
that H(m1) = H(m2).
Question 14
Does virtual address translation require a TLB lookup? Explain your answer.
1
Solution: No, it does not. A page table is sufficient to translate a virtual address to a physical address. TLB
caches entries of a page table and can speed up the overall lookup time.
Question 15 Explain why encryption alone is not sufficient to establish a secure communication channel between
two parties.
Solution: Secure communication has to provide confidentiality, integrity and authentication. Unless each party
knows an encryption key of the other party, they may be susceptible to a person-in-the-middle attack. That is,
they maybe exchanging encrypted messages that can be also read by another party.
Another answer could be: Unless, the parties use authenticated encryption, their encrypted communication (i.e.,
ciphertexts they exchange) is susceptible to replay or tampering attacks.
Question 16
Consider the following programs whose execution can lead to a deadlock, where M1 and M2 are two files.
Your colleague suggests to duplicate M1 and M2 such that process A and B have access only to their own copy
of the file:
Though this may avoid a deadlock, explain why this is not a good solution.
Solution: The proposed solution may break the logic of the program. Process A will never see any changes made
by process B and vice versa. Hence, M1 and M2 are no longer shared objects. If A and B need to work on
the same task this solution would prevent them from doing so. Additional mechanisms will be needed to merge
changes made by A and B.
Question 17
Consider the IP header fields below.
(a) For those that a router is allowed to change, why does it change?
(b) For those a router is not allowed to change, why should it not?
(c) Some are changed by “middleboxes” (devices on the path that are not routers). Which ones are changed,
by what middle boxes, and why?
2
(A) version
(B) protocol
(C) identification
(D) DF
(E) MF
(F) Fragment Offset
(G) Time to live
(H) header checksum
(I) source address
(J) destination address
Solution:
(A) No. All entities must treat the packet as part of the same protocol
(B) No. The payload should not change, and so the payload’s protocol doesn’t change. (Half marks for saying
that a tunnel endpoint changes it during encapsulation.)
(C) No. Must be constant for fragment reassembly
(D) No. Fragments can be further fragmented
(E) Yes. Set to 1 for all but the final fragment during fragmentation
(F) Yes. Set during fragmentation offset
(G) Yes. Decremented by each router to avoid routing loops
(H) Yes. Changed whenever one of the other fields changes
(I) by NAT box for outbound packets, to allow multiple hosts to share a public IP address
(J) by NAT box for inbound packets, to allow multiple hosts to share a public IP address.
Question 18 Use Dijkstra’s algorithm to find the shortest path from A to E.
Solution:
Step A B C D E
1 (-, zero, O) - - - -
2 (-, zero, C) (A,1,O) (A,1,O) - (A,4,O)
3 (-, zero, C) (A,1,C) (A,1,O) - (A,4,O)
4 (-, zero, C) (A,1,C) (A,1,C) (C,2,O) (A,4,O)
5 (-, zero, C) (A,1,C) (A,1,C) (C,2,C) (D,3,O)
6 (-, zero, C) (A,1,C) (A,1,C) (C,2,C) (D,3,C)
3
Question 19
Some applications send “keep alive” packets every few minutes. How does that help NAT boxes?
Your answer should explain enough of the behaviour of a NAT box that the answer is clear to someone who has
not heard of NAT.
Solution: A NAT box keeps a table mapping between public port numbers and private (IP address, port number)
pairs. This is created when a packet is sent from the private network to the public network. To avoid stale
mappings, these entries are removed after a period of inactivity. Keep alive packets ensure that NAT entries for
active connections are not removed.
Question 20
Consider the trust model between 4 parties with IDs A, B, C, D as depicted in the image below, where each
party has a signing and a verification key (i.e., secret and public key of a signature scheme) stores a table where
each row contains an ID of the party that it trusts along with the verification key of this party.
For example, party A’s signing key is SKA and verification key is PKA. Party A trusts party B and it knows
its public key PKB .
A receives a message from someone claiming to be D. The message is of the form (m, s, PKZ) where m is the
content of the message, s is a digital signature on m that can be verified with PKZ . That is Verify(PKZ ,m, s)
returns true.
Describe the communication messages and verification steps using digital signatures that would allow A to verify
whether the message is indeed from D, i.e., that Z is D. Assume that each party can communicate with any of
the other three parties over an untrusted network.
Solution: A contacts B (over the untrusted/insecure network) and asks if B knows D. B contacts C and asks the
same. B does not contact A as the request came from A. C trusts D so it replies B with a message (sCD, tCD)
where tCD = (D, PKD) and sCD = Sign(SKC , tCD). B then replies A with messages (sCD, tCD), (sBC , tBC)
where tBC = (C, PKC) and sBC = Sign(SKB , tBC). A performs the following verification steps:
• Verify(PKB , tBC , sBC)