On-the-fly all-optical header processing and control signal generation were simultaneously realized using a dual-wavelength injection-locked Fabry–Pérot laser diode. The special two-level input control signal was generated by direct modulation of a distributed feedback laser. The header processing rate is 2.5 Gb/s, the payload data rate is 10 Gb/s, and the packet length is 25.6 ns. The switching ratio for the switched control signals measured spectrally was improved from 3 dB to over 20 dB by using a polarizer.