don't change src ip after two initialize interfaces. I am using dpdk 1.6
Example code:
rump_init();
if ((e = rump_pub_netconfig_ifcreate("dpdk0")) != 0)
die(e, "create dpdk0");
if ((e = rump_pub_netconfig_ipv4_ifaddr("dpdk0",
"100.100.100.2", "255.255.255.0")) != 0)
die(e, "failed to create ");
if ((e = rump_pub_netconfig_ifup("dpdk0")) !=0)
die(e, "failed to rump_pub_netconfig_ifup ");
s = rump_sys_socket(PF_INET, SOCK_STREAM, 0);
if (s == -1) {
die(errno, "socket");
} else {
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
#if 0
sin.sin_len = sizeof(sin);
#endif
sin.sin_port = htons(80);
inet_aton("100.100.100.1", &sin.sin_addr);
if (rump_sys_connect(s, (struct sockaddr *)&sin, sizeof(sin)) == -1) { // this is ok, src ip 100.100.100.2
die(errno, "connect");
}
}
rump_pub_netconfig_ifdown("dpdk0");
if ((e = rump_pub_netconfig_ipv4_ifaddr("dpdk0",
"100.100.100.5", "255.255.255.0")) != 0)
die(e, "failed to create ");
if ((e = rump_pub_netconfig_ifup("dpdk0")) !=0)
die(e, "failed to rump_pub_netconfig_ifup ");
s = rump_sys_socket(PF_INET, SOCK_STREAM, 0);
if (s == -1) {
die(errno, "socket");
} else {
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
#if 0
sin.sin_len = sizeof(sin);
#endif
sin.sin_port = htons(80);
inet_aton("100.100.100.1", &sin.sin_addr);
if (rump_sys_connect(s, (struct sockaddr *)&sin, sizeof(sin)) == -1) { // this is error src ip 100.100.100.2
die(errno, "connect");
}
}